A pseudo-3D, grid-based maze game written in Python with PyGame using a DDA algorithm for raycasting.
PyMaze is the original version of the game, starting as a proof of concept for a game made with just Python and its standard library, plus PyGame. Due to being written in pure Python, the hardware requirements for PyMaze are somewhat high.
CSMaze is a nearly perfect recreation of PyMaze that, due to being programmed in C#, is much more performant than the original. It still uses an entirely original physics and rendering engine which should behave identically to PyMaze.
UnityMaze is a remake of the game in Unity. It adds some new features such as controller support and a Virtual Reality mode, however, due to being made with the Unity engine instead of having an originally programmed engine, it may differ in some regards to PyMaze and CSMaze.
All three versions are cross-compatible with multiplayer.
Python 3.8 or greater is required.
- Download the files by pressing the green "Code" button above, followed by "Download ZIP" — extracting all the files once the download is complete.
- Alternatively, if you have git installed, run
git clone https://github.com/TollyH/pymaze.git
in a terminal to download the repository.
- Alternatively, if you have git installed, run
- Install PyGame with the command
pip3 install pygame
on Linux orpip install pygame
on Windows. - Run
__main__.py
to start the game.
WASD
orUp
andDown
— Move aroundLeft
andRight
orMouse
— Turn cameraLeft Click
— Toggle mouse control (ESC
can also be used to leave, will fire gun if mouse control is enabled and you currently have one)[
and]
— Previous/Next Level RespectivelyW
— Escape from monster (rapid click)F
— Place/pick up flagQ
— Place temporary barricadeT
(with gun) — ShootR
(orESC
outside mouse control) — Pause menu (+Y
reset level)Shift
— Run while heldCTRL
— Crawl while heldSpace
— Toggle mapC
— Toggle monster compassE
— Toggle statistics (time, moves, key counts)
Requires the cheat map to be enabled in the configuration
Space
— Toggle cheat map displayCTRL
+Space
— Toggle displaying of field of view on map
- Simply collect all the golden keys before reaching the exit.
- In many levels, after a specific amount of time has passed, a monster may spawn. Getting hit by the monster will give you an opportunity to spam
W
to attempt to escape. There is only a certain amount of time you have per level for this, however, and running out will result in you dying and having to restart the level. - You can place flags on the ground to help you navigate, however if the monster comes into contact with one of these flags, it may destroy it.
- You have a compass which will point toward the monster's location, however you only have a limited amount of time to use it before you must wait for it to recharge.
- You can place a temporary barricade which will act like any other wall until it breaks. You may only have one built at a time, it cannot be broken early, and it will block you as well as the monster.
- Some levels contain single use key sensors, which will display the location of every key on the map for a limited amount of time.
- Levels may also contain guns. These can be fired once each and, if you hit the monster, it will be sent back to its spawn point.
PyMaze also has two multiplayer modes, operating with a simple client/server model.
In this mode, the monster and all pickups are removed, and instead you must simply shoot at other players to kill them. You start with a gun, and have infinite ammo. The stats screen is replaced with a leaderboard showing (K)ills, (D)eaths, and (S)core, which is the difference between a player's kills and deaths. Your remaining lives are shown in the very bottom left corner, with your total deaths just above, as you can respawn after death in this mode. Your kills are displayed in the bottom right corner.
Co-op mode plays almost identically to single-player PyMaze, however you, as multiple players, must work together to collect all the keys. Keys, key sensors, and guns are synced between players, so once one player has grabbed something, no other player will need or be able to. The monster has become impatient with so many people in his maze, and so spawns immediately once the level begins, and will kill you immediately if he catches you. With all the noise, he has become somewhat confused, however, and so will always move around randomly instead of chasing anybody.
Right-clicking on the play button on the title screen will prompt for a server address and port to connect to, and middle-clicking will start hosting a server from your machine. You can play with people on the same network as you by giving them your private IP address (usually in the form 192.168.xxx.xxx
- lookup online how to find this). If you want to play over a wider area, you will need to find your public IP address and setup port forwarding, tutorials for which can also be found online.
Disclaimer: The developers of PyMaze make no guarantee as to the security of the multiplayer server included in this repository. Forwarding a port being used by this server to the public internet is not recommended and is done entirely at your own risk. Under no circumstances will the developers of PyMaze accept any responsibility for any consequences that may arise as a result of running this software.
- Black — Walls
- White — Floor
- Green — End point (Cheat map only)
- Gold — Keys (Always with cheat map, otherwise only with key sensor)
- Dark green (dark red in designer) — Monster spawn
- Red — Start point
- Dark gold — Key sensors (Cheat map only)
- Grey — Guns (Cheat map only)
- Blue — Player tile
- Dark red — Monster (Cheat map only)
- Turquoise — Flags
- Purple — Player placed wall
- Purple — Decorations
-P="/path/to/maze_levels.json"
or--level-json-path="/path/to/maze_levels.json"
-C="/path/to/config.ini"
or--config-ini-path="/path/to/config.ini"
-S="host:port"
or--multiplayer-server="host:port"
-N="Your Name"
or--multiplayer-name="Your Name"
-P=/path/to/maze_levels.json
or--level-json-path=/path/to/maze_levels.json
-T=port
or--port=port
-L=level_index
or--level=level_index
-O
or--coop
Copyright © 2022 Ptolemy Hill, Finlay Griffiths, and Tomas Reynolds