Chapter 9: The Game Engine, Threads, and the Game Loop
In this chapter, we will see the game engine come together. By the end of the chapter, we will have an exciting blank screen that draws debugging text at 60 frames per second on a real device, although probably less on an emulator. While doing so, we will learn about programming threads, try-catch
blocks, the Runnable
interface, the Android activity lifecycle, and the concept of a game loop.
My expression of excitement for a blank screen might seem sarcastic but once this chapter is done, we will be able to code and add game objects, almost at will. We will see how much we have achieved in this chapter when we add the moving ball and controllable bat in the next one. Furthermore, this game engine code will be used as an approximate template (we will improve it with each project) for future projects, making the realization of future games faster and easier.
We will be covering the following in this chapter:
- Coding...