I started this week by doing a bit of work on the dive shots. After playing a long rally with the AI player I felt that the dive shots should really be used as a last resort and there should be some form of penalty for using them. It felt like the dive happened really quickly so I decided to break the animation into three components, dive, idle and standup. Now I can control how long the player stays in the idle pose on the ground and means there is some skill involved in forcing your opponent into a dive followed by a cross court shot to win the point.
I began work this week on an action replay system. Whilst not critical to the core gameplay I wanted to have a system in place where the game could be paused at anytime, rewound and replayed. There may be times where the player has pulled off an amazing special move and you would want to see it again mid gameplay. I’m even considering a special move that could rewind time using the same system.
Unity offers a nice feature to handle recording the state of the animation tree. You can tell the Animator component to start recording and then playback with a given time stamp.
Unfortunately there is currently a bug in Unity that means that you can only correctly record the animation if you traverse through the animation state machine. On some occasions though I need to force the animation controller into a particular state, for example when playing the Win / Lose anims or when starting a serve. Those state changes were not getting recorded. On top of that, after recording it also broke these state changes during normal gameplay. Unity developer support were on hand though and this issue should be fixed pretty soon.
I built a Replay Manager where any object in the world could register an event to signify some form of state change. For the particle systems I added an event that could track whether the system was running or not and also the current duration. With these events in place I was able to code a way of seeking to a set time in the replay.
Here’s my replay system in action..
In this video you can see me start recording and then moving the character around and triggering various particle system. On playback I can scrub backwards and forwards through the timeline shown at the bottom.
Previously the game was hardcoded to play a “first to 2” match with the AI opponent. This week I’ve added the ability to specify how many games per set, by how many games clear you need to win a set and how many sets per match. I’ve done this so that you can build custom match rules. For example you might want to setup a local multiplayer game that has the first to 3 sets rule but only a need to win 2 games to win each set.
- Working out a plan for triggering special moves
- More special move types
- Work on the AI to make it easier to control skill level