game with fixed frame time

super_turbosuper_turbo Posts: 28Member

I'm working in a fighting game but I have a problem. Contrary to most games, in traditional fighting games the frame time must be exact for the animation, so if a computer is too fast, I will wait until the frame time is complete, and if the computer is too slow, the game will just slow down, but it will never drop frames. I know its strange, but I already have made 3 other fighting games building my own engine in C, and it is how it should work. Is it possible to do it in Godot without having do change the engine kernel? My main problem is with the AnimationPlayer node, is there a way to force the animation with time provided by me instead of the engine internal time (considering that I do continuous interpolation of angles and positions of the character body parts) ?

Thank in a lot!

Tags :


  • super_turbosuper_turbo Posts: 28Member

    I am almost finding a solution, I’m using the seek(t,true) method of the animationPlayer to do my fixed frame animation. All interpolations work well, the only thing that does not work are the function calls in the animation, the animationPlayer does not call them when using seek(), is it the expected behavior or is it a bug? Any suggestions?

  • memermemer Posts: 39Member

    What I would do is just not use the built-in time processing for most nodes, and give the nodes a separate method for handling one frame. _fixed_process should receive the same frame time each time, but it will be easier to deal with frames than frame times if you are doing fixed frame animation anyway. You can have some node that has a _fixed_process that just tells all the frame-processing nodes to process one frame.

    Working with frames instead of frame times is also essential for the kind of synchronized multiplayer demanded in fighting games, and the input delay / rollback based lag compensation methods that go along with it.

  • super_turbosuper_turbo Posts: 28Member

    Yes, netcode is one of the main reasons for frame based game.
    But the Godot animation tools are too good to not use them.
    I think I solved it, I extended the AnimationPlayer and I use my function for play, stop, etc.... using the function*(1/60),true).
    The only problem were the function calls in the animation, but I solved it by doing my own code that searchs for the function calls tracks associated with the animation and calls them at the right frames. Now it is working really well.

    thanks for the reply.

Sign In or Register to comment.