Imagine you have a situation we often encounter in a game - a character approaches a ladder and begins to climb it.
What is really happening behind the scenes to make this happen? First we would position the character under the ladder, where a trigger-box may alert the code that we can now press a button to enter a ladder climbing state.
When we press this button, the character places their hands and legs on the ladder - an authored animation that takes a few seconds to play out. Now we need to switch to a different movement scheme so the character can move up and down the ladder. But how do we make sure we're switching to this state at the right time so that we don't try and start moving the character before they've finished playing this animation?
The answer is to catch a message sent from the animation state machine. This is a feature almost all commercial engines now offer. You can set up specific transitions or states to send a message when they have been entered or left, and you can then use these messages to trigger code at exactly the right time. You can also often set up specific markers in an animation to send out a custom message at a specified time.
This two-way communication is a key tool that we use in scripting complex gameplay, as we will see in upcoming blog posts.