Devlog #61: Level generation mechanism


Initially I thought about creating a blog post summarizing all the progress on the game I made in 2019. However, I decided not to. There will be time to create summary posts when the 2nd tech demo comes out. Right now, let's focus on the latest changes - and these are related with level generation.

The first tech demo of Shardpunk (the one that I released back in 2019 - go play it if you haven't already) had one static map. By "static", I mean that all the walls and obstacles - so basically the stuff that you use for cover during combat - were always in the same place.

Some of the visuals (things like wall decorations or floor debris) were placed randomly to give kind-of-unique feeling, but the general layout of the rooms stayed the same.

Two shots of the same location, with different decorations. The lighting is generated randomly as well.

What is more, the loot points (so the tiles that the player should visit to search for supplies) were also semi-randomly placed. The level had a predefined set of tiles that can hold loot and the game was randomly picking part of them to become "real" loot points in the game.

Also, a loot point can have a different visual representation. It can be a body, a bag, a locker or anything else I come up with later on. The possible visuals vary depending on the location of the loot point. Loot points that are located directly below a wall can choose from a broader range of graphics (as they can have a regular body, or a body leaning against the wall).

Loot points can be different in each run.

Another way of making sure that the static tech demo level felt a little bit different each time was the introduction of multiple entry points. The player could start the mission in a different location of the same level, which introduced some changeability.

Long story short: even though the level used in the first tech demo had some degree of randomness, it always had the same layout. I knew that I need to change this; I myself was starting to get bored with playtesting the same location over and over again.

I decided to use a semi-randomized approach. The mission map is now being created from nine smaller fragments, that are picked randomly from a pool of predefined ones that I've created in my editor.

In the end, the map has nine of these fragments combined together. Each fragment is 20x20 tiles wide, which means that the mission map has 60x60 tiles (the tech demo map was 40x80 tiles).

The biggest challenge here was making sure that each map fragment can fit any other one, with no visible connection issues. That was especially important for road tiles - I needed to make sure that a road that starts on one tile gets continued on another one.

I tried several approaches to handle this problem; in the end, I decided to use a pretty straightforward approach - on each map fragment, the road is always placed in the same edges.

FragmentA FragmentD

FragmentB

These screenshots are taken from the map designer tool. Each of these example fragments has a road present in the same place at the top.

Such an approach means that the current map fragments will only allow me to generate a map with horizontal roads. It won't be a big problem - later on, in the post-second-tech-demo phase, I will be able to create separate sets of map fragments for, for instance, vertical roads. Not to mention stuff like more dungeon-like, tight sewers levels. But that's something for another time.

Anyways, this map generation mechanism allowed me to introduce a lot of more randomness and tactical challenge to the game; also, it works pretty well with the dynamic evac point feature that I described in one of my previous blog posts.


Corners of four different map fragments are present on this gif. The player can't really see the connection.

Now, there are other challenges I will need to face in the map generation feature. One of them is making sure that the loot points are distributed in a way that makes the game fun. I believe they should not appear too often, to force the player to be more mobile; or maybe they should be placed all around the map, but their drop rates should be pretty small? It is all hard to say without the tactical layer being finished yet.

What's next?

I will be focusing on the tactical layer now. That being said, I am going on a winter holiday next week (time for some skiing!) so I won't be spending any time working on the game. I will surely come up with some new gameplay ideas during that time though ;)

Take care, and have a great year you all!

Leave a comment

Log in with itch.io to leave a comment.