FreeOrion
http://www.freeorion.org/forum/

Patch to cache rendered backgrounds for better FPS.
http://www.freeorion.org/forum/viewtopic.php?f=9&t=10851
Page 1 of 1

Author:  Iamnotalice [ Thu Jan 11, 2018 8:17 am ]
Post subject:  Patch to cache rendered backgrounds for better FPS.

This patch adds an option to render the background to a texture so it doesn't need to be rerendered every frame. On my system it brings a massive improvement in FPS - I have a 1600-star universe that is ~4FPS on my machine using normal settings, ~12FPS with my patch.

Bugs in my patch:
- It currently only updates the background after you resize the window or move the galaxy map coordinates, not after turn advance.
- There is some entertaining visual glitching when dragging the galaxy map around (and the framerate drops back down).
- There is also visual glitching when the game is defocused.
- The preference to toggle background caching doesn't have a proper label.
- Visibility circles are a bit of a mess - the OpenGL docs say the framebuffer objects don't have a stencil buffer or something?

Other weaknesses:
- I don't know OpenGL or C++, so my code may not be very good.
- I haven't tested it on anything but Debian.

Attachments:
freeorion-background-cache.diff [11.22 KiB]
Downloaded 14 times

Author:  Geoff the Medio [ Thu Jan 11, 2018 8:28 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

What is "the background" ?

Author:  Iamnotalice [ Thu Jan 11, 2018 9:49 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

The galaxy map, with associated starlanes/molecular clouds/systems/visibility range circles.

Author:  Geoff the Medio [ Thu Jan 11, 2018 9:59 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

If there are major graphical artifacts are a result, the patch is probably not acceptable...

Author:  Iamnotalice [ Thu Jan 11, 2018 10:22 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

Expected as much; the point of posting it was to see if it's worth taking the time to polish it up. (AFAICT fixing the glitches shouldn't bring back the performance hit, but figuring out how will take me a while.)

Author:  Geoff the Medio [ Thu Jan 11, 2018 10:34 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

If you can make it work mostly without glitches, then it could be useful.

Author:  Vezzra [ Sun Jan 14, 2018 10:49 am ]
Post subject:  Re: Patch to cache rendered backgrounds for better FPS.

@Iamnotalice, it would be preferable if you provide your patches as PRs on our github repo.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/