Game developer and Creative Director on Malevolence: The Sword of Ahkranox
Posts by Alex Norton
  1. Designing a game to behave in ways for which it was not designed ( Counting comments... )
  2. The Crowdfunding Experience ( Counting comments... )
  3. Marketing Outside the Box ( Counting comments... )
  4. What they DON'T tell you about being a game developer ( Counting comments... )
  5. The Trials of the Game Developer ( Counting comments... )
  6. The Difficulties of an Infinite Video Game World ( Counting comments... )
  7. Kevin Bacon in Video Gaming ( Counting comments... )
  8. Pushing the Button More Carefully ( Counting comments... )
Advocacy / Game Design / Technology/ Code /

The Premise

Procedural Generation is definitely in vogue, and I personally have believed that it is the way forward in video gaming for many years now. Using procedural generation in games is nothing new of course, as fans of games such as Elite or The Sentinel will know that we've been seeing it in games for a good 25 years.

Older titles made good use of it due to the memory constraints of the hardware of the time. It was simply more efficient to have generated levels rather than hand crafted ones, but that is no excuse for games not to make better use of it now that we have better specced hardware.

Fans of the RPG genre will no doubt remember The Elder Scrolls II: Daggerfall, which had one of the largest in-game worlds ever seen, and still to this day tramples almost every RPG made in terms of world size. I recall reading somewhere that the in-game world of Daggerfall was equal to twice the landmass of the British Isles.

That is a heck of a lot of world to explore, and - from a game design perspective - a nightmare to recreate by hand. Through clever use of procedural generation, however, it is easily possible, which is what Bethesda Softworks did with Daggerfall. The settlements and towns were hand-crafted, with the wilderness in between being generated by the game.

But why stop there? Why have world borders at all? Procedural generation code hasn't changed much in the last 25 years. People are still stuck using fractals and diamonds and blobs to do everything, which becomes repetitive and quite simply looks like procedurally generated content. To any programmer looking at it, it virtually smells of procedural generation. On top of all this, if you get it wrong, it will end up VERY wrong. The indie crowd seems to do it best, with titles like Dwarf Fortress generating MASSIVE worlds with lush histories and more world than you could ever hope to explore. But still, they aren't pushing the envelope. My aim was to fix that by making it work. An infinite game world should be possible, and indeed it is.

 

The Idea

Just over two years ago I began assembling a team to make the first truly infinite, fully 3D fantasy RPG, entitled Malevolence: The Sword of Ahkranox. It was to be played in a style similar to the classic grid-based, first person RPGs of the late 80s and early 90s such as Might & Magic, Eye of the Beholder and Dungeon Master, but set in a literally infinite world. We had originally thought to make it a planet-sized world, but in the end decided on the story being that the game's world was being created within the imagination of a sentient sword, which would act as a way to "explain" the infinity of it.

After much experimentation and very complex math, we got it working, but all in raw data. Nothing really playable. But we had in front of us an infinite world filled with infinite dungeons and infinite cities filled with infinite NPCs. We then worked to get a game working in such a world (some of the efforts of which, you may have read about in my last post)

Now, just to confirm, this world wasn't being randomly generated. It was both infinite AND persistent. Without going into too much detail, this is achieved by making the world dynamically affected by the passing of time. Every part of the world is identified as either affected by time or timeless. The lay of the land with its hills and caverns... That's all timeless, and never changes. Because those parts never change and cannot be affected by the player, they only need to be loaded into memory when the player can see them (or if they are needed to generate quest information, etc). However, if an object is affected by time (for example, the contents of a chest), then they have a time coefficient applied to the procedural algorithm that generates them. This means that a chest in a dungeon, for example, will have different items in it depending on WHEN the player opens the chest. If the player was the clear out that chest, that act is stored in a database of player changes, but then re-set when a certain amount of time has passed. This ensures that the database of player changes to the world never exceeds a certain size (which is estimated to be around 250mb at the very most, but more realistically around 50mb)

This generation accounts for almost everything in the game. Spell creation, item creation, weapon creation, potion creation, NPC dialogue system, even the spell effects that happen on the screen. Due to this, the world that the player explores will be ever-changing and infinite. They won't keep finding the same old weapons or items, there will be no end to the number of spells they can find or use, they won't even keep having the same conversations with NPCs. This is necessary to keep a player interested for long enough in an infinite world.

 

Public Acceptance

Back when the game Elite was first being worked on, it was planned to have around 282 trillion galaxies with around 256 star systems in each one, but their publisher, Firebird, were worried that such a large in-game universe would be intimidating to players and put them off. I have to say I had wondered at that, and was interested to see how the public would react to an even bigger in-game world.

I was surprised at the results.

We've been quite public with our development process for the game so far and generated a small cult following on communities such as IndieDB, but very few people seem to quite grasp the scale of an infinite world, despite our thorough descriptions of it. We had put up renders of the world generation data, showing just a tiny fraction of the world:

And then, we showed them this:

That inland sea is around the size of the entire in-game world of Skyrim. Funnily enough, the largest response we got from this information was disbelief. Many called us liars and that it simply wasn't possible. Others began to believe that the world size of Malevolence was the entire above image, rather than infinite. Only about 20% of people really understood.

So, from a marketing perspective, it's been a bit of a nightmare to have an infinite world. We've even had many suggest that Malevolence is just a rip-off of Legend of Grimrock, despite the fact that Malevolence was started about a year before. But that's always going to happen, no matter what the game. What happens upon release will happen, and that's just how the cookie crumbles with game development. Funnily enough, that hasn't been the hardest bit. The hardest bit has been the math involved in making a world like this one.

 

The Math

Being infinite, procedural AND persistent, most of the mathematics behind Malevolence is theoretical math - that is, mathematics with few or no fixed/known values acting in a volatile space. But we've broken the world creation down into multiple layers.

The first layer is the one you saw above. A large world segment is generated which covers an area of about 400x400km. This is the only layer of the game that uses a standardised procedural generation system (perlin noise)

That is then broken down into chunks that are around 3x3km, calculating the biome information within that area, like so:

In the end, all of these steps need to be completed when each new world segment is generated in order to turn the raw data into this:

That is just for the overworld. Every world segment that is VISIBLE to the player (as in the view above) is given a unique code, generated by the procedural algorithm. If there is a dungeon entrance in that segment, the dungeon is generated using this unique code, ensuring that every time the player returns to that spot, the same dungeon will be there:

This same method is used for town generation, graveyards, ruins or anything else that the player may encounter. And this goes on forever. If a player was to turn off collision and hold down the 'move forward' button, it would take them just under three weeks to walk from one end of a world segment to another, and then they would simply move to a new world segment seamlessly, and then another, forever.

The biggest question we have been given is how we have dealt with the data type limitations on player co-ordinates, but unfortunately we can't give away all our secrets :) But I can tell you that Malevolence doesn't suffer from the Minecraft world-edge issue, it just keeps going on and on.

 

Conclusion

Using procedural generation in your game can be a rewarding experience, but definitely don't rush into it. It takes good planning, clever usage and most of all it needs to feel seamless, otherwise the public simply won't accept it.

If you'd like to read more about Malevolence: The Sword of Ahkranox, you can check out these links: