Author Topic: Battles playing at 60fps  (Read 38619 times)

DLPB

  • No life
  • *
  • Posts: 4998
  • Karma: 80
  • The Mighty Arms of Atlas
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #50 on: 2010-08-05 16:36:54 »
I can tell you from experience that changing from frame based movement to time based movement would not be simple at all.  A lot of changes would be needed.  The game was designed to run the way it is running and it animates to that frame rate. (the battle is supposed to be 60 for the menu and 15 for the models).

The calculations are all done based on frame number,  You can't just tell the game to run at a certain frame rate or as fast as possible when it expects calculations based on the frames.  If  a NPC is told to walk for 30 frames left and then change direction, and you change the frame rate, it will change the distance he travels and alter the whole path he travels.  There would need to be modifications to take these kinds of things into account. 

There are cons with time based movement as well, it isn't all rosy. The effort required to rearrange it all to work time based just isn't worth it imho.  And I don't see anyone here putting the time into changing it all.  How hard it would be for some of the more advanced programmers around here to change it all I don't know.  There is no point rendering as fast as possible when you are only going to be animating at 30fps and slow computers can still play this game at full speed.

So I don't see the point.

[I am assuming the game runs based on frames using timegettime, since in the menu the time dialogue boxes spend on screen are given as an absolute frame number, and the PSX games would use frame based movement]. 

« Last Edit: 2010-08-05 16:41:14 by seif »

Bosola

  • Fire hazard!
  • Global moderator
  • No life
  • *
  • Posts: 1724
  • Karma: 9
    • View Profile
    • My YouTube Channel
Re: [WIP] Running all of FF7 at 60fps
« Reply #51 on: 2010-08-05 19:27:40 »
Yeah, that's what I was saying, I think that's what they want too. They want the game to look like it did on the psx, but still have it run smoother because of the increased FPS.

This fix, if it can be applied would allow the game to work like that, even above 60fps, in fact, as fast as your machine can run it, and still look as expected.

I know I get hitches, etc, using the Remix patch(like when a character hits their limit.) so this should be able to smooth that stuff out.

The problem, lies in the implementation(which is why I said it might be stupid.), I have no clue what Squares code looks like, so it may just not work with the way they coded the game. The next problem is you need some very smart FFVII hackers to help you figure out where stuff is being called, and to help inject the new code. (There are quite a few of these folks around here btw.)

But on the plus side, you wouldn't need to edit a bunch of game files, and it wouldn't be locked to 60fps, it could actually run way faster, etc,.

(I wonder if the minigame fix does something similar?)

I may be being thick, but I still don't understand what you're saying. Perhaps I've misunderstood you - let me describe what you (seem) to be saying:

* There's a loop, along the lines of

Start
> Poll controls
> Do logic
> Paint screen
End loop

You're suggesting that rather than the above loop x4, we'd use:

Start
>Poll controls
>Do logic
>Paint Screen
Repeat
>Poll controls
>Do logic
Repeat
>Poll controls
>Do logic
Repeat
>Poll controls
>Do logic
Repeat
>Poll controls
>Do logic
>Paint screen

...done at a faster rate. But, with this method, the animations would look exactly the same, so I don't really see how this would help.


sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #52 on: 2010-08-05 19:31:37 »
I think he is implying this:

Start
> Poll controls
> Do logic
Start
> Paint screen
Repeat loop 4x
End loop


Bosola

  • Fire hazard!
  • Global moderator
  • No life
  • *
  • Posts: 1724
  • Karma: 9
    • View Profile
    • My YouTube Channel
Re: [WIP] Running all of FF7 at 60fps
« Reply #53 on: 2010-08-05 21:04:29 »
Which loop is he repeating?

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #54 on: 2010-08-05 21:14:11 »
The paint screen. from what i gather anyways. Im not really sure.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #55 on: 2010-08-05 21:29:44 »
@ wauti clan would ff7 then become one of those games that will try to use every last cycle of my processor.(i.e no matter what 100% cpu use) if so then i think its a bad idea..

