O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Founding a city-builder game

Armed with all this knowledge, we can now try it out in practice!

In order to figure out what to test, we obviously need to have a clue about what we're trying to build. Here's the mile-high view of the project:

  • Real-time city-building/strategy game
  • Client/server architecture
  • The game area is a 2D grid of squares, with each square having the following:
  • A mandatory terrain ground
  • An optional terrain block
  • Objects
  • Beings

Let's start by defining all the features of a square.

The terrain ground can be one of soil or stone. This unsurprisingly refers to the ground or floor.

The terrain block can be soil, stone, or tree. This refers to a non-passable block that can be left as a wall, or be mined or felled away.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required