This week has all been about TIME, that is ensuring that my game world maintains it's own time and that everything that
needs to be is tied into that.
I added the ability for my lighting objects to respond to time so they can be automatically switched on and off (or faded in
and out gradually) according to specified game times.
I did the same for my sound objects allowing them to play for specific game time ranges if required. Ambient Day/Night
sounds are an obvious example for this.
I added a flag for day/night transitions which can be used by various objects to determine aspects of their functionality
(animals going quiet at night for instance).
I set up events to pass both the game time and the day night transitions to the AI engine so it can make use of these too
and remain synced with the game engine.
The first implementation of this is in my AI for the animal behaviour. When night falls I need most animals to become in-
active ... so now I have access to the day night transitions I was able to expand my animal behaviour Finite State Machine to
have them return to their initial spawn points when night falls and remain inactive. They will still respond to close proximity
of a deemed threat (the player for instance) and go into an initial Alert State and then an Alarmed State and take flight should
the threat continue. But once that passes they'll return to their spawn point again and rest. Once morning arrives they'll
resume their standard wander and graze behaviour responding to threats as previously described.
A screenshot of the flow chart showing the basic design: