Grokmoo / sulis

Turn based tactical RPG with several campaigns, written in Rust
https://www.sulisgame.com
470 stars 29 forks source link

performance issue #202

Closed ghost closed 11 months ago

ghost commented 2 years ago

Hello. This game makes one of my cores at ~90% CPU on title screen, pushing my CPU to it's maximum frequency (and that makes the fan noisy). From what I can tell, the remaining percents are syscalls. I know it's only an early version, though, but I thought it's be useful to report this anyway.

For technical infos: running on Debian, Intel(R) Pentium(R) Gold G5500 CPU @ 3.80GHz, no dedicated GPU (and I can, ofc, run many games without any problem). Using the binary distributed by website.

Grokmoo commented 2 years ago

Thanks for the report, I appreciate it!

That's interesting. Can you find your sulis.log file (most likely in ~/.config/sulis/log on your system) and attach it to this issue?

The frame rate is capped at 60 fps by default. I have a machine that's actually quite a bit weaker than yours and CPU usage generally stays below 10% there. So definitely something strange going on.

ghost commented 2 years ago

Certainly sulis.log

I bet there's something strange here:

[2022-01-08 04:16:39.194927 +01:00] INFO [sulis_core/src/io/glium_adapter.rs:616] Rendered 167135 frames with total render time 114.8613 seconds

The number... It would mean 1466 frames per second! For a start, I doubt my system is able to do that, so the count feels wrong, and second, that's a bit too much :) At 60 FPS, it should be 6840 frames.

Grokmoo commented 2 years ago

I actually think that the frame rate number likely is accurate - it is rendering frames as fast as possible when it should be capped to 60 (by default). Hence, using up all of your CPU.

I'm not exactly sure how that could happen - can you also attach your config.yml file (most likely in ~/.config/sulis).

ghost commented 2 years ago

Compressed it becuase annoying github. Note that I didn't touched anything in config IIRC. config.tar.gz

Grokmoo commented 2 years ago

Thanks for your help. Unfortunately yes, those are the default settings so I am still guessing at what the problem might be. Will continue to think about it.

ghost commented 2 years ago

YW. If I can help more, feel free to ask, but I don't know anything about rust (if that was some C or C++, I could have provided a lot more info, because I know the toolchains well), so I can only help by reporting infos and testing.

Grokmoo commented 2 years ago

Pushed a potential fix for this in 099da3680fa31b704bfe405ca872ea2c51c90a36.

There also a change in winit that isn't yet in a release that could be impacting this: https://github.com/rust-windowing/winit/commit/0e52672f4aea376c3ef8a06b64aedca46a40e9b8 Will update the winit dependency once that is released.

ghost commented 2 years ago

Hello. Is there is a published release with that fix, so that I can test and (hopefully) close this issue? Sorry I was rarely present on github those months (and it's not going to improve, but at least I want to see issues I've opened closed when possible).

stop5 commented 2 years ago

i build the master branch and have currently an fps of 171, the 0.6.0 binaries had an fps of over 200 on my notebook

ghost commented 1 year ago

Sorry for that (and not having checked out earlier), but apparently when I run the game I still do not have a 60 FpS, but rather a several hundreds of those, making CPU run at full speed.

Grokmoo commented 1 year ago

Thanks so much for checking into this after all this time. I will take another look.

johnlauder commented 11 months ago

I've got a linux laptop with an integrated intel gpu and a dedicated nvidia gpu. I enabled vsync in glium and my framerate drop from ~300 to 60. I've submitted a PR with the change, can't test it on windows or any other devices though.

Grokmoo commented 11 months ago

Fixed in e71fbee3489e8c1cc6f560ea2c1608da9244f4dd