Figured I'd take some time today to talk about Timelines and their new role in TaleSpire.
I've recently spent some time reworking how emotes (and creature actions) work in-game. Previously this was a simple animation which ran on the character base — enabling it to do stuff like a swirl or knock in the direction of a target creature for an attack. All well and good, but it was limited to movement and some event calls. So if we wanted to add effects or run specific logic over time (turn the character towards a particular target etc.) it took a lot of custom scripts per emote or action.
I re-discovered these limitations when trying to work on the Death emote — wanting to run effects, transition materials and spawn new objects (a gravestone).
This set in motion the rewrite of the emote system into using timeline. With a timeline object, we can have all the logic and objects embedded in the timeline itself. Loading in a prefab, turning on and off objects, effects and even audio as we see fit. It also allows us to write custom clips for easily reusable behavior.
There have been some challenges I'm still working on solving:
- Making sure the timeline connects to the creature correctly. Tracks needs to know about specific components on the creature. When the timeline is instantiated on top of a creature, these need to be hooked up. It was a bit tricker than I anticipated. And caused me to create a bridge component which looks at specific tracks based on names to find the correct pair.
- The other one I'm still working out which is timeline states. We want creatures who die to stay that way until the GM says otherwise. This introduces the concept of timeline states. Which I'll get into another time.
Anyway, I'll show some proper new timeline driven emotes later in the week. For now.. KNOCKDOWN:
Hopefully I'll get better at writing these.