Horddays – design, programming, and some afterthoughts

Participation in an event such as 7DRL is a truly exciting life experience. Designing and programming games was my primary hobby for very long time. Since early childhood, I was making games to play with my brother and occasionaly other family members. Although, I was always considering myself to be a slow developer, enjoying the process, spending weekends and sometimes whole weeks, creating worlds first in my head and translating them into code. I have no doubt, I came to programming through games, and I still like
writing code thanks to games!

Planning (Unexpected things happen).

A week ago, it was a late night, Wednesday or Thursday, I was doing some boring work and tried watching Highschool of Dead. I kind of like the zombie worlds, and apocalyptic worlds in general. When I was younger, I read John Christopher’s novels quite a lot. All TV Shows like Survivors or Jericho are awesome and I like them a lot. But at the same time, recent seasons of The Walking Drama Queens are frustrating to watch. So, somehow, the desire to write my own Cataclysm-ish RL came to my mind.

The initial thoughts were:

(1) Zombies should not be treated as entirely individual units. Their hordes should be programmed with the flocking model.

Pros: Easy to implement, probably novel, and hopefully fun.
Cons: Never tried that.

(2) Zombies don’t need good AI. They must be dumb, and there will be a lot of them. Hoping that flocking behavior can make up for the absence of real smart AI.

Pros: Perfect for the 7 days time limit.
Cons: Dumb mobs are not fun.

After this initial idea crystallized, the next day, I added a few more design decisions that are not extremely novel, but they fit the setting nicely:

(3) Zombies’ senses are limited, some can only hear, others can only see, etc.

Pros: Adds variety.
Cons: Programming them takes time, but its reasonable.

(4) Good to have 3D environment. It was kind of a big deal for the Cataclysm community. Although, I did not want the shooting-from-the-roof type of 3D. I wanted some more parkour-ish environment with high and low places, ramps, and whatnot.

Pros: Should be fun, I want to be able to hide and run away from the hordes.
Cons: Never tried programming 3D environments.

(5) Since programming the inventory can be a big hurdle, let’s make the inventory work like a stack: the character has to use the first item from the top of the stack.

Pros: That is manageable. Also, adds some constraints, which can be good.
Cons: Questionable decision. Adds some constraints, which can be bad.

At this point I realized that this whole thing sounds like a nice 7DRL idea. And what is even better:

(6) I don’t need fancy data structures to implement everything! (Only the linked list for the inventory). So, I can program the whole thing in plain C, and I have some experience programming a crossplatform game in it, so there will be a Windows build too, in addition to the source code for Linux, OSX, and other unixes.

Pros: I love plain C. Also, I have some code for SDL rendering already.
Cons: Never programmed a roguelike in C. It is C, so no fancy stuff allowed.

With all this in mind, I felt really tempted to take part in 7DRL 2014!

The challenge.

It was very enjoyable. Fortunately, loading the tileset images, and the tiles blitting functions were already implemented for my another project, so I could focus on the inner workings. And try to keep things as simple as possible. Maybe surprisingly, C is great for that. It encourage O(1)-time constructions like integers, arrays, structures, pointers.

The first 1.5 days, I spent laying out the main game systems, particularly, the 3D environment, and the field of view algorithm. For the 2D filed of view, I could translate my old code from OCaml to C (although it was non-trivial, considering the fact that the old code used recursion and anonymous functions, but it was easier that writing the whole thing entirely from scratch). To making vision three-dimensional, I essentially cheated. The world was a simplified 3D world, without things like bridges, floors, or roofs. So, some modification of the 2D FOV code worked good enough.

Then, the mobs were added. By the end of Sunday, I made a reasonably good time system, and flocking behavior for zombies. Also added smell and hearing as the first two perception mechanisms. This is where I got by the end of the weekend.

By the end of Tuesday, I made a reasonably good map generation with connected levels. Mobs and the player are dealing damage. Also added sight as the mobs’ third sense. Implemented the inventory and items picking up. No actual items yet. Work makes things go slower, but I’m still going pretty good.

Wednesday was not very productive – I’ve got food poisoning, but still managed to add some basic items like Medkit, Rock, and Antidote (oh, irony).

On Thursday, more items were added, including weapons. Even better level generation and overall parameter balancing. Levels are getting bigger with difficulty, and items are added gradually. Overall, there was enough contents to play for 7-9 levels, and most likely even further. Although the game gets harder with each level.

On Friday, I did not have a lot of time to work on the game, but I tried to finalize and wrap up the whole thing. The game was uploaded to github, and I produced the Windows build. There was one unexpected issue, the amount of memory allocated on the stack was too large to run on Windows (32bit), so I had to change the memory allocation method for the main game state object to the heap. Minor problem, but really annoying.

The week of work was definitely successful! Hope, the result will be fun and interesting for players.


Not a lot, I’m still trying to have rest and finally sleep for more than a few hours. Started playing games made by others. Participation in something like 7DRL is a good thing, particularly if one has a clear vision of the game, and you exactly know how it can be done. Probably, It’s important to hit the sweet spot, balancing the familiarity of implementation and the novelty. The idea must permit easy implementation. You have to like programming games too. Hahaha, obviously.

Even a month ago, I could not imagine myself making a full game in such a short time span. I’m not sure if I will be able to pull it off next time. If I’ll get a good idea, really hope so.

Leave a Reply