Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More adequate framerate for modern displays #21

Closed
vanfanel opened this issue Nov 1, 2020 · 4 comments
Closed

More adequate framerate for modern displays #21

vanfanel opened this issue Nov 1, 2020 · 4 comments
Labels
won't fix This will not be worked on

Comments

@vanfanel
Copy link

vanfanel commented Nov 1, 2020

Hi!
Since OpenTyrian's main advantage over original DOS executable is being able to play Tyrian on modern systems, which are ~60Hz over HDMI for the most part, and since OpenTyrian currently targets origina Tyrian farmerate (35FPS, based on a 70Hz display), I believe it would be a good idea to add a 30FPS mode, or even a 60FPS mode, that would fit well on modern displays.

I have been investigating the OpenTyrian sources myself: the SDL_Delay() calls used for framerate control are in src/nortsong.c.
However, this is pretty much obscure to me:
float jasondelay = 1000.0f / (1193180.0f / 0x4300);

and also setdelay(), setjasondelay(), setjasondelay2()... seem to use different target, target2, etc.. variables.
So, for experimentation, what could I mangle with to force the game into 30FPS instead of 60FPS?

Additional note:
To get smooth scroll, the SDL_CreateRenderer() call must be like this:
main_window_renderer = SDL_CreateRenderer(main_window, -1, SDL_RENDERER_ACCELERATED|SDL_RENDERER_PRESENTVSYNC);

So only framerate adjustment remains! Ideally, the game should sync to video (uncapped framerate) while keeping it's original speed (movement interpolation of some kind... but ~30 FPS should be an improvement over how ugly current scroll looks on modern screens).

@carlreinke
Copy link
Member

Like many games of its era, the frame rate in Tyrian is tied directly to the gameplay. (Changing the game speed in the in-game menu also changes the frame rate.) Decoupling them would require rearchitecting the whole game, which is unlikely to ever happen.

@carlreinke carlreinke added the won't fix This will not be worked on label Nov 2, 2020
@vanfanel
Copy link
Author

vanfanel commented Nov 2, 2020

@carlreinke Ok, but here must be some variable or value I can tweak on src/nortsong.c so I can get a 30FPS framerate instead of 35.

@vanfanel
Copy link
Author

vanfanel commented Nov 2, 2020

Anyway, do you know what these values mean, please?

float jasondelay = 1000.0f / (1193180.0f / 0x4300);

@carlreinke
Copy link
Member

1000 is 1 second in milliseconds. 1,193,180 Hz is the frequency of the timer available on DOS PCs. 0x4300 is the number of timer cycles per tick in Tyrian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants