Log In  


I saw a neat algorithm for generating mazes on YouTube called "Origin Shift" and tried it out in PICO-8. Works pretty good!

This first cartridge generates a maze and puts a player inside it. You can move around. Pressing X will generate a new maze. The algorithm guarantees that any cell in the maze is reachable from all the other cells. So you can regenerate the maze around the player without worrying that they'll be trapped.

Maybe this becomes a game; maybe not.

Cart #origin_shift_maze-0 | 2024-10-17 | Code ▽ | Embed ▽ | No License
1

This second cartridge was for debugging. The idea with Origin Shift is that the maze is a directed tree graph with a root, or origin. You start with a very simple "maze" and then iterate a bunch of times, moving the origin around, swapping pointers to ensure the whole thing stays a directed tree graph. But my code wasn't working, so I needed to visualize what was happening better...

The cartridge starts with the simple starting "maze" with the origin marked with a red dot. Pressing X will step through the iterations. Pressing Z will fast forward though the iterations, 30 per second. It takes about 2,500 iterations to really scramble up the maze, so you'll be holding down the Z key for over a minute.

It did help me fix my code, so time well spent.

Cart #origin_shift_maze_i-0 | 2024-10-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

Finally, here's the YouTube video describing the algorithm:
https://www.youtube.com/watch?v=zbXKcDVV4G0

1


1

I could see that as a 2 player game : instead of a 16 x 16 maze, have a 32 x 32.
Each player starts in a corner, and the red dot keeps modifying the maze as the players move in the maze.
You win a point by reaching the red dot or a static target in the maze.
Reaching the target makes it respawn somewhere else, reaching the dot resets the maze and the players. there could also be a follow left wall and a follow right wall enemies that can push the players starting in the two other corners.
For the game view, you'd either get a camera centered over the two players if they are near enough, or a split screen with a diagonal line goins through the center of the screen, so each player has half of the screen and you know the direction of the other player in the maze.


Interesting ideas. Not sure how I would divide the screen diagonally given that the screen is a bunch of tiles. Horizontally or vertically would be easy.

I kinda of thinking a Wizard of Wor sort of game. Enemies trying to track you down, with the maze rescrambling on a timed basis, or maybe, as you noted, by reaching an object.



[Please log in to post a comment]