Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

It was really fun to play!

Is everything actually random?  like the level generation and the swapping? And if so, how on earth did you manage to balance it? I can imagine that must have taken a lot of time...

(+1)

Glad you enjoyed playing!

And yes, everything is random. Though you're right, it did take some time to find good rules to balance it :)
Here's what I landed on:

Level Generation: Player, enemy, and door positions are fixed. I procedurally generate the maze using random DFS/Backtracking algorithm. Keys are then placed randomly.
Tile Swapping: First, two random unoccupied ground and wall tiles are selected. The randomness is weighted to encourage swaps closer to the player (but not too much). Then I check that, after the swap, there is still a path from the player to the exit and from the player to each remaining key. If true, those tiles swap. If not, I try again with two new random tiles.
This process repeats a max of 50 times. If there are still no good swaps, then I will swap the tile directly under the player. This avoids the player getting completely trapped. Enemies can still get trapped... but I'm calling that a feature :)

(+1)

Oh wow.
Thanks a lot for the detailed explanation!