Finally got another card ability animation implemented into SFT:
The method and architecture I’m using for driving game logic I think has served me well for the past few years. I shipped Outwitters on the basics, and expanded the gameplay “engine” for SFT, which allowed for real-time multiplayer (albeit in sometimes hokey ways). The drawback is I haven’t found a good way to untangle it from the animation layer. It’s all 100% unit-testable, but when it comes to driving user input visuals for card play, it’s still a mess of:
- Play this animation clip when a user clicks.
- At this point in time, run this action to apply changes to the game state
- Then run this bunch of code to update UI, send state machine changes to animation FSMs, and send out any other misc events
- Then either:
- wait some arbitrary amount of time to submit another “action”.
- Have some hook in either an FSM or animation clip, to call back to a method to submit another “action”.
- And proceed to pull hair out at all the other permutations of that flow should the user wish to back out of the “happy path”.
This makes for a very difficult setting to collaborate on animations. Ideally it’d be nice to just have the artist create some canned animations that I can just use and then time them to game logic when needed on a separate queue/thread. In practice this doesn’t work because a lot of card animations are spline-based. Furthermore, the splines are dynamic since cards could be in any number of states, locations, or orientation at any given time when a user decides to click them. This makes the process of “animating” abilities such as the above really time consuming. The alternatives:
- creating a ton of animations for each possibility (lol, no).
- Or a less ‘fluid’ look where cards simply don’t move as you’d expect, but do slightly strange arcs since it’s the same canned animation regardless of angle, position in hand or inventory slot.
I think in retrospect I needed to spend some extra time, maybe a week or more, coming up with a better pipeline or workflow to allow for easier iteration on card animations. My first hunch is maybe trying to make some sort of ‘building block’ animation library for cards. So for complex sequences they’d simply just be queued up series of fundamental animations in cards, and then I can easily just interlace calls to PlayAnimation() and SubmitActions() and treat them almost identically in code as opposed to the one-off hacks for each ability that currently exists. But even that process is rife with a lot of edge cases due to the dynamic nature of how players interact with cards, and ultimately would still require some programmer help to get things looking right.
For the moment, card animations in SFT are created by:
- The artist creates a fully animated mock up in Unity using the tools they know. Artist now exits stage right.
- I then painstakingly try to mimic that entire flow (and very often other user flows not captured in the 1 one-off mock up) using a combination of animation clips, splines, FSMs, and procedural animation via code.
- Give up trying to replicate the mock up when enough time has gone by and I realize I have to move on.
I’m able to capture the majority of the mock up’s “essence”, but a lot of the subtleties of the animation that artists are actually good at creating are lost due to lack of time and lack of flexibility. Maybe next go around if we’re doing another card based project I’ll be able to have another go at this.