Game Development Reference
In-Depth Information
comes from the algorithms that work out what the player can currently see. If the
program knows what the player can see, then it doesn't need to render any ob-
jects that are hidden. This can produce massive speed improvements. These al-
gorithms are usually a type of space partitioning, but you only need to learn
about them if you've already got to the stage where you can write a basic FPS.
Here is a list of steps to start you on your way to FPS game creation.
Create a simple 3D scene with a camera class (use Glu.gluLookAt) that
can change its position.
Draw a large quad under the camera so that it appears like a floor. Option-
ally, texture this quad.
Make it so the arrows keys move the position and look-at position of the
camera.
If you successfully follow these steps, you will have something that feels like an
FPS game, but you can't move the camera around with the mouse, and there is
no real level. To develop the game further than this requires quite a lot more
mathematics; here are some of the major formulas to research.
Ray-Triangle, Ray-Plane, Ray-Sphere, and Ray-Quad collision checks need to be
researched and implemented. Each of these checks should return one or more
positions where the intersection occurred. (A Ray is a position and a direction.
It's useful for representing lasers and determining if the character's feet are cur-
rently touching the floor.)
Line-segment-Triangle, Line-segment-Plane, Line-segment-Sphere, and Line-
segment-Quad intersection checks can be created from the Ray checks. Line
segments are used to check if the player or player's bullet has passed through a
wall or enemy. A line segment is made by drawing a line from the player's posi-
tion in the last frame to the player's position in the current frame. If the line
segment crosses a wall, that means the player is trying to walk through the wall.
Walking through walls is a bad thing, so the player's position needs to be pushed
back along the line segment until the player is no longer passing through the wall.
For the camera movement, you may wish to research polar coordinates because
they are usually used to translate the movement of the mouse to the movement
of the camera in the game world. You may also wish to investigate BSP (Binary
Space Partitioning) trees as these render the 3D levels more efficiently. The best
 
Search WWH ::




Custom Search