chapter five
5 Game board and game loop
This chapter covers
- How to finish implementing our DOD architecture in Unity, an OOP engine.
- How to reduce code complexity by using a single script to run our game loop.
- How to set up our game scene in Unity to fit our DOD architecture and reduce code complexity.
- How to implement the game board, where we take in input and visually display the game to the player.
- How to implement the game loop that controls everything in our game.
In the previous chapter, we covered the engine-agnostic parts of our architecture: the Balance, GameData, and the Logic. In this chapter, we’ll cover the Board and Game, the two final parts of our architecture that turn our game into... well, a game. We’ll use Unity to implement both objects for a few reasons:
- It's the most popular game engine.
- At its core, it's an OOP engine, so it serves as a great example of how to shoehorn our DOD architecture into an OOP environment.
Let’s take a look at our complete DOD architecture.
5.1 DOD architecture, continued
In chapter 4 we showed how Game and Board fit into our architecture, as shown in Figure 5.1.