nxengine / nxengine-evo

nxengine refactoring
https://discord.gg/jnwmA7DhQh
GNU General Public License v3.0
495 stars 83 forks source link

Framerate locked at 50 FPS #6

Open rea987 opened 7 years ago

rea987 commented 7 years ago

Regardless of the resolution, the frame seems to hover between 50 to 52 on GNU/Linux. Can 60 FPS unlocked? Moreover, where is the config file? Thanks.

isage commented 7 years ago

Frame rate is defined in game.h. You'll need to adjust niku_draw function in statusbar.c accordingly. Why do you need 60 fps? It's not a first person shooter, and runs smooth at 25-30 fps

Config file is not human readable. settings.dat in the same directory with executable.

rea987 commented 7 years ago

As I checked, the original game was locked to 50 FPS as well, while Cave Story+ is 60 FPS. The lines that I changed are those:

nxengine-evo/game.h

#define GAME_FPS 50

to

#define GAME_FPS 60

nxengine-evo/statusbar.cpp

int mins = (value / 3000);      // the game runs at 50 fps
int secs = (value / 50) % 60;
int tens = (value / 5) % 10;

to

int mins = (value / 3600);      // the game runs at 60 fps
int secs = (value / 60) % 60;
int tens = (value / 6) % 10;

Now, it runs at 64 FPS and looks smooter; but I am not sure if that was affected game logic or not.

By the way, I couldn't quite figure which files needed to run the game without checking Russian binaries on cavestory.org, so I had to copy required files over;

http://www.cavestory.org/downloads/LIN64-NXEngine-RUS-1.0.0.4-Rev-4.tar.gz

isage commented 7 years ago

FPS shouldn't affect game logic (only hell timer, guess i should fix that)

I'll update readme with instructions some time later.

Muyfa666 commented 7 years ago

Was the option to set a higher framerate ever added to evo?

isage commented 7 years ago

Nope.

Muyfa666 commented 7 years ago

Ok.

Muyfa666 commented 7 years ago

No plans to add it as an option? I like your build better, but CS+ runs more smoothly.

isage commented 7 years ago

Thing is, original version runs at 50fps. Moreover, theres nikumaru counter (290.rec), and it stores value in frames, not seconds. NXEngine(and -evo) tries to be as compatible as possible with original game. CaveStory+, however, runs at 60fps. And stores nikumaru counter inside profile.dat, thus making it incompatible with original game. There are no plans, however, for CaveStory+ compatibility, as it's not freeware and anyway awailable on all supported platforms.

I can, of course, make the game run at 60fps, but store counter as if it runs at 50fps. I'll need some time to think about it and also some testing.

isage commented 7 years ago

Another problem is: game logic runs at 50 fps too, so by setting fps to 60, or, say, 120, game will run faster. So, i'll need to still run game logic at 50 fps, while running input/render/music unbounded. I'm not so sure if the game will be smoother than just running all at 50fps.

Clownacy commented 7 years ago

Changing the framerate does affect game logic: in Cave Story+, jumping doesn't last as long, because gravity is effectively increased by 1/5.

The switch to 50FPS was a last-minute decision by Pixel: the prototype versions ran at 60FPS, too, as can be seen in this footage. According to Pixel himself, the only reason he changed to 50 was because of performance concerns.

With that in mind, some people may want 60FPS, not because it's a Cave Story+ feature, but because it's a way of experiencing Cave Story 'the way it was meant to be'.

60FPS is a feature of my fork, if anyone's interested.

isage commented 7 years ago

@Clownacy still, when running at 60fps game becomes incompatible with original 290.rec, because 290.rec stores time in frames (see game.counter in niku_run)

Also, it would be nice to have some of your fixes as pull-requests.

Muyfa666 commented 6 years ago

Sorry to ask, but is 60 fps added now then?

isage commented 6 years ago

Nope.

vibrantrida commented 6 years ago

In my opinion, accuracy should be the priority, and that means keeping the 50 FPS lock. CaveStory+ is as much as its own thing, and there is almost no need to support it since CS+ is available already on many platforms.

And I don't think 60 FPS is the way CS was originally meant to be.

Here's what Pixel said regarding the decision to lock the game at 50 FPS on an interview:

In the end, I made it 50 fps because there were no environments at 50 fps. Regardless what environment it's run on there would be no adverse issues. It's very important that the movement or motion is consistent no matter what the environment.

Clownacy commented 6 years ago

I don't see how Pixel saying he changed to 50FPS "in the end" proves the game was originally meant to be that way.

isage commented 6 years ago

"In the end" in this case doesn't mean "at the end of development". He could've switched when he scratched beta version and started over, or half way through.