Project 2 – Dev Diary 2

Over the last 2 weeks I’ve been doing a lot of research and experiments for a potential new game. That last developer diary focused on a procedural map generator. This time I’ve been experimenting with skeletal animations for 2D characters.

The process involved taking a sketch of my player character and creating a vector version in Affinity Designer. Once I had that I took the colour fill out of the head, arms, eye pupils, hair and eyebrows. The reason behind this is so I can adjust the skin tone and hair accents of the character in GameMaker.

Once the character was created I had to export out all the individual elements; head base, eyes, eye pupils, hair, jacket, trousers, legs, sleeves, hands; and then repeat the process for the back view which would be used when the player is looking away from the camera.

Traditionally game characters would use a sprite sheet. These are large images that have every frame of every animation for each character in a game. The downside to this process is that you would need a lot of frames for a silky smooth animation – 60 per second in fact. I didn’t want to do this for my new project, instead I wanted to try out bones based animations. These have the benefit of only needing the individual elements as sprites which are then linked together and animated. The resulting sprite and animation files are tiny compared to sprite sheets.

With the elements all saved out and ready to go I turned to Esoteric Software’s Spine. I’ve had a licence for this application for a very long time but never got around to trying it out. I’m not going to lie, the learning curve was pretty steep. However, thanks to a number of tutorial videos I was able to piece together my character and set up the bones. Bones are used to connect each part of the character together; when the hips are moved the arms and head move as well. If you rotate the sleeve the hand rotates accordingly, and so on. I was able to quite quickly create a basic idle animation (standing still and breathing).

Next would be to add in animations for all the directions; right forwards, left backwards, up and down.

The reason for doing left backwards is so that I can have the character walking backwards as well as forwards depending on the direction the player is aiming.

With all this in place I could now import the character into GameMaker. Here I could start to bring the sprite to life.

What I wanted to do was to have the mouse (or gamepad) control the angle of the arms. Later the player would have guns to hold and so the arms would point in the direction the player will fire. This is actually easier than it sounds. Even though the arms were part of the animations GameMaker allows me to override individual bones in order to control parts of the character based on user input. This is also true for the eyes, which I set to blink every now and then (for added realism).

I’m very pleased with the results and although my code is at the moment a bit rough around the edges every is working nicely. Below is a video preview of the test.

Next I want to add in the female body type and look at what’s needed for holding weapons and firing projectiles.