If FF7 can use all your CPU's power, I think you need a new PC. :P

Kidding aside, that's really not a good argument to avoid this option.

Most games do this, any modern game is going to use every CPU cycle it needs to run the game full speed. Assuming the game is using VSync\frame limiting, it will only stop consuming CPU cycles once the desired 60fps has been reached.

If you remove the limiting(ie, no VSync\frame limiting), it will allow the FPS to go beyond 60fps, and it will keep increasing as long as you have CPU power to spare, using all of your CPU power. (Unless of course the programmers added some additional code to keep it under control. By checking FPS vs. CPU usage percentage, but I doubt many, if any do this.)

So it's a bit hard to give you an accurate answer here, but the bottom line is this, if you have a problem with a game using all your CPU cycles, use VSync, or any built in frame limiter the game may have, or else it will.

I hope that explained it, it's kind of a tricky question.

----

As for the rest of the questions.

A game loop is just a loop in the games code, this loop usually updates all the games individual parts. (We are ignoring multithreading, etc,. For simplicities sake.)

These parts include, renderers, physics, controls, sound, etc,. (AKA, game logic.)

Loops work like this.

Loop Start
 Do Something
 Do Something Else
Loop End -> Return to Loop Start, Repeat.

(This process is a loop iteration, ie, going from loop start to loop finish, is one loop iteration.)

Now, in most games, you will not want everything updating every single loop iteration.

So you do this.

Loop Start
 Counter+= 1; // Count Iterations
 Update Sound // Updates Every Iteration
 
 if (Counter >= 2)
 {
   Update Animations
   Counter = 0; // Reset Counter
  }
 
Loop End

That would make animations skip a frame(this is called frame skipping), and animate every other frame. (As opposed to every frame like sound in the example above.)

Using mathematical formulas, you can control when animations get updated, and keep them at the desired speed, no matter how many FPS you are getting.

(FPS is the amount of loop iterations that occur within a single second. A loop iteration is also known as a frame, thus the term frames per second.)

I hope that's more clear.

----

As for benefits, think about loading, if everything is capped at so many iterations per second, say 30 iterations(ie, 30fps), loading is also capped. So the game loads textures, and such, slower than it could.

By locking animations, and unlocking other stuff, you can make the game load faster, and process other stuff faster, while still animating at a fixed rate. (This is great for loading, and processing input, anything you want happening as fast as possible.)

In FF7's case, you can expect faster save times, faster area transitions, smoother overall feel, more responsive controls, and probably no more hitching, stuttering, etc,. (No matter what mods, or resolution you are running, ie, FF7 is NOT that demanding of a game compared to modern games.)

Sorry about the novel, this is why I was being somewhat vague to begin with, it's rather complex.

--

Edit:

@Seif, you are correct, I was just offering a solution that was better than padding all the animations, figuring out how to slow down the camera, slowing down menu's, etc, etc,.

Btw, I also recommend this method for another reason. Think about it, the game is running at super speed @60fps, correct? (I saw the video, it looked pretty fast.)

So, do you think padding animations will fix scripted events? NPC's will move from point A to point B at super speed, regardless of animation padding, so it will have normal speed animation(with padding), but still move at super speed(on their scripted paths), so it won't look right at all.

Seif was right on with the frame based stuff, there is a lot more to fix than you guys are taking into account. So, if you're going to do it, you might as well go all out, and basically fix the port. (Which is what I'm suggesting, and explaining.)

Seif was also right about some things not being designed to work that way, so you will still have figure out some stuff on your own, basically, add what I suggested, then see what's still working wrong, and fix it. (I would tell you if I knew, but I've never re-ported FF7 via hacking b4, so I don't know the specifics, sorry.)
« Last Edit: 2010-08-06 00:39:13 by Wutai Clan »

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #56 on: 2010-08-06 00:18:50 »
But that is exactly what we are not trying to do with increasing the frames to 60fps. We are trying to do it to make all the animations and graphical effects smoother. Not keep them looking exactly the same.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #57 on: 2010-08-06 00:49:08 »
But that is exactly what we are not trying to do with increasing the frames to 60fps. We are trying to do it to make all the animations and graphical effects smoother. Not keep them looking exactly the same.

