egofree
 Joined: Jun 2013
Posts: 601
|
 |
Posted on: June 25, 2013, 04:00:37 PM |
|
|
|
As i am developing a game, i am trying to optimize the code. I did some tests, but i found that even with the most simple project possible (one sprite, one object, a room with one object, no code, no special events) the CPU use is 13 % ! As i use a rather powerful computer with an Intel Core i7 CPU and with 16 GB of memory this seems to me a little bit overkill. I tried the same project with GM 8.1 and the CPU use is not significant. What do you think ?
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
Reply #1 Posted on: June 25, 2013, 04:09:03 PM |
|
|
|
What's your GL support look like? It's possible something is being done software side which should not be. Also, what is the room speed of your game? High room speeds mean high CPU usage, just by virtue of doing something many times per second.
|
|
|
egofree
 Joined: Jun 2013
Posts: 601
|
 |
Reply #2 Posted on: June 25, 2013, 04:40:02 PM |
|
|
|
I am using the latest drivers from NVIDIA for my GTX 660 card. As far as i understand the Open GL drivers are included in these drivers. The room speed is the default one : 30. I am running Windows 7 64 bits. I tried to edit the ENIGMA settings and to use DirectX 10.0 instead, but the compilation crashes. I've DirectX 11.0 installed on my computer.
|
|
|
Goombert
 Joined: Jan 2013
Posts: 2,991
|
 |
Reply #3 Posted on: June 25, 2013, 05:14:34 PM |
|
|
|
egofree, theres a reason for that, we don't have DirectX ^_^
|
|
|
egofree
 Joined: Jun 2013
Posts: 601
|
 |
Reply #4 Posted on: June 25, 2013, 05:53:50 PM |
|
|
Quote from: Robert B Colton on June 25, 2013, 05:14:34 PM egofree, theres a reason for that, we don't have DirectX ^_^
Yes, i know there is no DirectX on linux  . But still a lot users are using Windows, and i am afraid that if you need a powerful computer on Windows to run ENIGMA games, it will hinder its success  I am still using Windows because it's convenient if you want to run mainstream games, but i hate the new Windows 8 with Modern UI and i really hope linux will get more and more success in the future.
|
|
|
TheExDeus
 Joined: Apr 2008
Posts: 1,860
|
 |
Reply #5 Posted on: June 25, 2013, 06:27:10 PM |
|
|
|
Empty games usually use more CPU. Just like the most intensive part of SC2 was the menu (where there was a sphere rendered). The same here. Your GPU has nothing to do so the CPU boost to the max. It shouldn't really happen at 30FPS though. I previously found a problem that having the room_speed set over the max CPU/GPU can handle, then CPU will spike to 100% (for the one core it runs on), you lower the FPS by 1 (like 61 to 60) and it falls to 0%. We need a more intelligent system which would run in the background and monitor and change the performance. Although VSYNC and adaptive vsync (which we should implement, it's the same function like we have now, but with -1 set instead) it usually doesn't happen.
And I just tested with one animated sprite with one object and in one room with default 30fps. I get 0-1% CPU load. I also have i7, 16gigs of RAM and 660TI. So it could be something else on your side. Is something else using the CPU? As I said, it seems to use a lot of CPU when it can't catch up. So if you can't easily render 30FPS because of some massive processes, then the game could just up in CPU usage. It seems like a devilish circle, but for now I don't know what can be changed. For me that happens when I render over 300FPS (or more) in the 1mil cube demo.
edit: Also I though we had a memory leak because ram usage kept increasing from about 18mb on startup to about 20mb after about 1 minute. Then it stabilized though. I don't think we cache anything so it seems weird.
|
|
|
egofree
 Joined: Jun 2013
Posts: 601
|
 |
Reply #6 Posted on: June 25, 2013, 07:28:03 PM |
|
|
Quote from: TheExDeus on June 25, 2013, 06:27:10 PM Is something else using the CPU?
No, in the tasks manager, i see nothing unusual for others processes. Well, i don't know what is the problem for the moment. We will see. It would be interesting to know if others windows users have the same problem, or i am the only one.
|
|
|
|
|
|
|
TheExDeus
 Joined: Apr 2008
Posts: 1,860
|
 |
Reply #9 Posted on: July 03, 2013, 01:42:12 PM |
|
|
|
I doubt DirectX would change anything. It just happens that for some hardware/software combinations stuff like that happens. I doubt the CPU use would increase even if the room wasn't empty. Just like when people cried that GM games are 2mb even when just having 1 empty room, but when you make the game it usually grows to only 4mb. So it's hard to tell why it shows 13% CPU load, but it's possible the load wouldn't change with a basic game. Maybe now something has changed? Like downloaded newer drivers or installed/uninstalled something and it shows a different load now?
|
|
|
egofree
 Joined: Jun 2013
Posts: 601
|
 |
Reply #10 Posted on: July 03, 2013, 04:00:33 PM |
|
|
Quote from: TheExDeus on July 03, 2013, 01:42:12 PM Maybe now something has changed? Like downloaded newer drivers or installed/uninstalled something and it shows a different load now?
I've installed the latest drivers from Nvidia today (320.49), and the result is the same.
|
|
|
egofree
 Joined: Jun 2013
Posts: 601
|
 |
Reply #11 Posted on: July 03, 2013, 04:01:59 PM |
|
|
Quote from: TheExDeus on July 03, 2013, 01:42:12 PM I doubt DirectX would change anything.
I don't know, but i heard that the support of Open GL on Windows is not good. That's why i was thinking about DirectX.
|
|
|
TheExDeus
 Joined: Apr 2008
Posts: 1,860
|
 |
Reply #12 Posted on: July 03, 2013, 07:31:59 PM |
|
|
Well anything is possible, but CPU load shouldn't be changed by the graphics system. Maybe some more detailed profiling is possible to see what exactly the game is doing on the CPU. Looking at this thread http://social.msdn.microsoft.com/Forums/vstudio/en-US/ef38c900-f2e2-4ae7-8e03-2a3941805aa3/profiling-what-code-causes-high-cpu-usage even the most basic timer profiling could do the trick. You could check which function executes the longest and thus see why it shows that CPU usage at 13%. In that case it is possible that the some GL function (like GL swap buffers or something) cause a stall which takes a larger amount of time and thus shows up as higher CPU usage (while in reality CPU was just waiting). Try turning off the background in room, if that doesn't show anything then set automatic redrawing to false. I don't think "Sleep on minimize" thing is implemented, but if it is then try that as well.
|
|
|
Goombert
 Joined: Jan 2013
Posts: 2,991
|
 |
Reply #13 Posted on: July 03, 2013, 08:05:07 PM |
|
|
|
Harri, forthevins update timer takes into account wherever you are rendering things or not, and tries to pick a suitable CPU usage.
|
|
|
TheExDeus
 Joined: Apr 2008
Posts: 1,860
|
 |
Reply #14 Posted on: July 03, 2013, 09:49:31 PM |
|
|
|
But the timer works between frames, I am thinking something goes wrong during the rendering (or as nothing is really rendered, then the buffer flipping). Still, profiling can be done and checked why it consumes CPU like that. I have almost identical PC to him and I don't have that problem. I still think he should also try some games or example to check if CPU usage actually increases. Maybe because of some compatibility problems the 13% will be the default and additional computation will not really increase that.
|
|
|
|