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

What's the engine framerate? #53

Open
vanfanel opened this issue Mar 30, 2024 · 5 comments
Open

What's the engine framerate? #53

vanfanel opened this issue Mar 30, 2024 · 5 comments

Comments

@vanfanel
Copy link

Hi again,

Just discovered this awesome sourceport today so I am like crazy trying to make it work as I like! :)

What's the current engine top framerate? I know many DOS games where 35 FPS (as in 70/2 because of the standard mode 13, etc), but this game seems to use mode-x, which if I am not mistaken was 320x240 at 60 Hz, so this engine should be in the 30's, right?

My idea is getting it to sync to screen refresh: that should be possible by eliminating any internal timing calculation around SDL_Delay() and activating VSYNC by passing the SDL_RENDERER_PRESENTVSYNC on the SDL_CreateRenderer() call...

@vanfanel
Copy link
Author

I was looking at the code. Commenting out the SDL_Delay() calls don't seem to have any effect, and SDL_RENDERER_PRESENTVSYNC is already being passed on the SDL_CreateRenderer() call.

Is there a way to make the game "as fast as possible" so it syncs to SDL_RenderPresent()?

@fabiangreffrath
Copy link
Owner

The SDL_Delay() call let's the CPU sleep for about 1 ms and thus effectively caps the frame rate at 1000 fps. It is merely there to prevent the CPU from heating up while waiting for the next tic to render.

I guess what you are actually asking for is tic interpolation. This is tracked in #22, but no work has been done in that direction yet.

@vanfanel
Copy link
Author

@fabiangreffrath No, I am not asking for tic interpolation: that's the deffinitive solution that is way above my head, and I want a temporal solution that I have applied on another sourceports that use 35 tics per second, like OpenTyrian etc.

I need to make the game run as fast as possible: as in "unplayably fast". NO internal speed control at all: I need to disable any internal speed control even if that means CPU hammering.

Then, I will force it to wait on SDL_RenderPresent(), which is blocking if vsync is active.
The game will then run at 60 FPS (since I use a ~60 Hz video mode).

And then, two calls to SDL_RenderPresent() instead of one, and the game will run at 30 FPS, which is near enough to 35 FPS to make the game playable AND smooth.

Hacky and clunky, but it works for me.

But I need to disable internal speed controls so the game runs as fast as it can... That's where I need your help because you know the code very well :)

@fabiangreffrath
Copy link
Owner

I need to make the game run as fast as possible: as in "unplayably fast". NO internal speed control at all: I need to disable any internal speed control even if that means CPU hammering.

You mean like this?

--- a/rott/rt_draw.c
+++ b/rott/rt_draw.c
@@ -1381,9 +1381,8 @@ void CalcTics (void)
 // calculate tics since last refresh for adaptive timing
 //

-   tc=GetTicCount();
-       while (tc==oldtime) { tc=GetTicCount(); I_Sleep(1);} /* endwhile */
-   tics=tc-oldtime;
+   tc++;
+   tics=1;

 //   SoftError("CT GetTicCount()=%ld\n",GetTicCount());
 //   if (tics>MAXTICS)

@vanfanel
Copy link
Author

@fabiangreffrath Almost: that causes the game to hang as soon as it's trying to start the first stage.

But that part of the code... can it be used to force a given framerate instead of trying to adjust it dynamically?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants