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!

(log in to comment)


Awesome except for the mouse in the screenshots, I spent about 30 seconds shaking my mouse wondering why it wasn't working before I realised.

I am going to have to have a look through your code to see how shaders and stuff works.

Game runs on 64bit Linux (OpenSuse) without any problems. Dependencies are a little bit tricky to install.
Which ones? Cosmologicon had trouble finding/installing gletools, which can be found here.
I have done some mistakes with pyglet one. It requires pyglet 1.2 alpha. `pip install pyglet` does not work.

Yeah, gletools is also small inconvenience. You need to download it by hand and python setup.py install. 
You can use this to install Pyglet 1.2 alpha1:

pip install http://pyglet.googlecode.com/files/pyglet-1.2alpha1.tar.gz

For gletools:


As long as you install Pyglet 1.2 first it will work!

Tip: you can distribute the projects with your game IF they're pure Python (looks like is the case). You can do python setup build and it will generate a build/*/... directory. You can safely add the contents in you source code tree.

For example (gletools, my game in ~/mygame):

1. python setup.py build
2. cp -R build/lib.linux-x86_64-2.7/gletools/ ~/mygame

That's it! When you import gletools Python will search for the module in the same directory your script is running (ie. run_game.py).

I hope this helps!

For gletools:

pip install http://hg.codeflow.org/gletools/archive/tip.tar.gz
Generally I tend to go the other way and make sure dependencies are unbundled to make sure it packages cleanly. Doctor Korovic's Flying Atomic Squid and Last Train to Nowhere are pip-installable.

I'm not honestly sure whether we require pyglet 1.2a or whether it will work on 1.1.4, I just haven't tested on anything older than 1.2a.
After getting all the dependencies, I've still been having issues running this game; I keep getting

    import error: no module named lepton.

I found lepton itself inside the package, so I don't understand why it can't seem to find it. Is there something else I'm missing?
The included lepton is, IIRC, just patched to fix a couple of bugs on 64-bit systems for convience.
You still need to install lepton - I think it was mentioned in the Readme. 
Ryan42: Yes, you need to install lepton with setup.py within the lepton directory.

This requires a compiler. The way I do it on Windows is make sure MinGW in installed and on the path then run

python setup.py build --compiler=mingw32
python setup.py install

Other platforms may just be able to run

python setup.py install

I was going to put together a py2exe package, but the only Windows machine I have access to doesn't have up to date graphics drivers and prints a message about wrong OpenGL version. It also won't let me install what ATI/AMD claim are the current drivers for that chipset, so I'm afraid I'm stuck on that front.

(If you get messages about missing definitions in OpenGL, update your graphics drivers.)