Over these tutorials we learned a fair share about OpenGL's inner workings and how we can use them to create fancy graphics. However, aside from a few tech demos, we haven't really created a practical application with OpenGL. This is the introduction of a larger tutorial series about creating a relatively simple 2D game using OpenGL. The tutorial series will demonstrate how we can use OpenGL in a larger, more complicated, setting. Note that the series does not necessarily introduce new OpenGL concepts but more or less show how we can apply these concepts to a larger whole.
Because we rather keep things simple we 're going to base our 2D game on an already existing 2D arcade game. Introducing
Below we can see how Breakout originally looked on the Atari 2600:
The game has the following mechanics:
- A small paddle is controlled by the player and can only move within the bounds of the screen; either left or right.
- The ball travels across the screen and each collision results in the ball changing its direction based on where it hit; this applies to the screen bounds, the bricks and the paddle.
- If the ball reaches the bottom edge of the screen, the player is either game over or loses a life.
- As soon as a brick touches the ball, it is destroyed.
- The player wins as soon as all bricks are destroyed.
- The direction of the ball can be manipulated by how far the ball bounces from the paddle's center.
Because from time to time the ball might find a small gap reaching the area above the brick wall, it will continue to bounce up and forth between the top edge of the level and the top edge of the brick layer. The ball keeps this up, until it eventually finds a gap again. This is logically where the game obtained its name from, since the ball has to break out.
We're going to take this classic arcade game as the basis of a 2D game that we'll completely implement with OpenGL. This version of Breakout will run on the graphics card which gives us the ability to enhance the classical Breakout game with some nice extra features.
Aside from the classical mechanics, our version of Breakout will feature:
- Best graphics you've ever seen
- Advanced text rendering
- Postprocessing effects
- Multiple (customizable) levels
To get you excited you can see what the game will look like below after you've finished the tutorial series:
These tutorials will combine a large number of concepts as discussed in previous tutorials and demonstrate how they can work together as a whole. Therefore, it is important to have at least finished the Getting started section before working your way through these tutorials.
Also, several tutorials will require concepts from other tutorials (for example
If you believe you're ready to get your hands dirty then move on to the next tutorial.