Even if you pad battle animations, this is going to effect the rest of the game right? Try padding animations for scripted events, you'll quickly learn why I'm telling you what I am.

You could, I guess make battles run at 60fps, but put the game back however it normally is after battles. (30fps I'm guessing?)

Regardless, it's apparent you don't need my help.

Good luck.

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #58 on: 2010-08-06 01:02:38 »
The battle scenes already have a different fps then the rest of the game. 15 vs 30fps. We are already able to modify the exe to make it run at 60fps and can get the model animations smooth. It is only the sprite effects and the camera we have yet to figure out how to add more frames to.

obesebear

  • Administrator
  • No life
  • *
  • Posts: 2927
  • Karma: 7
  • King of Model Importing
    • View Profile
    • Modders Haven
Re: [WIP] Running all of FF7 at 60fps
« Reply #59 on: 2010-08-06 02:14:15 »
I'm still lost as to why people think interpolating animation frames will somehow cause an error when upping the game to 60 fps.   If the animations are set to be the "correct" speed at 30 fps, doubling them and increasing the fps to 60 will keep everything exactly as is.   Right?

If not, I really wish someone would explain how the field will act differently than the battle does..

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #60 on: 2010-08-06 10:04:40 »
I'm still lost as to why people think interpolating animation frames will somehow cause an error when upping the game to 60 fps.   If the animations are set to be the "correct" speed at 30 fps, doubling them and increasing the fps to 60 will keep everything exactly as is.   Right?

If not, I really wish someone would explain how the field will act differently than the battle does..

The other guy just said, that's exactly what you're not trying to do.

Quote
We are trying to do it to make all the animations and graphical effects smoother. Not keep them looking exactly the same.

So this is completely contradictory to what you just said. You guys need to get on the same page about what your goals are.

No one can answer you, if they don't understand what you are trying to accomplish.

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #61 on: 2010-08-06 10:53:36 »
Put simply we are trying to increase the battles from 15fps to 60fps and make everything look smoother in the process. This involves adding interpolated frames to the animations, get the camera to move at normal speed (most likely by making it have more frames as well) and getting the sprite effects to look proper.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #62 on: 2010-08-06 13:54:13 »
Quote
Put simply we are trying to increase the battles from 15fps to 60fps and make everything look smoother in the process.

Smoother is not a tangible amount, it's a matter of personal preference, you need some target values. (ie, if the game is running at 60fps, and you double the frame count for an animation, it will be running at half speed. Or exactly the same as it normally is when the battle system runs at 30fps.)

So you guys should decide on a goal, and write it out, that way people can understand what you are going for.

Quote
get the camera to move at normal speed (most likely by making it have more frames as well)

Camera's usually don't work like that. This is going to be a lot harder than you think. (Unless you lucked out, and FF7 has a simple camera design.)

--

I think I'll just leave you guys to it, keep my earlier suggestion in mind(I have a feeling it's the only way to accomplish your goals.), and remember, frame skipping is variable, so you can in fact make it run at other speeds beside normal, I just used normal as a baseline for describing the technique.

Sorry I can't be of more help.

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #63 on: 2010-08-06 14:16:32 »
Quote
Put simply we are trying to increase the battles from 15fps to 60fps and make everything look smoother in the process.

Smoother is not a tangible amount, it's a matter of personal preference, you need some target values. (ie, if the game is running at 60fps, and you double the frame count for an animation, it will be running at half speed. Or exactly the same as it normally is when the battle system runs at 30fps.)

So you guys should decide on a goal, and write it out, that way people can understand what you are going for.

Quote
get the camera to move at normal speed (most likely by making it have more frames as well)

Camera's usually don't work like that. This is going to be a lot harder than you think. (Unless you lucked out, and FF7 has a simple camera design.)

--

