The Seven Sons of Qjyll Post Mortem

What was the purpose of developing The Seven Sons of Qjyll?

First: I had a free evening. I skipped a party to go jogging, then skipped jogging to write code. I know it’s geekish to skip social life, but you know what? I have a fiancée, I have friends, I have family, so I don’t have to attend every single party to feel social. Truth be told: for skipping jogging I have no excuse.

Second: I just read a Coding Horror article about becoming a better programmer by not programming. Of course writing Qjyll is programming, but breaking away from Zandagort and the other projects I’m working on day after day is almost like changing a diaper.

See also  Penguins vs Aliens Post Mortem

Third: last year I tried a few 24-48-72-hour game developer competitions and I really loved the concept. Having such a short time generates a healthy amount of adrenaline, prevents scope creep and leaves you with the satisfaction of actually finishing a game. Qjyll took only 6 hours (including the “story”) but there were no preset requirements on language, genre, theme or any other aspect of the game so it was much easier than typical competitions.

Fourth: I never actually made any RPG and/or fantasy games.

Fifth: I wanted a huge/infinite map without storing anything in a database. To achieve that I needed an algorithm that generates the map runtime. Idea number one was fractals, but they are too regular and not really suitable for tile maps. Idea number two was hash functions. Hash functions are cheap (fast), deterministic (produce the same result every time) and create an avalanche effect (continuous input generates semirandom output). Perfect for map generation. Just take a look at this example:

See also  How (Not) to Exploit Yourself

But having the same map for every game reduces replay value. So let’s have a random (of course only as random as computers can get) factor that is stored in the session (ie. a cookie) and use it as a seed for map generation. This way we can have an infinite number of different infinite random maps.

Of course if the player changes something in the game world (eg. kills a monster) it has to be stored. Since the world is infinite there’s an infinite number of monster in it. Killing only half of them means storing an infinite number of kills (/2 = ℵ). This is impossible, so Qjyll only stores a hundred kills (in a FIFO cookie) and a hundred picked up items, which means if you wander long enough and then get back to where you started you will see that the monsters you killed at the beginning resurrected (should be zombies not orcs).

See also  Re: xkcd: Citogenesis

Now it’s really time to go jogging…