Malevolence: The Sword of Ahkranox is an indie game with the intent to recreate the amazing turn-based, first person RPGs from the golden age of PC gaming using modern game engine technology. Rich classics such as the Might & Magic series, Eye of the Beholder and the like have inspired this new title which, when finished will put its players into a literally infinite fantasy world filled with procedurally generated content. The Sword of Ahkranox isn't trying to compete with the larger, professionally developed RPG titles out there, but instead our aim is to fill a large gap that we believe has existed in game technology since the mid-nineties. It is definitely a must-have for all enthusiasts of the quintessential RPG. The game's procedural engine can generate an infinite number of weapons, items, spells, monsters, dungeons, cities, countryside and even dialogue, allowing the player to explore the game with no end and no reason to stop.

Post news Report RSS The Mathematics of Infinity

So we've been engaged in some pretty heavy stuff lately... Making an infinite world is definitely not easy. Doing it purely in memory? Yeah, that's pretty easy... But getting it to render into a world that you can explore? That's some serious math right there...

Posted by on

Before you read on, please remember that we're gearing up for a giant Q&A post very soon! So if you have any questions relating to the game or the team, please ask us in the comments below and we'll answer them when we do the post! Doesn't necessarily have to be about Malevolence, either! This is your chance to get some insight into the world of game development!


So we've been engaged in some pretty heavy stuff lately... Making an infinite world is definitely not easy. Doing it purely in memory? Yeah, that's pretty easy... But getting it to render into a world that you can explore? That's some serious math right there...

But we're not afraid of math. We're afraid of being eaten by a Grue, but we're not afraid of math.

"Why is it so hard?" I hear you ask? I'm glad you asked...

Complex procedural worlds are like onions... Or cakes... Or parfait... They have layers. A simple procedural world is as simple as just generating a fractal, but a complex one? With heightmaps? And water bodies? And biomes? Frikkin biomes! That's what makes it complex, and there is much more to it than simply generating a fractal (or diamond or blob, etc)

"What is a biome?" you say? A biome (for all the non-Minecraft players in the audience) is an area of a game world containing a particular climate or biological community. For example, an icy tundra is one kind of biome, whereas a rainforest is another. The world of Ahkranox is made up of biomes so that after trekking through the desert for miles you will eventually reach some mountains, or a forest, etc.


Our planet is covered in biomes

Biomes are huge, spanning incredibly large areas and encompassing all within. To simulate this artificially, however, takes a large amount of complex mathematics.

"So why have them at all?" I hear you cry. Well, the simplest reason is the weather. Ahkranox is an infinite and persistent world. That's the key word there - persistent. That means that none of it is randomly generated. Because of that, it would make no sense to use randomly generated weather patterns so that one day it's snowing in Rhuthgart Village and the next day it's happy happy sunshine. Biomes keep the weather consistent, so that if you buy a house in the ice encrusted town of Ghurthak, then go questing in the sunny Wytchmeadow Fields, when you return home, your house still has a thick layer of snow on its roof. And we need that to happen EVERYWHERE in an infinite world.

"So how on earth does that work?" you ask? Well, that's what this blog entry is for. We've had loads of request for more technical information pertaining to the game. We can't give away too much about how we do the infinite thing for copyright reasons, but we can still show you a fair bit!

Like we said earlier, before Malevolence can show you the overworld like this:


It needs to generate a lot of information. Here's a quick rundown:


First of all, tier 1 needs to be generated in memory. Tier 1 is a rough imagining of the world around the player for about 500 miles in every direction. This is procedurally generated using the player's greater world co-ordinates, which keep a track of where in the world of Ahkranox they are. Once this is generated, it finds what colour the pixel is at the player's local world co-ordinates, which keep track of where the player is within their current greater world segment (In case you're wondering, there are 512x512 local world segments within a single greater world segment, and an infinite number of greater world segments). Based on the colour of that pixel, the biome is recognized. From this pixel, and the pixels surrounding it, the local world segment (tier 2) is generated. Why the second world segment type? It has to be done so that the player will see the edges of biomes approach as they walk towards them. It wouldn't do for the player to take a step and then *POP* be suddenly standing in a snowy version of where they had been. To prevent this, we generate the local world segment and work out where the edges of any nearby biomes are. Once the tier 2 segment is generated, we then look at the player's terrain co-ordinates and find where in the local world segment they are standing. There are 10x10 terrain segments within each local world segment. Of these, the player's map co-ordinates are used to find a grid of 3x3 of their local terrain segments (tier 3) to generate the terrain that they can actually see. This includes much more detail than before, such as flora, fauna and objects such as towns and whatnot. At the same time as this is happening, however, tier 4 is also being generated. Tier 4 is the player's local heightmap. This is responsible for generating the locations of hills and lakes, etc, which the player must traverse. The reason that this is done simultaneously is so that trees do not grow on the sides of cliffs or in the middle of lakes, etc. All of the details in the world are generated according to the heightmap and the current biome (for example, there isn't an abundance of flowers in an arctic biome, but there is in a forest biome)
Once all of this data has been processed, the 3D world can be created for the player to see. The player can walk about 100 meters in any direction before it needs to be generated again. However, the Hellfire 2 engine (upon which Malevolence is built) can process all of this information so quickly that it happens in the space of about 0.02 seconds. So, at most, the player will experience a tiny delay when moving between world segments (which you would have noticed in previous videos) which is really a very small price to pay considering that the world is infinite.