I think I'll just leave you guys to it, keep my earlier suggestion in mind(I have a feeling it's the only way to accomplish your goals.), and remember, frame skipping is variable, so you can in fact make it run at other speeds beside normal, I just used normal as a baseline for describing the technique.

Sorry I can't be of more help.

Very well, I will try to explain it in a more concise manner. Battles run at 15fps right now. We wish to increase this to 60fps. To accomplish this we increased the amount of frames in animations by 4x (ie instead of 30 frames it will have 120). We have already accomplished this part of it. Take a look at the video I posted earlier in the thread. The duplicated frames are interpolated to provide a 'smoother' looking motion in game (not choppy). We also need to change the camera to add more frames in as well (hopefully interpolated). We are partway there an this. NTFIC1 has been decoding the camera data and there are opcodes that determine the amount of frames a camera motion has when rotating/translating. Last but not least we need to crack the SPT to see if we can either add more frames, or make it duplicate them as well so things look the proper speed in battle. Hopefully this explains a bit better what we are trying to accomplish.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #64 on: 2010-08-06 14:26:23 »
Alright, now that made sense. :)

You still have to contend with characters traveling too fast during scripted events. Even if you interpolate the animations, they will still be moving faster(in vector space), so, there is that.

Timers, like the countdown on bombs will be effected as well, so you will have less time to escape the facility. (The timer is tied to a bunch of stuff I'm sure, I'm guessing the games scripting language uses it.)

Probably a whole host of other things as well.

Can you maybe, make new animations, is that possible with the current tools, rather than padding them, increasing fps, etc, just make them look better to begin with?

I don't know, like I said, I'll leave you to it, but I appreciate the clear explanation, I at least understand what you are trying to do here.

---

Edit: For clarity, animations usually have an animation speed value associated with them, so by adjusting that, and then padding, or re-animating, etc, you would get similar results. (With less work.)

That would allow you to leave the game at it's default speed, and just change how fast the individual animations are displayed. (Increasing the speed value, would account for the padding, making them look smoother like ya want. Also saving you the trouble of messing with camera's, etc,.)
« Last Edit: 2010-08-06 14:42:49 by Wutai Clan »

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #65 on: 2010-08-06 14:31:11 »
Vector movement has also been taken care of already. It is tied into the animations. I am not sure about the timer, but I should look into that for sure. Remaking animations would be a very daunting task. Much more time involved then the method we have devised already (Modified kimera that adds frames in and mathematically interpolates them so they are in between the two 'key' frames). As for scripted events I am not sure what you mean exactly. I know of no scripted events in the game in battle other then the battle messages (Guard scorpion tail laser, etc) Those can be managed by manipulating the battle message speed.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #66 on: 2010-08-06 14:36:21 »
As for scripted events I am not sure what you mean exactly. I know of no scripted events in the game in battle other then the battle messages (Guard scorpion tail laser, etc) Those can be managed by manipulating the battle message speed.

Like, when the other party members are walking around under computer control, for instance, during the games first mission, you see the team run ahead of you, and say something like, come on newbie..

That's a scripted event, the games characters are being moved according to a game script(ie, it's not a pre-recorded FMV.).

Also see my last post, the edit.

--

Edit:

My main concern, is that this won't work with custom models, only the models you are tweaking, so if you do it like I originally suggested, it would work for any models inserted into the game.

Or if my second suggestion is workable. If you can adjust animation speed(if FF7 has that value for animations), you could at least make a patcher that would work with custom models by simply patching the files.

If you do it the way you currently are, this mods going to be very limited in use, if it doesn't use the high quality models available, and better texture mods, etc,.

If I had to choose between high quality Cloud, and a smoother regular Cloud, I'd take the high quality version.
« Last Edit: 2010-08-06 14:49:21 by Wutai Clan »

obesebear

  • Administrator
  • No life
  • *
  • Posts: 2927
  • Karma: 7
  • King of Model Importing
    • View Profile
    • Modders Haven
