Making a Better Map


Alright, time to get to work!

In my previous devlog, I looked at how the v0.1 launch of the game went, and outlined some of the main problems I had noticed in it. Today, I’m going to take a look at the map generation in the game: what rooms you can find, where you can find them, and how often.

In roguelike games, it’s quite common to have a map with several branching paths, and the player must choose which path to follow. Here are some examples…

Now, you might think that Golemancer is different from all these games. After all, there’s no “map screen” or anything of the sort. But secretly, Golemancer has a behind-the-scenes map that looks very much like the examples above. Here’s an example of what a map really looks like:

This is what the map looks like in my secret developer view. The blue outline at the top means “you are here”.

Unlike the games I mentioned as examples, in Golemancer, you’re only shown the rooms right in front of you. I sort of like this, as it adds a sense of mystery, and it doesn't overwhelm the player with choices. That said, it has its drawbacks too - you can’t plan ahead for what rooms you want to see, and there’s no meaningful choice to make between identical rooms.

I have an idea for a future mechanic that might help with these problems. For now, though, I’m more concerned with how the rooms themselves are laid out. Here’s an overview of how the map is currently put together:

  1.  Generate an 8x16 grid of empty rooms.
  2. Draw 20 paths through the map. Each path starts at a random room on the top level, and continues by connecting to the room below it - either left, right, or straight down. This repeats until the path reaches the bottom. Paths may cross over each other, but redundant paths (i.e. ones that connect the same two rooms) are skipped.
  3. For every square on the grid, decide what should go in that room, according to the following rules:
    1. If the room has no paths connecting to it, it is ignored and left empty.
    2. Otherwise, set the room to a battle for now. We may change it to something else later.
    3. Based on its floor number (its vertical position on the map), it has a certain chance of being a recruit room, where you can gain a new golem. These chances are 100% on the first floor*, 80% on the fifth floor, 40% on the eighth floor, 10% on the tenth floor, and 0% otherwise.
    4. If the room is the fourth floor or higher, and it’s still a battle, it has a 20% chance to be changed to a scroll room.
    5. If the room is the fourth floor or higher, and it’s still a battle, it has a 20% chance to be changed to a buff room, which is then a coin toss between health buff or attack buff.
  4. Finally, add the boss room at the bottom, as a special extra room. All rooms on the bottom are connected to the boss.

* On your very first run, you automatically recruit Bolt at the start, and the first room is a battle instead.

Phew! Considering that I just threw this code together haphazardly, that’s a pretty complicated algorithm. You might be wondering why the golem recruit rooms have such specific rules. That’s because, at the start of a battle, there’s no room to place more than five golems on the board. Rather than add a proper 5-golem cap, I just designed the map so you never get the opportunity to recruit a sixth golem. Problem solved! (For now.)

The other buff rooms, though, are just slapped in at random. This is not a great system. You might - by random chance - get half a dozen buff rooms in a row, or you might get practically nothing but battles all the way to the boss. Battles currently don’t give you any benefit (plus, they get repetitive after a while) so getting too many is frustrating, and getting too few feels too easy.

Instead of this, I’d like a system that balances itself out - where after you’ve had a few battles, the game is more likely to throw you a bone by giving you a buff room. If you’ve had too many buff rooms, the game will put your new-and-improved team to the test with a battle. So, enough talk - time to try programming something in!

---------------------------

New system is done! Now, each room - before we decide what goes in it - has a score. Higher scores mean something better will go in there. When you get a buff room, the score for the rooms ahead goes down, and when you get a battle, it goes up.

Here’s the data that’s used to balance them out:

[battle] -99 15 3
[scroll] 4 99 -5
[golem] 5 99 -6
[health_buff] 0 99 -2
[attack_buff] 0 99 -2

You’re probably confused by all these seemingly random numbers. In each line, the first two are the minimum and maximum score threshold. The room can only appear if the score is in this range - so for example, a recruit golem room can only appear if the room’s score is between 5 and 99. (I don’t expect the score to ever go above 99, so that basically means “infinity”.)

The third number is the score boost - or, if it’s negative, the score penalty. When a room is chosen, it increases or decreases the score of all the rooms it connects to. So, when a golem room appears, the rooms after it each get -6 to their score.

The first floor is still guaranteed to be a golem, and the second floor is always a battle, but other than that it’s all up to scoring. Let’s see what our map looks like now!

This looks okay at a glance, but bear in mind that you don’t get to see all of this in-game. Since the player can’t see ahead of them, the odds that they run into a scroll or golem room are much slimmer than before. I think I ought to raise the chances for those rooms somewhat:

[battle] -99 15 3
[scroll] 0 99 -5
[golem] 2 99 -6
[health_buff] -2 99 -2
[attack_buff] -2 99 -2

After playing it myself, I think this works pretty well! Recruiting new golems is rarer than before, but seeing as this is the game’s first area, I think it’s good that the player probably won’t be leaving it with a full team.

Speaking of full teams, though, there is a new problem this creates. Eagle-eyed readers may have noticed that if you take a very specific path on the map above, it’s possible to visit a total of five recruit rooms. Taking into account the Clayper you start with, that’s one too many golems. This means that I’ll have to quit procrastinating and add a proper cap on team size.

That wasn’t so bad, actually… though it involved even more hard-coded UI logic, which isn’t great. I still need to rework that system, along with some other stuff, but this will do for now.

So, with that, the path generation is feeling a lot better! I’ve still got a lot left to improve, but I think this is a solid start. Please note: these changes will only be available in the upcoming v0.2 update, so you won’t find anything different if you play the game now.

Thank you to everyone who’s played the game so far, and thanks for reading this post!

Get Golemancer

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.