Today we're going to take a little peak beneath the hood of Vagabond PI and see the workings of the engine. The current status of the game is the coded more complex than it has been in the past. Almost the entire game occurs within 1 frame. The world you will be exploring and the building interiors are all within the same frame that currently has 1,228 events. A goal with the game has been to use these events has efficiently as possible through things like fast loops and copy and paste as opposed to cloning objects. After all, sloppy and inefficient coding can slow down a game dramatically.
One of the hardest features of setting up the game has been the "generator" engine, something I would like to show case. Since the game takes place in one frame, there has to be a way for resources to reset over a set period of time since the player cannot simply leave the frame and come back in. My solution was to spam the create object feature. Take a look below:
The yellow objects are invisible active objects that have the job of create specific active objects at set periods of time. The forest area shown in the top looks like this when approached in game:
Here's a quick synopsis of how it works. Trees, crabs and seashells ares super simple. Basically the invisible generator detects if an object is no longer above it, if so it will start a timer. When the timer hits zero it will spawn a new tree/seashell/crab if the player is in a different section of the map.
Wildlife like deer and snakes are a little more complex.
Because these active objects move, they have to be given an ID. When generated, they receive an ID tag in its alterable values based on the X and Y of the generator that created them. As long as a deer exist with an ID tag that coordinates with the X and Y of its generator it will not create more deer. When the deer is harvested it will start the timer on that generator. This creates an endless supply of wildlife from what is only 2 objects.
Hopefully I didn't bore you guys with this tech talk, but I'm very happy with the coding that is going into this project. Until next time, happy gaming!