How to gain FPS
I would like to make a comment about fps higher than the monitor refresh rate and the wasted rendering.
I have programmed on the x86 but nothing as complex as armagetron but I have programmed simpler systems like the amiga and genesis (I like 68k).
They way I do things is to have dual display buffers and a vsync interrupt with the main program doing the game calculations in a loop the way armagetron currently does.
The vsync interrupt does the following
1) switch the display buffer address (or copy buffer to screen if address switch is not possible)
2) disable vsync interrupt*
3) clear and render once into the undisplayed buffer
4) enable vsync interrupt
This reduces cpu load and gives a tear free display at the maximum display fps.
*Disable the vsync interrupt before rendering to make sure it is not interrupted while rendering on slow computers which would cause a major stack problem, this will automatically frameskip if rendering takes longer than 1 frame time.
This works for other systems and should work for armagetron as long as you can get a vsync interrupt or a timer interrupt syncronized to the vsync.
I have programmed on the x86 but nothing as complex as armagetron but I have programmed simpler systems like the amiga and genesis (I like 68k).
They way I do things is to have dual display buffers and a vsync interrupt with the main program doing the game calculations in a loop the way armagetron currently does.
The vsync interrupt does the following
1) switch the display buffer address (or copy buffer to screen if address switch is not possible)
2) disable vsync interrupt*
3) clear and render once into the undisplayed buffer
4) enable vsync interrupt
This reduces cpu load and gives a tear free display at the maximum display fps.
*Disable the vsync interrupt before rendering to make sure it is not interrupted while rendering on slow computers which would cause a major stack problem, this will automatically frameskip if rendering takes longer than 1 frame time.
This works for other systems and should work for armagetron as long as you can get a vsync interrupt or a timer interrupt syncronized to the vsync.
Writing code is easy. Finishing is hard.
Small flaw there: the vsync interrupt isn't available, at least not to userspace programs. All we can do is push our stuff to the GPU, tell it to swap buffers, and wait for completion. If it's configured to wait for the vsync, it'll do that; if not, it won't. On trunk versions, we tell the GPU to wait, but there's no one generic interface for that, so it doesn't always work. Plus, these people here WANT to waste frames.
Thats a shame it works so well on other systems.Z-Man wrote:Small flaw there: the vsync interrupt isn't available, at least not to userspace programs. All we can do is push our stuff to the GPU, tell it to swap buffers, and wait for completion. If it's configured to wait for the vsync, it'll do that; if not, it won't. On trunk versions, we tell the GPU to wait, but there's no one generic interface for that, so it doesn't always work.
I cant understand why people here would want to waste time rendering extra frames ?Z-Man wrote:Plus, these people here WANT to waste frames.
As long as the main program is reading/writing the network and doing calculations at the fastest possible rate (1000+ times per second, what ever your cpu can manage) then thats all you need for a smooth game
Rendering more frames than your display can handle (say 60fps) is just a complete waste of resources and only serves to slow down the game.
Last edited by rumpole on Sat Mar 14, 2009 3:29 pm, edited 1 time in total.
Writing code is easy. Finishing is hard.
Not particularly, from my end anyways. It was merely an experiment to see what frame rate my computer was capable of producing compared to my old one. 10x the amount of frames was futile yes, but also interesting. Unfortunately, none of my efforts have been able to place it back into the 60 frames per second range again. Whatever I unlocked is not what I thought I unlocked apparently. Needless to say, my next time wasting area is to figure out exactly what I did.Plus, these people here WANT to waste frames.