We call this a "Laser".


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

Give this entry an award


Ratings (show detail)

Overall: 3.4
Fun: 2.7
Production: 4.2
Innovation: 3.3

40% respondents marked the game as not working.
Respondents: 6


File Uploader Date
We call this a "Laser".
mauve 2013/04/21 09:44
Get your own bubble!
mauve 2013/04/21 09:17
Warlocks 1.0.0
mauve 2013/04/21 00:41
Soothing. Unless you're on the receiving end.
mauve 2013/04/20 00:18
Light accumulation buffer
mauve 2013/04/20 00:17
I can smell something burning
mauve 2013/04/19 23:27
Woah, it's so green, man!
mauve 2013/04/19 22:38
Goodness gracious, great balls of magic
mauve 2013/04/18 00:31
Flame on
mauve 2013/04/18 00:28

Diary Entries

Warlocks - Day 4

Day 4 and the first diary entry? I'm normally good at diarising progress, but I wasn't here on Sunday so perhaps it threw me off my game a bit.

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:

1 comment

Warlocks - Day 5 and 6

Day 5 was a low point, which is why I didn't add a diary entry. I felt that the thing missing from our day 4 screenshots was light. The spells look strangely false, disconnected from the world. So I decided to play around with GLSL shaders to do per-pixel lighting. The reason it was a low point is though I managed to set up a light accumulation buffer system with a sizeable amount of help from internet research, I hit a wall trying to get the lights to appear in the right positions in space.

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:
  1. To use normals in shaders they have to be transformed with gl_NormalMatrix. Duh.
  2. Shaders are all about converting to eye space. Don't try to convert backwards to world space. Duh.
  3. Euclid's Vector3 instances aren't multiplied correctly by a Matrix4. You need to use Point3. Fuuuu...
  4. 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:

Pretty, no?

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.

Add a comment

Warlocks - Day 7

Day 7 was a long hard sprint to the finish.

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!