I have been rethinking my loot and enemy distribution approach. I really like the idea of distributing content proportionally throughout a level, but it’s too complicated (read: time-consuming) to do properly. Sure, the utility of increasing the dungeon by a room and having the loot automatically spread out “thinner” per room to accommodate it is great, but it’s also a massive hassle to code and debug. I think I need to make the hard decision to just cut this feature and just add content (loot and enemies) or a per room basis. Yes, this messes with the balancing, but it should also “balance” out in the long run. The dungeons are random, the content is random, etc.
I am basically simplifying “spread content through rooms” step in content generation between “this is content we will place” and “there are rooms where content will go”. Basically, content no longer say “we want 60 enemies in level”, but just says — put enemies in 60% of rooms.
Easy thing first: separate distribution of content as defined in the level’s total content:
This selects rooms compatible with the player content and distributes exactly one “content piece”. In this case, player goes to spawn. Very similar with multiple content pieces:
Slightly trickier is what was previously shared ratios across the rooms. I am still using the ratio logic so that I can distribute different content to different rooms:
But this will just select a bunch of rooms for that content and not bother trying to distribute any actual amount. (Oh man, even trying to explain this to myself is a mess.)
Now, since I am not longer deciding on how many enemies go into a room from some central value, I need to specify this in my enemy collections:
This means when I am adding this collection to the room, it knows to pick some small enemies and fill the rest with regular enemies. And something like a boss collection just says it wants a single boss mob:
And this works fine, I get the exact amount of mobs specified in the collection chosen for the room:
And something very similar happens to the items. They just specify how many of something they want:
This means I am also making my item collections similar to mob collections:
So then I specify which collection count as which content — like all trash loot collections are to be chosen when trash loot is needed:
The only real difference to enemies is that enemies go to spots 1:1, while loot can have multiple items per chest. This is pretty much how I define it (without anything more complex):
And this also works fine, selecting the right number of chests and items:
Okay, so this now simplifies my content selection significantly, and messes up balancing slightly. But I think I rather perform more “dumb” actions to adjust my level than few very complex actions that I will forget how to change in a week.
There is another small issue (that is now fixable) now that it is the level content that decides that all loot will go into a specific chest:
But I don’t necessarily want this. May be my “artefact” loot is actually one actual artefact and then 2 chest full of scrap. And I do want to make a separate scrap chest so the player can instantly tell what they are getting:
So I move the prop used by loot to the actual loot item:
And this works great, spawning scrap chests for closets:
At this point, I keep looking at my chests and every one has two assets for closed and open variants:
However, since my animator simplification, I might as well convert it into a single prop and add an additional state to it for having been opened. And this is much cleaner:
Well, this handles some of the more annoying/glaring issues with the loot distributions and makes things easier for me in the near future. I don’t think I can simplify it much further without hard-coding or sacrificing much more balancing and “just works” stuff.
Also, this makes it for two blog posts today for the first time. Since I work on different stuff in parallel, but it doesn’t quite fit the same posts, I end up slowly building up several posts at a time, especially as of late due to the kind of features I am doing lately.