Under a starry sky, two wizards meet to settle an age-old rivalry.
Please read the instructions carefully before playing; you won't get the right results from the lepton particle library if you don't.
Disclosure: This game builds on an unfinished scenegraph library I built before the competition by cobbling together freely-available code from the web, for things like model loading and compiling shaders. That library was published in the discussion boards more than 30 days before the competition but was not documented.
"Road Less Travelled" award for packaging
Presented by scav
Ratings (show detail)
We call this a "Laser".
Get your own bubble!
Soothing. Unless you're on the receiving end.
Light accumulation buffer
I can smell something burning
Woah, it's so green, man!
Goodness gracious, great balls of magic
Warlocks - Day 4
So to catch up - the last 2 nights have been spent modelling and animating a wizard dude. Tonight was spent playing with particle effects with lepton. Lepton's OpenGL renderer didn't work properly for me when I wrote Doctor Korovic, which is why I wrote a crappy pure-Python renderer. This time round it's much more important, so I dug into the C code to fix it properly. I discovered it has a bug on 64-bit architectures (my patch is here, I have submitted it via the lepton google group too but the message doesn't seem to have appeared yet).
Anyway, without further ado, today's screenshots:
Warlocks - Day 5 and 6
I salvaged one screenshot of the light accumulation buffer even with the wrong light positions:
This buffer contains the contributions of a red light and a green light. By adding more passes I can sum an arbitrary number of lights. Then there is a pass to draw the textures multiplied by the light buffer, then a pass to draw in the particles, unshaded.
After about 4 hours of banging my head against the wall, I cracked getting the lights to appear in the right places, with the help of pencil-and-paper sketches, a lot of thinking, a lot of trial and error, and finally some nosetests. The nosetests are what broke the back of it, but the thinking and sketches were vital too, and I implemented camera movement and various other things to help get a handle on the problem. There were a succession of breakthroughs:
- To use normals in shaders they have to be transformed with gl_NormalMatrix. Duh.
- Shaders are all about converting to eye space. Don't try to convert backwards to world space. Duh.
- Euclid's Vector3 instances aren't multiplied correctly by a Matrix4. You need to use Point3. Fuuuu...
- The documentation for gluLookAt() contains at least one mistake - two if I understand the modelview matrix system correctly. Fuuu...
Anyway, with the satisfaction of having cracked the lighting problem, I rebuilt the spell effects with light:
These are per-pixel effects so in principle they could be modified with normal maps. I've thrown away the specular component in the original shaders, it didn't suit the subject matter.
So we're behind on writing a game, but with one big day left we might get something playable. I've learned a lot, in any case.
Warlocks - Day 7
Things that dropped today included damage, death, AI, spell selection, more spells, music and sound, the latter taking only about half an hour thanks to the author of this pre-prepared pack of spell sounds I hit upon just when I thought it would be too late to get sound into the game.
The only final day snag was when my models started blowing up into a mangled mess of triangles as I was trying to add the death animations. I finally cracked it by baking bone envelopes into vertex weights and then doing weight painting. Make sure to keep vertex weights normalised!
I started the day with a small but significant improvement: the wizards have different robes, cloaks and different colour crystals in their staffs. This took a rewrite of the model/material loading code so that materials could be shared between models or not, while vertex lists remain shared.
This shield effect is probably the highlight of day 7 - it turned out to be relatively easy graphically - just a few lines of shader code and a light - but what really sells it is lepton's ability to make particles deflect off it:
This laser effect on the other hand isn't all I wanted; it doesn't have the sense of hurling energy at your foe.
There's a bunch that didn't get done. I had tons more ideas for spells, of course, but I was keen to get in a system of charging up a spell, costing more mana but getting more explosive effects. The scenery is also very barren; I was going to put in a grass texture and add a bunch more background flora.
All in all, I had a lot of fun this Pyweek. I've disclosed on the entry page that this built on the ramshackle collection of 3D code I'd pulled together pre-Pyweek. Nearly everything has been rewritten and improved, so it would be a shame to be disqualfied, but I'm not in it for the win this time. I've improved my 3D graphics knowledge, learned a few ounces more Blender, and battle-tested the scenegraph code which I hope to get documented soon. I look forward to playing everyone's games!