It was 1994, I was studying my second year engineering in Sri Venkateswara College of Engineering, Sriperumpudur. Doom (1993), the first person shooter video game for PC had got released recently and took the world by storm – many of my friends got hooked on to the game. Playing the game, myself and my friend P.S.Ranganathan, got curious about how it worked, especially on how is the graphics engine powering it works?
Doing some studies through available resources and books – there was no public Internet access in India then, only BBS (Bulletin Board Services) – we learned quite a bit which we set out to write as a whitepaper that we presented in some Inter-College event. The full whitepaper titled “The First Person Perspective and ways of achieving it” that we wrote is here, and below are some of the salient points from that document:
It all started with Wolfenstein and Doom (the coke of computing)
- Serious psychological and social research on the effects of Doom is going on
- Prince of Persia is flat and 2D, Wolf is 3D
- Unlike Prince of Persia, in Wolf, your eye is the camera
The program creates a virtual world for the user
The first person perspective (FPP) aims to provide the user with a view on the screen that closely approximates the scene that would be seen by the user if he/she were standing in the viewpoint that he/she the program assumes him/her to be. That is the program tries to create a virtual world for the user. Wolfenstein 3D and Doom are excellent examples of the first-person perspective.
Gone are the days when you were content to type your requests (not commands) to the computer and the computer took its own sweet time to respond. Now you want the info Now! With the changed user perspective, it is natural that interactivity and a real-time response is expected of games. For example, the same game Tetris is available under both Windows 95 and Unix character-based terminals. Which one would you prefer?
Applications of FPP: It is unimaginable to think of the game DOOM implemented in any other way. It would just lose its punch. In Disclosure by Michael Crichton, we see an example of a first-person perspective in the scene where the database is searched by the person. This idea has been implemented in a software product – the results of a search are presented in 3D with closest matches in front. We see that FPP can be used creatively in other fields apart from games. Virtual reality is fpp in the extreme, where even the sensory input is processed and total immersion is aimed at.
Techniques need for FPP: Ray Tracing, Texture Mapping (Non-Perspective Corrected and Perspective Corrected) and Cylindrical Projection
How to do it: Generally, the scene to be rendered can be broken down into polygons. If it has curves, then they are approximated by polygons. The problem is now to decide which polygons are visible given the scene, viewpoint and direction of view.
Wolfenstein – the constraints on the world: It had orthogonal walls, Walls of the same thickness and Only one height level in the game.
Doom – Major differences from Wolfenstein: Non Orthogonal walls, Multiple levels (stairs, etc). The catch is that only horizontal and vertical planes are used.
How Doom *may* be working – the clue is to study the 4MB wad file, we see stacks of 2D matrixes. Hypothesis on how Doom may be working: Basically uses ray casting. Consists not of squares but of units with a width of 1. This will allow us to approximate diagonal lines quite well. Also has data saying for each unit how high it is. If it does not go up to ceiling, points to one above it. And so on.
An optimization that is possible is that for tracing the elevated ray, a variation of Bresemham’s algorithm in 3D can be used.
Windows 95 Direct Draw. The Windows 95 Game SDK enables the creation of world-class computer games. DirectDraw is a component of the SDK that allows direct manipulation of video display memory and the hardware.
Finally, Tomorrow’s video techniques that we see (in 1993): Overlays, will be supported so that page flipping will also be enabled within a window in graphics device interface (GDI).