demo3_squashed.mp4 #
Please excuse my mouse sounds in the demo 😅
PYWOLF3D is a Wolfenstein 3D engine, game clone written from scratch in pygame, Python.
I am a huge Doom and Wolfenstein fan so I just decided to rewrite one of the originals myself 😎. It was mostly for fun and learning.
All code present in this project was written by me, without AI code generation or coding agents. AI tools were used for discussion, research, and help locating existing game assets and resources. The implementation, including map parsing, rendering, actor behavior, and game logic is entirely my own work. But don't take my word for it: https://isvibecoded.com/.
To play the shareware version of episode 1, simply clone this repository:
git clone https://github.com/atifcodesalot/pyWolf3D
change the directory to the root of the project:
cd pyWolf3D
Then install the required packages;
For Windows:
py -m pip install -r requirements.txt
For Unix:
python3 -m pip install -r requirements.txt
Then run;
For Windows:
py -m wolfenstein3D
For Unix:
python3 -m wolfenstein3D
If want to play all of the episodes, you will need to drop the game files: GAMEMAPS.WL6, MAPHEAD.WL6, AUIDOT.WL6 and AUIDOHED.WL6 from your purchased installation into the ./wolfenstein3D/assets/maps folder, I also wrote a simple script to
detect it automatically if you have a steam installation of the game.
I tried to keep this clone as accurate as possible (compared to the original)
but some things are probably different. The damage model and actor behaviour are mostly similar, but your bullets pass through enemies in this version, for example.
The clone currently supports playing the original 6 episodes but it is incomplete as mentioned. It extracts the original maps from the shareware version files MAPHEAD.WL1 and MAPTEMP.WL6 and music from AUIDOT.WL6 and AUIDOHED.WL6 files. If you want to play the original episodes, as previously stated, you will need to drop the GAMEMAPS.WL6, MAPHEAD.WL6, AUIDOT.WL6 and AUIDOHED.WL6 from your
purchased installation, into the ./wolfenstein3D/assets/maps folder.
The game employs a raycaster just like the original for rendering, there is no actual rasterization. The default amount of rays cast are 160 and the default fov is 54 degrees. You can play around with it. It is simple and reusable.
The maps are 64 to 64 grids and the raycaster uses the DDA algorithm to find collisions with the non empty tiles. The special cases are doors and pushwalls, which the raycaster handles explicitly.
Sprites, projectiles are rendered via perspective projection.
The sound engine is responsible for attenuation and directional sound. Directional sound is achieved by panning the audio via hardcoded configurations. The sound propagation is done via the preprocessed area tiles. Some of the sound effects (and music), like treasure pickup, were actually synthesized during runtime in the original, this version uses .wav files for all sound effects.
Music are actually synthesized during runtime using an OPL emulator using AUIDOT and AUIDOHED files!
The justification is that I can't just redistribute the non-shareware music with this repo, which is under copyright law.
So you drop the files that you already got and the music files are created on the fly!
-
Code: All of the components, WL1, WL6 file parsing, rendering, sound and game logic were implemented by me, as mentioned; AI wasn't used in anyway for code generation.
-
Sprites, sounds: The sprites, sounds of the original were obtained from the internet, sometimes via LLM's (some sprites are relatively obscure [like fake hitler or mecha hitler sprites])
-
Pacman sprites from Ultimecia
-
game engine black book Wolf3D is an awesome book and I have read it extensively during the development of this clone. Chase state chains, sprite rendering, sound propagation and many other aspects, I understood from this book and enjoyed its every page, it truly is awesome.
-
https://www.spriters-resource.com/ms_dos/wolfenstein3d/ for the original sprites.
-
https://sounds.spriters-resource.com/ms_dos/wolfenstein3d for general sound effects.
-
https://forum.zdoom.org/viewtopic.php?t=46658 this forum post for adlib sound effects in .wav format.
-
Floor finish screen (working on it)
-
Projectiles, more episode sprites and texture support (working on it, almost done)
-
Episode 1 ending animation
-
Spear of Destiny
-
Multiplayer deathmatch
I have been working on this for some time now, so I decided to just put it out there before it was well... perfect. There are some non game-breaking (in my opinion :D) bugs that I am aware of and will fix it in the future. If you notice any, let me know though.