First-person shooter
PYTHON: Immerse yourself in a first-person shooter
Calvin Robinson looks to the iconic PC games Doom and Wolfenstein 3D for inspiration, in the latest instalment in his Python coding series.
OUR EXPERT
Calvin Robinson is a former assistant principal and computer science teacher with and a degree in computer games design and programming
T his issue we’re going to have a go at designing a first-person shooter. Wolfenstein 3D (1992) and Doom (1993) are arguably the most notable early successes of the three-dimensional firstperson shooter (FPS) genre. Both were released by id Software and designed by John Romero and John Carmack. These games featured the player seeing the game world through the eyes of a protagonist, roaming around levels looking for bad guys to eliminate. The graphics were, of course, pseudo-3D because true 3D graphics hardware hadn’t been invented yet. A lot of isomorphic project and trickery with sprites was used to create an illusion of three dimensions. We’re going to replicate that method.
To get started, we’ll need a few things: Python, Pygame, and pvp-raycast engine. To install Python, open a Terminal and type sudo apt-get install python3 , followed by sudo apt-get install pip3 . Then you can install Pygame with pip3 install pygame . Finally, grab a copy of pvp-raycast by Raul Vieira from github with git clone https://github.com/raulzitoe/pvp-raycast .
Pygame provides a lot of useful modules for drawing shapes and such, and Raul’s raycast engine includes all the fancy techniques for creating a multiplayer FPS game world, including textured raycasting with threaded sockets to handle data packets to/from multiple clients.