Re: [WIP] Running all of FF7 at 60fps
« Reply #67 on: 2010-08-06 15:33:19 »
I see what you're saying.   When the game tells the model to run to a certain scripted spot, they may move twice as fast.   Since we haven't experimented using this in the field yet, that may not happen.  But if I were a betting man I'd say that's probably correct.

All custom models use the same animations.  We don't have the tools to efficiently create new ones.

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #68 on: 2010-08-06 16:54:44 »
Right now we are only concerned with the battles. Field is fine at 30fps for now.

Wutai Clan

  • Crazy poster
  • *
  • Posts: 127
  • Karma: 0
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #69 on: 2010-08-06 18:01:51 »
All custom models use the same animations.  We don't have the tools to efficiently create new ones.

So, the animations are stored separately? (Just wondering how it would work, changing models, and still using the padded animations.) At any rate at least a solution exist. (I really prefer the enchanced models.)

What about my question about the animation speed value? Do you guys know if that exist?

That would be the best way to go, for one, you could leave the FPS at it's default settings.

Then, if you adjust the animations for Cloud, and you are doubling his animation frame count, if an animation speed value existed, simply doubling it would make the animation run at the correct speed again with the padding in place.

This way you avoid having to fix timers, cameras, and any thing else that may be messed up by upping the FPS to 60fps.

Do you see what I'm saying?
« Last Edit: 2010-08-06 18:05:15 by Wutai Clan »

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #70 on: 2010-08-06 18:19:53 »
I do, unfortunately I do not know if such a value exists. I am pretty sure the game is not able to display more frames then the fps is set at. And even if it did you wouldnt see it since the game will only refresh the screen 15 times per second.

Covarr

  • Covarr-Let
  • Global moderator
  • No life
  • *
  • Posts: 3052
  • Karma: 35
  • I'm not your babysitter.
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #71 on: 2010-08-06 20:21:08 »
Suggestion: If you can't get the cameras working at 60fps, is it at least possible to have the camera update at 15fps and the animations at 60fps, with the whole engine at 60 and just having it update the camera every fourth refresh? It obviously won't look great, but it'll still be a notable improvement, and a good start for the time being until the camera CAN be changed.

DLPB

  • No life
  • *
  • Posts: 4998
  • Karma: 80
  • The Mighty Arms of Atlas
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #72 on: 2010-08-06 21:35:01 »
I see what you're saying.   When the game tells the model to run to a certain scripted spot, they may move twice as fast.   Since we haven't experimented using this in the field yet, that may not happen.  But if I were a betting man I'd say that's probably correct.

All custom models use the same animations.  We don't have the tools to efficiently create new ones.

I would bet that is exactly what would happen, but it is also possible.... depending on how it is programmed, that the models would move 2X further as well.  I don't think that applies in this case but certainly they will move 2x as fast.

sl1982

  • Administrator
  • No life
  • *
  • Posts: 3573
  • Karma: 16
  • GUI Master :P
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #73 on: 2010-08-06 21:37:21 »
Suggestion: If you can't get the cameras working at 60fps, is it at least possible to have the camera update at 15fps and the animations at 60fps, with the whole engine at 60 and just having it update the camera every fourth refresh? It obviously won't look great, but it'll still be a notable improvement, and a good start for the time being until the camera CAN be changed.

I am sure it could be done that way, but it is way beyond what I am capable of doing. If anyone thinks they are able to do this please PM me.

DLPB

  • No life
  • *
  • Posts: 4998
  • Karma: 80
  • The Mighty Arms of Atlas
    • View Profile
Re: [WIP] Running all of FF7 at 60fps
« Reply #74 on: 2010-10-02 09:13:04 »
I found a few values in the exe which make the items on the menu smoother.  So far I have only found the side menu values but with Kranmer I am guessing the rest (like Gil Box) can also be found.  Have a go yourself:

FF7.exe
Edit address 002C8EA0 to 50
Edit address 002C8EAB to 12

Then open the menu and pay attention to the side menu (other values need altering to make it look perfect but this should give you a good idea)

I have added this to the menu reconstruction mod.