Time to get back to filling out rooms with stuff. There are still some fundamental things I need to do before I can start adding any kind of real data.

An approach I am already using is to group definitions of rooms and tiles so I can link a single collection asset and it will contain a longer list of individual items. Same with enemies now:

The reason I need this is because first of all I am making an editor for “spots” that appear in rooms. For instance, a spot designated for mob spawning could reference a single mob collection and choose a specific mob randomly:

So if I add a couple more mobs to the game, they can then spawn in-game now:

However, this is not a very flexible approach and more of a proof of concept than anything I can use when designing rooms. The same amount of mobs will always spawn in the same spots. What I want instead is to “paint” certain areas of a room and then specify that area as containing “something”, like certain mobs or items. In short, I want to say “spawn some stuff here”. For that, I will allow each tile to be part of a colored area (technically, numbered, but I am using colors so it’s easier for me to see and I won’t actually edit the raw number anywhere). Here’s an editor for that:

Now I can “paint in my editor”, that is, set tiles to belong to a certain area:

Then I need to make an editor for the currently selected area:

And a few adjustment to the dungeon room placement, and I have stuff spawning in the right areas:

…sort of. It still spawns items for tile individually. I didn’t yet specify how many things I want. So we can do that:

Now I have to tweak the generation to actually gather all the area tiles and then choose the right number of them randomly and spawn stuff there in a separate step:

I have used this approach before, so I implemented all of this fairly quickly and I might be glossing over a lot of details. But it works nicely for what I need and it’s fairly extendable.

And now I can also finally remove my hard-coded “spawn player in the middle of zone” and have an actual area for this:

This, however, is still not quite as modular as I want it to be. That is, I need to change individual numbers of each and every room to balance things. Say, my total number of mobs in a dungeon is 100, but I want to make it 120. Do I go through each room and change the numbers? Numbers are bad in design. You don’t want hard values, you want relative designations. In this case, I have a table like this:

And in the rooms, I now specify:

So “some” amount here translates into 2-4 mobs. All the rooms with “some” will get 2-4 mobs and I can change it in one central place.

Let’s go the same route with enemy definitions as well:

In other words, when I specify “weak” mobs I might not care if it’s skeletons or slimes, but I definitely don’t want dragons or liches. I am using “strength” here as a selector, but technically it can anything. I can have a room for invisible mobs or a room for flying mobs — whatever groups I want to make. I just don’t (necessarily) want to be overly specific, like “skeletons”. In fact, I want to avoid making any more than several of these groups.

Final tweak is that I may want to specify a certain level as “spider caves” or “undead crypt”, so I want to specify actual enemies based on the level/theme, not just strength. So I can add this to my level theme:

I do need new individual assets for each theme, and they will need to point to themed collections as well:

So here’s how it all works out in simple terms: a cave level spawns a room with an area that wants a few strong mobs, which means picking the strong cave mob collection from its enemy selection, which are something like spiders, slimes, skeletons, and spawning a few of them, which is 2-4.

This all sounds unnecessarily-over-complicated, and damn straight it is. Over-engineering is my hobby. And, yes, I love making assets. But here is a neat scenario where a large-scale change happens with relatively very few alterations. I can introduce a new mob (say, rock golem) and place it in relevant collections (say, caves and ruins with strong mobs). And it’s done — the generator will now create rock golems in caves and ruins in rooms that want strong mobs. Imagine going to each room and trying to fiddle with exact mobs it needs to spawn. Or, worse yet, having it stored somewhere in code. Worse yet, making a mistake.

In conclusion, I have a framework/approach to modularly fill out the dungeon with stuff.

Related Posts

MicroRogue DevDiary #10 – Room Contents
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *