Replies: 11 comments 10 replies
-
I like this idea, I'll give it a try |
Beta Was this translation helpful? Give feedback.
-
I've created a branch for testing (https://github.com/viti95/FastDoom/tree/faster-fps-updates), I've tested this only on emulators, now it's much more responsive, even with lower framerates. Also I have to check the performance impact of having the FPS enabled on slow systems. |
Beta Was this translation helpful? Give feedback.
-
I have implemented the first method I described earlier and compared it with your implementation. It give similar results (both end up showing same FPS once stabilized) and both cap at 35 FPS. I am working on an improved version of it. |
Beta Was this translation helpful? Give feedback.
-
Here is a video that compare implementations (4000 cycles in DOSBox) : 2024-08-22.13-10-18.mp4
I'm unsure which method is the best. There is probably a tradeoff between stability and response time. |
Beta Was this translation helpful? Give feedback.
-
Looks very promising!! I'll test both implementations this weekend on my 386SX (the slowest system I have). I'm surprised it's possible to update this fast and accurate even on very low framerates. I really like the 2nd method even if it's a bit shaky. Response time is much better than my average method. What do you think is better? |
Beta Was this translation helpful? Give feedback.
-
I've done some testing in both my 386SX@33 and 486DX@80. Both methods work very well and don't take a big hit in general performance (Dosbox usually hides the latency of instructions like idiv and memory latency). The only issue I've found is that the 3rd method (non decimal), caps out at 64 fps when running a timedemo, while the 2nd method shows correctly the framerate with more than 64fps. |
Beta Was this translation helpful? Give feedback.
-
64 fps cap : if FPS can go above 64 FPS, Here is a chart that compare all methods :
Those methods can be tweaked out (eg: green/cyan: use 70 frames buffer, amber: use 124/4 ratio). It will cause them to be more stable but less responsive (they will get closer to the yellow line). Still, they will lower quickly when the FPS drop because they are frame rate independent. |
Beta Was this translation helpful? Give feedback.
-
If you are OK with zero decimal places FPS : method that count frames is probably the best. It's super fast (CPU wise) and responsive. |
Beta Was this translation helpful? Give feedback.
-
I have made new tests with tweaked parameters (as suggested before). While it improve stability (less shaking), it's far from great. It's possible to tweak it even more but then the response is quite slow (as your current method). It's annoying to have to wait several seconds to see FPS impact when you change some game settings or move camera. I made another series of tests, using a much better timer : It's very stable and responsive. However using a high resolution timer all the time might not be advisable. If you look at the chart you will see new results are now slightly below purple line. The reason is that high precision timer use more CPU cycles. Not sure if it's timer callback itself or extra process done by What about some trade-off (that should be documented) :
If you want to show FPS with one decimal in all cases : you have to deal with large response time (which might be OK) or FPS shakiness (which make decimal part hard to read and somewhat useless). The changes have been pushed on the respective branches. |
Beta Was this translation helpful? Give feedback.
-
Maybe you can take a look at @dougvj branch for frame interpolation (#176), it uses a faster timer interrupt (560Hz). My implementation it's not working fine so changes will have to be made for the new "uncapped FPS" mode. As for me it's ok to show the framerate with zero decimal places, in fact it's faster as less characters has to be drawn each frame on the screen (I'm also thinking of using the very small number font to make it draw less pixels on screen). |
Beta Was this translation helpful? Give feedback.
-
I took a look at some old DOS games that have a framerate display built in, to get an idea about how it was done. Some show zero decimal (Duke3D) some 2 or 3 (Descent 2, Pacific Strike), or even 6 ! (Terminal Velocity). They are all very responsive (eg: even at low framerate, FPS can increase/decrease quickly) but also all unstable (eg: the decimals oscillate very quickly between multiple values, making it hard to read). Most of them use a 120Hz PIT Timer, some 60Hz. 560 Hz timer : if you go that way I would suggest that it's enabled using command line arguments or settings menu only. 560 Hz timer is probably going to be CPU expensive, especially on low hardware (386 and such). Timer callbacks usually do very little (eg: it increase a single variable) but in FastDoom it's doing a lot of things (eg: save/restore stack, loop trough tasks, ...). Using 560 Hz will make that part called 16 times more. It has to be tested on real hardware (since DOSBox is not cycle accurate). The best way to test this would be to compute the average of all frame times on a long demo, with a 35Hz timer and then later with 560Hz. |
Beta Was this translation helpful? Give feedback.
-
The refresh rate of the FPS counter is quite low.
I think it could be improved, here is some ways :
FPS is how much items there is in the queue. It's possible to use a different time window (eg: 0.5 sec or 2 sec), you just need to multiply/divide FPS by some constant. Here is an implementation example.
smoothFrametime = (smoothFrametime * 95 + frametime * 5) / 100
I used the first technique in one of my projects and it give good results. The two first solution are frame rates independent (the way they smooth out values is not impacted by FPS). The two last solutions are frame rate dependent (they will take more time to rise / fall at low FPS vs high FPS).
Beta Was this translation helpful? Give feedback.
All reactions