Humans have a 3D vision, meaning we can determine the width height and depth of things through the use of binocular vision. Our eyes individually see two different views of the world which our brain uses to figure out the depth. A 3D game is an invention of modern science.
Consequently, 3D games have representations of game elements, the positions, and shapes of which are constructed from points in a 3D coordinate system. A perspective projection converts a view of the 3D space into a 2D image many times a second which is played on a scene.
A 3D scene rendered on a single screen feels flat, but rendering two slightly different perspectives and projecting them to individual eyes allows the proper perception of depth.
Combining this stereoscopic view with a head tracking controlled point of view creates the immersive effect of virtual reality.
Conceptually, they are very similar. All the 3D math can easily be reduced to 2D simply by ignoring the z-axis. If you have a 3D engine, you can easily make a 2D game with it.
That said, there are a lot of different paradigms that work in 2D that don’t quite translate into 3D. This leads to a lot of differences in how things are done in practice.
Components Of A 3D Game
The most obvious difference is sprites. Sprites have their uses in 3D games, but rarely are the characters created with sprites in 3D. In 3D we typically use 3D models with joint animations. 2D games sometimes use joint animations for their sprites, but they often use flip-book animations.
Another wildly different paradigm is that 3D games will have a true 3D scene and a camera that moves through the scene. The player is presented with a view of the world as seen by the camera. 2D games often simply work everything directly in pixel coordinates.
The scrolling of the background can be faked by moving the background rather than doing any sort of math with a moving camera. If there is a camera, it’s likely just a single coordinate that is subtracted from the location of each sprite as it is drawn.
Factors Of 3D Games
2D games often create a fake depth using artificial parallax and offsetting the sprites at an angle. In 3D games, depth is genuine and falls out naturally from the math.
Lastly, I’ll mention how the controls behave differently in a 2D vs a true 3D game. When the user pushes the joystick to the right, our 2D character moves to the right. In 2D, that’s trivial – right just means the positive X-axis.
However, in 3D, the “right” typically means “the user’s right”, and that depends on which way the camera is facing. If the camera is facing North, “right” means East. But if the camera is facing East, “right” means the South.
3D requires a different set of disciplines to make the art assets and get them on screen. In addition, 3D art needs geometry, which is then UV-wrapped in textures.
To render the scene needs a more sophisticated scene hierarchy (probably a tree). Furthermore, the representation of orientations needs matrices or quaternions (or both). We need to consider the lighting differently.
Consequently, we need a 3D API like OpenGL to leverage hardware rendering.