A Strange Labyrinth is a small game where you need to navigate an unusual labyrinth. It is generated, so you can customize it, but I recommend starting with the standard labyrinth. Graphics: Pseudo 3D
On Linux, you will need Zenity (sudo apt install zenity
)
You will need cmake
, make
(since I rely on cmake, you can try other build systems, but I can't guarantee anything), and g++
(I don't use its features, so you can use another compiler, but I haven't tested it!)
Linux: Install dependencies from here:
sudo apt update && sudo apt install \
libxrandr-dev \
libxcursor-dev \
libxi-dev \
libudev-dev \
libflac-dev \
libvorbis-dev \
libgl1-mesa-dev \
libegl1-mesa-dev \
libdrm-dev \
libgbm-dev
cmake -Bbuild -G"Unix Makefiles" -DCMAKE_BUILD_MODE=Release -Dbuild_static=OFF
If you need to build the project with all dependencies included (statically), use -Dbuild_static=ON
. This may be necessary if, for example, you want to use the built project on another Windows machine.
cd build
make
mv (move) AStrangeLabirinth(.exe) ..
cd ..
All set! Now you can delete everything except AStrangeLabirinth(.exe)
(the executable file), images
(pictures, icon, and font), and data
(where all settings are stored, optional (it will be created automatically))
Disclaimer: I used Code Blocks, and I can only guarantee it works there, but there shouldn't be any issues with others.
- Linux: Install dependencies (see "Build it yourself." "Before You Start")
cmake -Dbuild_static=OFF -B{NAME} -G'{NAME_IDE}'
Instead ofNAME
, specify the folder where the IDE files will be located, for example CB, and instead ofNAME_IDE
, specify the name of the desired IDE (check incmake --help
)- In {NAME}, you will find the files for the IDE
I tried to make it convenient to control with both the mouse and keyboard:
cursor...
TAB
- next element
Enter
- press the button (sometimes switches to another element for convenience)
Arrow keys
- increase/decrease
Move left and right
- rotate
Right Click
and Left Click
- move
WASD
- movement
QE
- camera rotation
Shift
- speed up (must be held down)
ESC
- pause
- Save, edit, and load labyrinth generator settings
- Save and load the labyrinth itself (it will match exactly). This is not a save of the process; after loading, you will start from the beginning!
- Settings (graphics and mouse usage):
- number of pixels in a column before SFML scaling
- SFML scaling (was 1 pixel, now this)
- whether to use the mouse in the game
- maximum fps (if 0, there is no limit)
Attention: Before reading further, I recommend navigating the labyrinth yourself to understand its strangeness!!!
I wanted to break the rule left + right = right + left
, to create a labyrinth that cannot be represented on a map (classical). And I did it: the entire labyrinth is divided into rooms, and each exit from a room leads to a separate room (to better understand, I recommend settings 4-0-4-1).
video.mp4
As a result, rooms can "overlap," and to navigate, you need to think a little longer.
Each dead end can also be unusual (for "confusion" and to showcase its strangeness); the probability is relative and can be set in the generator settings.
There are 3 types of unusual dead ends:
- Infinite Corridor: An infinite corridor stretches left and right with many exits. In reality, it is the same corridor. Here is its diagram:
- Infinite Turn: Once you enter it, you will keep turning right indefinitely, and if you decide to return, you will end up much further away. This is simply a looping turn where one exit (portal) is connected to the entrance (the former dead end). The connection point depends on the direction of the dead end, but if the entrance to the dead end is to the left, here is the diagram:
- False Exit: You will see what seems to be a normal exit, but when you approach it, it will disappear. It's just a wall with a color that depends on the distance. In the "default" labyrinth, this is turned off so that a player better understands what an exit is.
Each room stores a list of pointers to neighbors; if it is nullptr
, there is no neighbor (*Tile[4]
). This is how all the unusualness is created!
Walls are generated based on the presence of neighbors and the fact that the current tile is not an end (it does not generate a portal).
There are 4 types of walls:
- Portals (0-3) - needed exclusively for teleporting rays.
- Regular walls (4) - you cannot pass through them... gray...
- Exit (5) - a wall with a different color (yes, the game ends when you enter a room with an exit, not at the exit itself).
- False Exit (6) - a regular wall, but it has the color of an exit, and when you get close, it turns into a regular one.
Player teleportation occurs when crossing boundaries (<0 or >4 on x or y); portal walls are only needed for teleporting rays (to see through them).
- From the starting point, rooms are generated (the number is adjustable).
- Depending on the depth (adjustable), we choose 50/50 how many exits there will be (3/2, 2/1, 1/0, 0). This is done recursively for each room. Dead ends are saved separately.
- We choose 1 dead end that will become an exit (the probabilities are equal), and then for each remaining dead end, we choose its unusualness (including regularity).
- number of exits from the starting room
,
, and
- depth during which the choice will be made 3/2, 2/1, 1/0.
Do not set large values for the above settings!
While it is possible to set them up to 255, it will require a lot of memory and time for calculation.
With settings of 4-10-10-10, a maximum of 725564587
rooms can be generated. That’s ~28 GiB
! And this is without accounting for memory costs for rendering.
The probability of each type = set number
/ sum of all numbers
.
- The exit color was chosen unintentionally, but I left it that way.
- The engine allows for any walls with integer coordinates for the ends in rooms, but to maintain the feeling of corridors
- If you somehow get outside the walls, you can bypass the labyrinth from the side, but the rendering will be broken. By the way, let me know how you did it; that's a bug!