playMaker

Author Topic: How to get Frame Data for a fighting game?  (Read 2204 times)

paradiseprime

  • Full Member
  • ***
  • Posts: 106
How to get Frame Data for a fighting game?
« on: June 21, 2023, 04:45:28 PM »
I am trying to add a Frame Data counter similar to Street Fighter 6>
I know that 1 frame in 60 FPS = 1/60
I can get the amount of frames of an attack by doing> AnimationLength/(1/60)

The issue I am having is that when I try count the frames in real time. Its always off by a frame or 2 and is influenced by frame rate. How does Street Fighter 6 do this without inconsistencies?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to get Frame Data for a fighting game?
« Reply #1 on: June 21, 2023, 05:43:20 PM »
Hi.
Have you tested in a build?

As editor can be laggy (editor loops etc)

Also make sure that the fixed time step is set to 0.01666 inside the project settings

paradiseprime

  • Full Member
  • ***
  • Posts: 106
Re: How to get Frame Data for a fighting game?
« Reply #2 on: June 21, 2023, 11:46:37 PM »
Hi.
Have you tested in a build?

As editor can be laggy (editor loops etc)

Also make sure that the fixed time step is set to 0.01666 inside the project settings

I tried a build and it was still inconsistent but I did not try setting Fixed Time Step to 0.01666. Thank you for the suggestion.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to get Frame Data for a fighting game?
« Reply #3 on: June 22, 2023, 07:00:17 AM »
hi,
yea 1/60 is actually 0.0166666666666667
and by default (at least 2019 and below) has a different setting (0.02)

paradiseprime

  • Full Member
  • ***
  • Posts: 106
Re: How to get Frame Data for a fighting game?
« Reply #4 on: June 22, 2023, 11:12:57 AM »
hi,
yea 1/60 is actually 0.0166666666666667
and by default (at least 2019 and below) has a different setting (0.02)

I thought Fixed Timestep was for physics only. I didnt know it affected the Wait function.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: How to get Frame Data for a fighting game?
« Reply #5 on: June 22, 2023, 11:38:06 AM »
Hi.
No, wait is OnUpdate.

But probably you want everything in sync.
if you have vSync disable, you might want to enable this.

maybe you can show more details on your setup

paradiseprime

  • Full Member
  • ***
  • Posts: 106
Re: How to get Frame Data for a fighting game?
« Reply #6 on: June 22, 2023, 09:41:11 PM »
Hi.
No, wait is OnUpdate.

But probably you want everything in sync.
if you have vSync disable, you might want to enable this.

maybe you can show more details on your setup

Thank you once again for assisting.

I do have Vsync turned on.
I THINK I've managed to find a way to make it "100% consistent".

I get the True Frame Data of an animation by doing the math separately. "AnimationLength/(1/60)"

From there, I get the True Frame Data and use that to clamp value to clamp the, "counter" portion because is isn't important if the visual counter is 1 frame off when counting as it is far too fast to count when in motion. The most important points would be the start and end and both can be adjusted by making sure the start is synced and the end is clamped and synced which can be done due to, "Get Animator Current State Info Is Name" since it appears to be 100% accurate as to when an animation starts.

The counting method I am using is the Int Interpolate Int Add action but I would love to know what counting method is the most consistent? This applies to getting the start time of an animation.

Edit: I forgot I edited on play mode and went to test it again with Int Interpolate and forgot that Int Add with Everyframe turned on was the most consistent. I got so excited that I found a consistent way that I forgot to change it out of gamemode. Corrections made on post.
« Last Edit: June 22, 2023, 10:10:41 PM by paradiseprime »