Marking Out the Route
A key aspect of the gameplay of Space-Truckers is how the path taken by CargoUnit
in the route planning phase affects the challenges – and the rewards – of the driving phase. We’ve already tackled the ballistic flight mechanics of the route planning, so now, we need to capture that route and data about the environments it traverses. The following diagram shows the primary properties of our route and how they might be represented:
Figure 7.2 – Various pieces of telemetry are captured during the in-flight part of route planning. The Position, rotation, velocity, and a timestamp are all collected for each sample
Here, the idea that CargoUnit
is what is responsible for saving its path, which translates out to the CargoUnit
class, thus gaining a new routePath[]
property along with associated logic in the reset()
and update()
methods to clear and update the path, respectively. The data itself is simple, though we...