Friday, June 13, 2014

Developing a game: Harold the Hedgehog

Harold the Hedgehog

No, his name is not really Harold, but for the purposes of this post/blog, i'll refer to him as Harold.

This is Harold.
He came to exist some time in 2014. i think, created by his artistically talented mother.

This is also Harold.
Harold is walking in this photo of him. He's really photogenic.

Harold also knows how to jump.
You might ask yourself, why i am telling you things about Harold.
You see, Harold is currently the main actor in a game, and is therefore receiving some media coverage, being a young star and all.
It's really hard, the life of Harold the hedgehog. The gravity of his world is sometimes very strange, which causes problems for Harold.
You see, he is, unfortunately, scared of heights, which makes him all twitchy.

This is Harold's little abode. Forgive the crude look of the trees, they were made by Harold's artistically retarded father.
He passes his time by collecting apples from the trees using his inexplicable ability to jump one more time in midair. He says it's a gift from his dad.
He has infinitely deep pockets, so he just keeps track of the number of collected apples.

"Collected" apples.


The majority of the current "game" is written entirely in Lua scripts.
The core is written in C++, the bigger parts being the graphics system (using DX11), animation system, the windowing system which includes input support, and the core game definitions.

The Lua scripts contain code for the animation state machine, which helps Harold transition from sitting on his ass into moving and then jumping and back. They contain the entire movement code, to make him go left and right, which is tied to reading the keyboard inputs to make all that happen in the first place. There's also a basic output console for debugging purposes.

I also made a small objective to collect 10 apples as fast as possible, with a timer that records and shows the best time.

The most helpful feature in the entire code base is definitely the fact i can change resource files (scripts, textures, shaders, data definitions, etc) while the game is running, and upon saving said files, the game picks up on the change, and promptly reloads them, which makes the rest of the code use the changed data.

This has helped me make, test and debug the code for collision detection so Harold can collect his apples properly, and tune the strength of gravity and the strength of his jump. It also helped fix some spacing problems with the font, and i expect it to be very useful in the future when i start coding some real behaviour Harold will be expected to exhibit.

A word from the author

I'll be keeping track of the progress about Harold as time goes by. The format of this blog post seems fun for now, so expect to see more similar posts.
Stay tuned!