As I enter 2011, I’m convicted that I’ve been a particularly poor steward of the time given to me by God during 2010. One of the things that I could have made a lot more progress on than I did was Ebenezer, my Old Testament adventure game. Over New Year I’ve been doing some reflecting on life generally and trying to renew my vision for what I’m up to – it’s all too easy to start thinking of things as “just a job”, just something I’m “supposed to do”, and the game is as prone to that as anything. But of course that’s not really why I want to finish this game at all – it’s supposed to be all about the gospel. I was using the prayer for “New Year” in The Valley of Vision this morning and came across this great little petition:

“Give me a desire to show forth thy praise;

testify thy love,

advance thy kingdom.”

That’s what it’s really about – and I think somewhere along the way I’ve slightly taken my eyes off that goal. Anyway, in a spirit of renewed intentionality, I’ve decided to use the next three days as a my own personal SpeedCoding content / hack-a-thon / coding marathon / whatever term you want to use. The project I’m working on is coding up a 2D adventure game engine in Unity, which I’ve made a bit of progress on already but still has some fairly key features missing. In particular, I want to focus on the following:

  • Making it so that characters can walk and talk at the same time
  • Making it so that characters can turn their heads independently from their bodies
  • Support for more than one animation set for a given character
  • Supporting transparent layers in the background images so that characters can walk behind objects

That’s probably more than enough to be getting on with! I’m going to try and stay mostly offline for the three days, minus some permitted rest breaks, but I’ll try and keep an hourly log of what I’m up to in a text file somewhere and update this post periodically – so do feel free to check back occasionally. I’ve also installed some software that will take a screenshot at regular intervals so I can make a timelapse video at the end of it.

Let the coding commence! Oh wait, I better go get some breakfast first.

8.18am

Music: Homestuck – Vol 6

Got my cup of tea – time to get started! The first task is to figure out how to get Blender to render a separate tileset for a character’s head and body.

9.19am

Music: Homestuck – Vol 6

Figured out that what I probably need is Blender’s ‘render layers’, but it’s a bit of a pain since layers are based off objects and not individual vertices. That means the head needs to be modelled as a separate object from the body.

10.01am

Music: Homestuck – The Felt

I’ve got it rendering the head and body separately now. The slight complication I’ve realised is that the head doesn’t stay still whilst the character walks, so simply overlaying the head from the ‘talk’ animation isn’t going to work, since it’ll be in the wrong place for half the frames. I guess I need to make my renderer script spit out a config file that specifies the pixel offset of the head for each frame.

11.04am

Music: Homestuck – Vol 5

Giving up and having a coffee break. I’ve got the position of the head in 3D space, I’m just a little stuck figuring out how many pixels that will correspond to once rendered.

12.40am

Music: Homestuck – Vol 5

Have successfully got it to render out all of the necessary sprites, plus a config file that includes pixel offsets for the head position in each frame. The next step is to get the body and head sprites combined correctly within Unity.

14.22pm

Music: Jamiroquai – Emergency on Planet Earth

Just taken an hour for lunch, including going for a little walk to buy some fruit. A healthy coder is a happy coder!
Next on the agenda is to get Unity to draw the body and head of the walk animation together, so that essentially it looks exactly like it did yesterday only with more effort. Then I can move on to make it show the body from the walk animation and the head from the talk animation.

15.58pm

Music: Jamiroquai – A Funk Odyssey

I’ve got the head bobbing about now, controlled by the offsets in the config file that Blender spat out. Next step is to allow the head to talk whilst the body walks. First I’ll have a little tea break, though.

17.01pm

Music: Jamiroquai – The Return of the Space Cowboy

Hmm… Well the head animation itself needs some work so that the pivot axis lines up with the position of the neck on the body, but other than that it all seems to be working nicely – characters can now talk whilst they walk, and turn their heads independently of their bodies.

What it has turned up is some really tedious issues to do with Z-order when drawing these sprites – you can’t assume that the head is always on top of the body, for instance (particularly for characters with beards!). I’m going to have to figure out a strategy for dealing with this when I come to implement layers in the backgrounds, e.g. so that characters can walk ‘behind’ things like tables. I’m going to work on some other easy stuff for a while until dinner.

Read about Day 2 here, and Day 3.

 

Leave a Reply

Your email address will not be published. Required fields are marked *