Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPS cap #11469

Open
1 task done
trudnorx opened this issue Apr 13, 2024 · 7 comments
Open
1 task done

FPS cap #11469

trudnorx opened this issue Apr 13, 2024 · 7 comments
Labels

Comments

@trudnorx
Copy link

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

@trudnorx trudnorx added the bug label Apr 13, 2024
@SeventhM
Copy link
Collaborator

SeventhM commented Apr 13, 2024

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

@trudnorx
Copy link
Author

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.

@SeventhM
Copy link
Collaborator

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

@yairm210
Copy link
Owner

Frame rate limiting is already in effect, fyi

@yairm210
Copy link
Owner

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

@SeventhM
Copy link
Collaborator

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

@SomeTroglodyte
Copy link
Collaborator

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()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants