Attention ! Verglas
About
An ice puzzle generator inspired by the Ice Path (and other similar locations) from the Pokémon Gold and Silver games.
The goal is to move the small slime from its starting point to the hole to fall down to the next level. However, once you start moving in a direction you cannot stop until hitting a wall or landing on a snow patch.
ControlsArrow keys, swiping a direction (on mobile) - move the slime around
Clicking the snow patch button (on the left) - reset the level
Clicking the hole button (on the right) - solves the level automatically
Here is the procedure used to generate levels:
- On an empty 12 by 12 grid, rocks are placed at random until at most 40% of all tiles are covered
- A starting point is chosen at random
- All tiles reachable from this starting point are listed, and the furthest one gets changed into a snow patch
- This step is repeated until the path to the furthest tile no longer increases in size
- The furthest tile from the starting point gets changed into a hole, to mark it as the goal of the level
- The whole map is then scanned tile by tile 5 times, applying a cleanup and a clutter procedure at each step
- The cleanup procedure changes a rock or a snow patch to an ice tile if doing so does not decrease the length of the shortest solution; useless tiles are left in with a 40% random chance for aesthetic purposes and to confuse the player
- The clutter procedure changes a tile into a rock if doing so increases the length of the shortest solution
- If the shortest solution takes lower than 7 moves, the whole generation process is restarted from the first step up to 5 times, at which point the algorithm gives up
- Most if not all of the values mentioned in the generation procedure could be altered to try and influence the length of the solution
- While the generation succeeds most of the time, it is not guaranteed to do so (and I did manage to make it fail at least one)
- There is currently no safeguard against locking the player in an unwinnable state
- Focusing on the longest path tends to produce levels "on a railroad", where the next step feels fairly obvious if not forced entirely.
- Intentionally not targeting the "longest-shortest solution" as the level goal could help with mitigating this issue
- Having multiple "hidden goals" as additional constraints during the generation might help to keep the level more "explorable"
- Adding multiple starting and end points could be done to help integrate the generated level into a bigger cave or dungeon for a fully-featured game