We’re 3 weeks into our crowdfunding campaign over on Fig! That means everyone is really busy but are still committed to keeping you up to date on our development process with regular blog posts from our design, art and code team. This time we are hearing from Lead Programmer, Niels, on building tools to give players a universe to explore with the procedural generation of levels.
We envisioned Antegod’s as a 4v4 online multiplayer game with an ever changing battlefield.
That ever changing battlefield is an important piece of our game, as you can destroy and shape the battlefield in any way you want, but that’s not all. Every time you play the game, we wanted you to fight on another planet, with different paths to critical points and thus the battlefield will have a different layout and a brand new dominant strategy to learn.
Where other games, such as Dota or League of Legends, usually have a single battlefield, we wanted Antegods to have an infinite (™) number of them. This forces you, the player, to actively explore the level in search of regions and energy rather than knowing the best paths. We call this the ‘exploration’ phase of the game, which is the first of three phases every game of Antegods will have.
This was our first time developing a procedural generation system at Codeglue, but looking at what our fellow indie devs have done in games such as Binding of Isaac, Terraria and Spelunky, we had some good ideas on how to approach this difficult challenge.
We felt that working on the algorithm outside of unity was the best way to start, and so we set about creating a tool using WPF, which allows for easy displaying of images.
After a couple of weeks of programming the tool, figuring out the algorithm and tweaking everything we were able to demo this image:
A picture can express a thousand words but looks can also be deceiving. There is quite a bit of explanation required to tell you what goes on to arrive at this point so I’ll break the whole process down, step by step;
In the gif below note the steps in the bottom right. The very first step we do is determine the nimbus, or edges, of the map. We do this by sampling a 1d simplex noise value per pixel, using the value to push in the nimbus.
Then we fill up the level with a set of rooms, very similar to how spelunky does it, as explained here. Up until this point, the procedural generation is not very unique, however that changes in the next couple of steps.
The next steps involve building a central corridor to the main objective of the game; the turn-in point. This point is crucial as every player must go there to deliver energy and power up their titan. In the above gif and towards the end of the process you can see the central corridor is going in a straight line before arching downwards in the centre.
Looking at this, you think “Wouldn’t this be a very boring level?” and we thought the exact same thing! So we spent some time iterating and tweaking the algorithm and the room themselves so it would produce much more interestings paths.
Once the main path has been generated, we place the spindle point in an area just off its center, and then begin generating the energy and scattering it in the ‘wilderness’ or outer edge of the level.
We use a curve (y =1 – sqrt(1 – x2)) to sample the chance of an area receiving energy. We experimented with different curves, but this one was preferable since it gave a very small chance at the beginning, while still creating a 100% chance at the end of the range. Note that this curve was not used in the early version above, only in the later versions.
In the gif from step 65 to step 78 a lot of calculations happen, mainly to find good spots where we would create a ‘region’.Regions are areas in the map where the native people would build temples. In the current version of the game the regions can be captured by players and used to hold and defend territory.
We created the following rules for a Region:
We generate an ‘influence’ map from these constraints and use that to find optimal spots for each of the region control points and its surrounding turrets.
This influence map is of a different level and a tweaked generation algorithm. We found that it had a tendency to place the region control points near certain objects, which didn’t work. So the area around the turn-in point as well as the titan is off limits. However, the direct area around that is of high value, visualized here as a lighter green color.
There are two spots in the top left and top right corners, those are the spindle points. Spindle points are temples that can regenerate energy during a match. They represent a high value area to each team. Usually a team would use these regions to make sure they have a regular supply of energy to power their titan and capture other regions.
In the example below you can see 6 regions created; 3 on each side of the map.
And there you have it. All of these steps are needed to create the changing battlefields in Antegods. You can see a selection of generated levels below.
At the moment we’re still tweaking and experimenting with the algorithms to improve the distribution of energy and create more interesting pathways. The current version is working quite well and our next step is to integrate the procedural generation with the pre-match lobby, so players have a different result to choose before they start a game!
If you enjoyed this blog post, we hope you take the time to share it with your friends. To follow our development updates, please check us out on Tumblr, Twitter or Facebook. Or subscribe to our newsletter. Whatever is your taste in social media!
Antegods is crowdfunding at Fig.co at the moment! Don’t miss out on all the exclusive goodies we have for backers!
Antegods is supported by the Dutch Cultural Media Fund, Cultural Industries Fund NL and the MEDIA Programme of the European Union.
Submit a Comment