Open vanfanel opened 4 months ago
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()
?
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.
@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 :)
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)
@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?
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 theSDL_RENDERER_PRESENTVSYNC
on theSDL_CreateRenderer()
call...