The first levels are simple, easy to master. You can go through the later levels either in a hardcore way, just thanks to your orientation and intuition skills, or with the use of various aids. While searching for a way out of the maze, you can find enough coins, which you can exchange in the shop for these assistants:
1. Jump - for 1 coin - a small jump, which allows you to peek behind the wall for a moment.
2. Flare - for 2 coins - a large ball will fly out of the end of the maze, showing you which direction and how far the exit is.
3. Fly-Â for 2 coins - the camera rises above the maze and you can look at the entire maze from above. The higher the level, the higher you can look.
4. Mark-Â for 3 coins - marks with columns all the coins that can be found in the maze and they are then visible above the walls.
5. Teleport - for 3 coins - this can sometimes be very useful. If you get lost for a long time and can't find your way, you can instantly move to a random place in the maze. With a little luck, it can be very close to the goal.
6. Point -Â for 3 coins - it marks the exit from the maze with a tall ribbon. It's also a beacon that you can look up to when overcoming difficult corners of the maze.
7. Map -Â for 5 coins - a great thing. From above, you will see everything like in the palm of your hand. You can view the map in full screen or have it in a small window while walking. You can zoom in and out with the mouse wheel.
8. Navigation -Â for 10 coins - a brilliant thing. It's a modern Ariadne's thread, which, according to legend, the Cretan princess Ariadne gave to the hero Theseus so that he could find his way out of the Minotaur's labyrinth with its help. After activation, hemispherical marks appear on the floor that will lead you to the end of the maze.
After reaching the goal the helper tools are reset, in the next level you can exchange them for coins exactly as needed in the given level. Of course, unused coins will remain for you to the next levels and will remain after restarting the game. The game saves the progress after reaching the goal. The next game continues from the level reached.
The mazes are always original, different for each player. The sun is already shining above the Labyrinths, so everything is fine, there is nothing to wait for.
*****
For anyone interested, I'm attaching a description of how these mazes are generated for you.
Introduction
Procedural maze generation is a wellâstudied problem in computer science, particularly within the domains of graph algorithms and computational geometry. The script constructs a discrete labyrinth by applying an iterative depthâfirst search (DFS) over a regular grid. The resulting structure is a perfect maze, meaning it contains no cycles and provides exactly one simple path between any two cells. This document analyzes the systemâs architecture, algorithmic behavior, and theoretical properties.
Grid Topology
The maze is defined as a square grid whose size increases linearly with the level number. The grid dimension is computed as N = 3 + 2(L â 1), ensuring that N is always odd. This guarantees the existence of a unique central cell, which serves as the root of the DFS traversal. Each cell contains four boolean values representing the presence of walls on the top, right, bottom, and left sides. Conceptually, the grid corresponds to a fourâconnected planar graph.
Cell Representation
Each cell in the grid is modeled as a node in a graph with up to four potential edges. Initially, all edges are closed, meaning the graph contains no open passages. The cell structure therefore functions as a local adjacency matrix. The removal of walls during maze generation corresponds to the creation of edges in the graph, ultimately forming a spanning tree.
Maze Generation Algorithm
The system employs an iterative depthâfirst search to generate the maze. DFS is a classical algorithm for constructing perfect mazes. The algorithm uses an explicit stack to simulate recursion. At each step, the algorithm marks the current cell as visited, randomly permutes the four possible movement directions, and selects an unvisited neighbor if one exists. When a neighbor is selected, the wall between the current cell and the neighbor is removed, and the neighbor is pushed onto the stack. If no unvisited neighbors remain, the algorithm backtracks by popping the stack. The random permutation of directions ensures that the resulting spanning tree is stochastic, though DFS tends to produce long corridors due to its depthâoriented nature.
Exit Cell Selection
The exit cell is chosen from the set of boundary cells, excluding corners. This restriction simplifies the determination of which wall should be replaced by a door. The selection process is stochastic but constrained to avoid selecting the start cell. A deterministic mapping identifies the correct boundary wall to remove based on the exit cellâs position.
Spatial Embedding
Although the maze is conceptually a graph, it is embedded into Euclidean space using a uniform coordinate transformation. Each cell is mapped to a position determined by its grid coordinates and a constant cell size. This produces a regular, centered spatial layout. Floor tiles and walls are instantiated at these positions. Their colors are generated using randomized HSV values within pastel ranges, providing visual variation while maintaining aesthetic coherence.
Coin Distribution
Coins are placed by sampling distinct cells uniformly at random, excluding the start cell. The number of coins increases linearly with the level. This sampling process is equivalent to drawing k unique elements from a finite set, ensuring uniform distribution without spatial bias.
Level Progression
Upon maze completion, the system performs several actions: it plays a completion sound, resets bonus systems, removes pathâvisualization objects, increments the level, saves the new level index, and generates a new maze. This creates a Markovian progression in which each state depends solely on the current level number. The maze itself is not stored; it is regenerated from scratch for each level.
Computational Complexity
The DFS algorithm visits each cell exactly once. Therefore, the time complexity is O(N²), where N² is the number of cells in the grid. The space complexity is also O(N²) due to the storage of the maze array. The DFS stack may grow to O(N²) in worstâcase scenarios, such as long corridors.
GraphâTheoretic Properties
The generated maze possesses several important properties:
It is connected. It is acyclic. It is planar.
It is a spanning tree of the underlying grid graph.
These properties guarantee a unique solution path between any two points in the maze.
Conclusion
The Maze Generator system represents a practical implementation of classical graph algorithms within a gameâengine context. It combines deterministic grid topology, stochastic DFS traversal, procedural geometry construction, and persistent level progression. The result is an infinite sequence of structurally valid, mathematically sound labyrinths. The system demonstrates how theoretical constructs from computer science can be effectively applied to realâtime procedural content generation.