So hopefully that gives you a bit of insight into the complexities of this game!

On a more fun note, here's a video of procedural water bodies forming based on the world's heightmap (you can see the heightmaps generating in the top-right!) and you even can see some underwater temples spawning! Hours of fun!


So that's it for now. I hope this has been enlightening for you! More on the biomes when they're done and working properly!

Post comment Comments
[FH]Gorgutz
[FH]Gorgutz - - 286 comments

This engine just blows my mind. Amazing work!

Reply Good karma Bad karma+2 votes
CumQuaT Author
CumQuaT - - 776 comments

Awww, thank you! :D

Reply Good karma+1 vote
formerlyknownasMrCP
formerlyknownasMrCP - - 892 comments

This is really informative stuff. Can't wait to see what you do with this, so much potential.

Reply Good karma Bad karma+2 votes
CumQuaT Author
CumQuaT - - 776 comments

We like to keep people in the know! Glad to hear you're as excited as we are!

Reply Good karma+1 vote
Expack
Expack - - 312 comments

I must agree with the others in this thread - this is genuinely impressive stuff! However, my instinct has somehow convinced itself that Step 2 of this process is superfluous and could somehow be combined with Step 1 such that both the biome and the the terrain are generated simultaneously. In my mind, the procedural generation algorithm could be modified such that the engine is able to define biome areas in x, y, z, and t (t = time/fourth dimension) coordinates in the initial generation step. A simple biome grid might look like this if written in pseudo-code:

Biome GRASS is contained within:

Bottom Points:

10, 50, 0, 1500
50, 50, 0, 1750
50, 100, 0, 1790
10, 100, 0, 1750

Top Points:

10, 50, 100, 1800
50, 50, 100, 2020
50, 100, 100, 2090
10, 100, 100, 2020

I'm not sure if this is, in fact, possible - let alone feasible - but I thought I'd just toss this out here.

Reply Good karma Bad karma+1 vote
CumQuaT Author
CumQuaT - - 776 comments

To the external eye, you are totally correct. It would seem that tier 2 doesn't need to be there, but in actual fact, it serves a very specific purpose: that being of allowing the player to pass smoothly from one biome to the next. The reason it is there is because of the scale of tier 1. We don't want people traversing the world too quickly. Why generate tier 1 at all then? Because of our quest generation system. Since the quests are also procedurally generated, the quest generator needs to know where EVERYTHINg is within the local global vicinity of the player, so it needs to calculate the locations of cities, dungeons, people and other things for a very large distance. Because of this, we've added tier 2 to be able to make a bit more sense of tier 1. It's one of those strange, Rube Goldberg-style machinations that ties it all together.

But well spotted!

Reply Good karma+2 votes
myxale
myxale - - 666 comments

As a noob in such things, this was most enlightening!

Epic mates!

Reply Good karma Bad karma+2 votes
CumQuaT Author
CumQuaT - - 776 comments

Thank you! No questions for the Q&A?

Reply Good karma+1 vote
Expack
Expack - - 312 comments

Well, I do have some additional questions for the Q&A:

10. What advice do you have with developers dealing with the time differences between team-members? (i.e. The majority of your development team works in Australia, but some of your best QA testers work in Germany.)

11. Has your development team found any resources which are 'hidden gems' (e.g. unknown or obscure) on the Internet which you've been utilizing in the development of Malevolence: The Sword of Ahkranox? If so, what are they and where can we find out more about them?

12. What has your experience been like with attracting and working with professional voice actors?

13. Audio in games seems to have shifted from hardware rendering (i.e. Creative's EAX technology) to software rendering (i.e. Fmod). Why do you think this has happened? Do you think this shift has been beneficial?

14. On April 12, 2011, Brad Wardell of Stardock Systems, Inc, the people behind Galactic Civilzations and Sins of a Solar Empire, stated that he believed that the reason Valve hasn't released a new Half-Life game is because of the sheer popularity and profitability of Steam. (Source: Industrygamers.com ) However, unlike Stardock, where they admitted that focusing on Impulse caused a conflict-of-interest which crippled the development of Elemental: War of Magic, Valve is able to consistently release new, popular, and award-winning games on a semi-regular basis - in spite of the popularity and profitability of Steam.

If what Mr. Wardell claims of Valve is true, how do you think Valve is able to overcome the conflict of interest between its game development and Steam? If you believe not, explain why you think so.

Reply Good karma Bad karma+1 vote
Expack
Expack - - 312 comments

For #10, I had meant to generalize the company in the example I gave, but I realized that I failed to do so. :(
Just wanted to clarify.

Reply Good karma Bad karma+1 vote
CumQuaT Author
CumQuaT - - 776 comments

All good :) questions added to the list!

Reply Good karma+1 vote
CumQuaT Author
CumQuaT - - 776 comments

So far you're the only person who's asked questions! :P

Reply Good karma+1 vote
DoctorSpanky
DoctorSpanky - - 1,733 comments

With every article you guys post I want to play Malevolence more and more.

Reply Good karma Bad karma+1 vote
CumQuaT Author
CumQuaT - - 776 comments

This pleases us :) no questions for the Q&A post coming up?

Reply Good karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: