Patch to cache rendered backgrounds for better FPS.

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Iamnotalice
Space Krill
Posts: 3
Joined: Thu Jan 11, 2018 7:34 am

Patch to cache rendered backgrounds for better FPS.

#1 Post by Iamnotalice »

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

[The extension diff has been deactivated and can no longer be displayed.]


User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Patch to cache rendered backgrounds for better FPS.

#2 Post by Geoff the Medio »

What is "the background" ?

Iamnotalice
Space Krill
Posts: 3
Joined: Thu Jan 11, 2018 7:34 am

Re: Patch to cache rendered backgrounds for better FPS.

#3 Post by Iamnotalice »

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

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Patch to cache rendered backgrounds for better FPS.

#4 Post by Geoff the Medio »

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

Iamnotalice
Space Krill
Posts: 3
Joined: Thu Jan 11, 2018 7:34 am

Re: Patch to cache rendered backgrounds for better FPS.

#5 Post by Iamnotalice »

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.)

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Patch to cache rendered backgrounds for better FPS.

#6 Post by Geoff the Medio »

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

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Patch to cache rendered backgrounds for better FPS.

#7 Post by Vezzra »

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

Post Reply