yairm210 / Unciv

Open-source Android/Desktop remake of Civ V

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FPS cap

trudnorx opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Game Version

4.11.4

Describe the bug

There seems to be no FPS cap option.
This leads to extremely high GPU usage and power waste, at least on Windows and on the main menu (did not test in-game).

Steps to Reproduce

Screenshots

No response

Link to save file

No response

Operating System

Windows

Additional Information

No response

Maybe I'm overreacting, maybe another dev will come and correct me but uh...

What the hell do you need an fps cap for? This is a 2d game that typically displays a flat screen. I wouldn't be surprised if it often is running at less than a frame per second. Is this an AI post or something real?

Now... Some optimization for ram or cpu usage I'd understand, but gpu usage should rarely be a factor

Game runs at unlimited FPS, therefore stressing GPU at very high levels even if the graphics the game draws are simple.
Need for FPS cap does not depend on graphical complexity.

So a quick double check on a machine with integrated graphics (Intel i5 10210U)
Building Unciv in Android Studio (more or less the control situation): about 2% gpu usage
Sitting on the main screen: a worrying 20% usage
New game screen: 2% usage
World screen of a new game: 30% usage immediately which drops to 2% usages. It rapidly increases to 20-30% when there's a screen update

Again, not my area of expertise, but it seems like

  1. Redrawing the world screen is surprisingly expensive (though I doubt is stressing things nearly as much as this issue implies). Probably worth looking into where to optimize
  2. The main screen does seem to redraw the world screen rapidly

Game runs at unlimited FPS, therefore stressing GPU at very high levels even if the graphics the game draws are simple. Need for FPS cap does not depend on graphical complexity.

2d graphics isn't a new concept. How to optimize it isn't that difficult and it shouldn't be expected that a frame limit would do... Anything. Typically, if you're sitting on a flat screen, most of the time most of the screen shouldn't even redraw with a particularly good graphics engine. Again. I'd bet in an actual game, you're often not getting too much more than 5 fps despite not having a frame cap because there's no reason the game would update the screen. An fps cap sounds extremely redundant in these cases. If this was a 2d game with constant movement (say, a platformer, or so), this might be a more notable concern. But this is a game where there shouldn't be an expectation that any screen updates more than once a second unless you're scrolling rapidly

Frame rate limiting is already in effect, fyi

Main screen at 20% - hmm, could be due to fade-in and face-out, we switch maps every X second to make things interesting

Main screen at 20% - hmm, could be due to fade-in and face-out, we switch maps every X second to make things interesting

Probably, though it seems to stay steady at that percentage which implies we're doing redraws even when we aren't fading

Gdx always runs on a loop re-rendering everything - it's here. On 'roid, it's different, but similar - there's gotta be somewhere where the Gdx Runnables are managed and the main render method is called...

Frame rate limiting is already in effect

Exactly - can be read at that first link. IIRC, you can't even turn it off to more than 60fps, but I may be wrong.

Yes, mapgen might be what eats cycles - but I suspect OpenGL forced to software rendering. Can we test that? Do we have something or could do something in SytemUtils.getSystemInfo()?