Timing animations with precision when dealing with different system performance levels.

  • #1, by dos4gwSunday, 10. January 2016, 03:09 9 years ago
    There is a sequence in my game where the characters sing a song. Unlike the rest of my game, I felt it necessary to lip sync the lines; random mouth flapping doesn't work too well when characters are holding single notes for a length of time.

    We made a system in Lua tied to system time to call actions based on specified millisecond marks. These actions include displaying the caption for the line and triggering a character animation. We've made character animations for each line in the song, using timed frames via the "set pause for each frame" option.

    As far as I can tell, calling the actions through our script works well and accurately. The trouble, though, is relying on the time it takes for the action parts to run, and for the animation to play through, which seems to be tied to system performance. Depending on the power of the PC you run it on, action parts or frames may be delayed, which can throw off the lip syncing. Also, if an animation runs too long, it can prevent the animation for the next line in the song from appearing.

    It's very important to me that this game be able to run on a large variety of hardware. Everything else in the game would at least work on a system that is performing poorly. But in the case of this song sequence, things are likely not to work at all if there is performance trouble.

    I was hoping that I could still use actions and action parts for each line, but it looks as though I may need to do everything in Lua. It seems like I cannot rely on the animation system to display frames at such accurate times, so will I need to code every frame change in order to make this work?

    Any ideas or comments would be much appreciated.


    69 Posts

  • #2, by dos4gwSunday, 10. January 2016, 13:05 9 years ago
    I found a good, if inelegant, solution.

    I've created several outfits with standing animations now filling the roles of the previously called character animations. When a character sings a line, I change outfits to the singing one and assign each alignment a line (even though the character faces one direction the entire time.) If I use up all eight alignments, I create another outfit, switch to it, and I have another 8 lines available. Rinse, repeat.

    While not completely solving the delay problem present when running the game on low-end systems, it does reduce it significantly. Most importantly, though, there is no animation I have to wait on to finish. I just change the alignment when it's time and I'm there.


    69 Posts