radium-io / sanity

procedurally generated roguelike game written with rust and amethyst
https://wastrel.itch.io/moonsanity
19 stars 0 forks source link

sketch out room generation algorithm #2

Open ezpuzz opened 3 years ago

ezpuzz commented 3 years ago

so we want to generate dungeons of increasing sizes as we descend

each floor has some number of exits (depending on possible story hooks available/unlocked/by chance) and enemies should be weighted towards those on lower floor through that exit. e.g. more alien creatures en route to scifi exit.

so we need to create a tree with leaf nodes that are exits/lore/save with roughly the same distance from the root (which would be entrance). I think we don't need to have multiple entrances in to a generated floor, one should be fine. player will be unaware what they are on path towards other than changing monster composition.

nodes should carry weight associated with difficulty/size and then we can balance the branches depending on leaf. so save/lore rooms should likely have lower total weight than exit rooms. this should give a reasonable map.

so each Room node on the Level tree should have a weight calculated by difficulty and size. we can generate a bunch of freestanding Room instances and then do some sort of packing algorithm (but don't always want the biggest one at the start, so we can pack in largest first but then shuffle the order of the branch).

question: should relevant lore only be on path to that exit? (e.g. no horror lore on path to scifi exit?)

also earlier levels will have fewer total rooms.

spatial overlap is not important (doorways don't have to make spatial sense, rooms can overlap logically) -- maybe a powerup will make all rooms euclidean...

ezpuzz commented 3 years ago

thought of a mechanic where when areas are at least some pythagorean distance away they can be re-collapsed in to new areas (could mean losing room or whole new area opens up). this might only be fun for like a single level of game or at high insanity as it could be annoying to players.

ezpuzz commented 3 years ago

I think enemies should spawn some minimum amount based on size of map. So if max dijkstra value is X would spawn some Y of enemies on far enough away tiles. Not sure of best distribution but likely more further from player to give chance to explore without too many battles.

Most monsters would only come after player if they are in vision radius.