I need to have some variety in my levels in terms of visuals and the most obvious candidates are the tiles — having different rooms with different themed tilesets. For example, to have halls be different from arenas and such. Firstly, let me get some debug visuals going so I can see what my generated areas are doing:
Areas are pretty much the same rooms as where start and goal is, the four-room arenas and two-room cubbies are, as well as neighbouring halls (large, small, hubs) combined into one (as was used for hall connectivity scoring penalties).
Now, I will convert my per-designation room collections into just one big collection so that it can have all the rooms it needs:
The reason is that I will not be telling individual rooms what tiles to use anymore, rather this will be decided by the level theme. Similarly, I will group all level’s tiles into the same asset:
So the level theme can just point to those two assets that decide on all the room layouts and tile definition. They are the structural and the visual elements.
This way, the dungeon generator can theoretically assign styles per area and I can select themed tiles for all the rooms. And I can now expand my tile collection into a fully theme-qualified collection:
I don’t really know what to call these new tile themes and I can’t really call it “themes”, because my level has a theme (i.e. factory). So I’ll call it “style” — tile styles, room styles, area styles. The generator will assign styles to whatever places it needs and then tiles of appropriate style will get chosen.
So let’s make halls have a “hall” style. In other words, I want the tiles in halls to be hall-specific tiles. I will need another dungeon generation pass for this — to assign a style to each node/room based on the area its in, its designation and whatever other conditions I come up with. And I also need debug for this so I don’t rely on resulting tiles (blue – tunnels, cyan – everything else, i.e. default):
Now I can implement actual styled tiles. Firstly, I can define a new styled tile group with tiles I need:
And add some extra (debug) sprites:
And it works out nicely after having the dungeon tile placement choose the right tiles from the style (halls are darker than arenas):
One issue though is the overlapping rooms — what style should take precedence (the door corner walls on the right are part of halls even when visually they should be an arena, while doors got replaced by arena ones):
Technically, these doors, walls and replaceable/removable parts have two styles attached to them. (Unless they are in the very corner, in which case it is up to four styles, but I will ignore this corner case as super-unlikely and not really important enough.) What I need to do is check style precedence for rooms and place room with higher precedence first, so other rooms that could overlap them later don’t add their tiles anymore (instead of current ordered map iteration). And that works fine, making halls feel like they “connect” to rooms but are not visually part of them:
Anyhow, now I have the framework for styles. The actual painting though is rather proof of concept and hard-coded, which I dislike. As will all the other dungeon generation parts, I can’t modify things on the fly and changes are cumbersome. So time for a new asset:
I want to “paint” everything the same style by default, so my rules can be exceptions, so to speak:
And then I can re-add my painting logic via individual entries with qualified names/options:
This is the simplest example, of course. I can add additional options and properties to this. For example, let’s have boss arena with themed tiles:
And that translated into game nicely (boss arena is the red spheres and lighter tiles):
This way the player can know they are approaching a boss room without even entering it, if it has a custom door style. The above screenshot has the same precedence issue as before, so let me just externalize that list to avoid future weirdness:
So now I can have the dungeon generator’s theme painter choose whatever themes I have configured node-by-node. I won’t add too much variation for now, because it’s all very art-dependent and also somewhat design-dependent. I could go crazy and have each room with it’s own unique tiles, but that just means equally many art assets. So I’ll expand on this later when I get to the whole level planning — how many, what themes, what styles, what sort of sections and whatnot.