iconLD48 2011 (#20)

2011-05-01

Took part in this LD. However, I had no time to prepare and also have too much stress with work and getting Fargoal 2 done to be really into it. Coding for 2 days straight as I did in some of the previous LDs seriously impacts me for the next days, the brain gets exhausted from it :) Which I can't afford now - almost had a bad conscience for "taking off" this weekend. Also, this must be the worst theme any LD ever had. Just a phrase from the beginning of Zelda1 which would fit for virtually any game. So one of the most fun parts of LDs for me, coming up with an idea fitting to the theme, was missing. Still, I'm quite happy about the theme since I got to watch a play-through of Zelda 1 on Youtube instead - it's a game I long have on my list of must-try games. I didn't get around to actually try it in a NES emulator so I'll leave it on the list, but seeing a video also tells a bit. Also, my actual game turned out nice enough - even though it's basically just a model viewer of a custom Blender exporter I wrote. I needed to get starting with Blender 2.5 scripting anyway, after this it should now be a lot easier to update all my 2.4 scripts. I spent quite a bit of time figuring out the matrix manipulations of armatures. The first stumbling block was:
scene.frame_set(0)
Basically, my first problem was that the exported mesh always had my armature applied already. So I made a frame 0 with everything key-framed to the rest position. Probably there's a way to get the raw mesh vertices - but well I couldn't find it. The next trouble was:
v *= armature.pose.bones[group].matrix.inverted()
This is what I spent the most time on. First I used .matrix_base of the pose vertices and tried to re-assemble bone position and orientation by following all the parents. But it never quite worked out. So then finally I decided to go the brute force route and added the above. Basically, I take the pose (again in rest position with the frame 0 trick) and then apply the inverse transformation to each vertex. When I now in-game just send the matrix to OpenGL everything ends up at the right place - and it all kept working with complex armature hierarchies. If a vertex is affected by more than one bone it might need more tweaking but the models for this game don't use vertex weights. Finally the third problem was gamma correction. With the simple solution of disabling "color management" in render settings. Just took some time to identify the problem then find that button in a rather unrelated place (i wasn't rendering anything, my scene didn't even have a camera or any lights). Now I'm only sad that it will be at least several weeks before I'll have time to get back to this game which I'd really like to finish.