High CPU Usage when lauching game via Editor

I have Windows 10 Laptop with i3 1115G4 processor and 4 GB Ram.

When launching game from editor, it is just using a big chunk of CPU.

I mean any project i open whether it is empty or with few assets.

** Dmegine** is constantly using about 35 to 41% of total CPU.
Hence causing overheat in Laptop.

Currently I am using 1.4.7 version.

Thank You.

1 Like

I can think of two reasons:

  1. Your project is configured to run through frame updates as fast as possible, ie vsync is disabled and no cap on update frequency.
  2. When you run Project->Build from the editor you get a debug build. This debug build is broadcasting network presence so that the editor can detect it and it has the profiler enabled. Do you get the same behaviour in a release bundle?
1 Like

I tried this code in one of the game scripts .

sys.set_update_frequency(2) ----> Set game to 2 fps

I was getting 2 frames per second but even then I am getting 40 % CPU usage.

And what kind of CPU usage are you getting from a release build? Around 35-40%?

Yes, I also exported Pixel Platformer Project as Windows Exe.

Exported project also using 35 to 40% CPU Constantly.

Perhaps someone else here on the forum can share the CPU usage when running a Defold build on Windows?

I just started a new project using the Pixel Platformer sample as a template and hit Ctrl+B to run with no changes to the project. I get 14-16% CPU usage on an 11900K as it runs with the bee bouncing up and down.

These are results when I exported "Pixel Platformer " demo for 32 bit Machine ( on 64 version CPU usage is slightly high and constant in between 35 to 39 %)

  1. Chose these settings

  1. Exported the project

  1. CPU usage even when am not not moving

Was it constantly in between 14-16% ?

Have you made other projects in Defold ? Isn’t this usage much for a platformer game ?

Don’t mind me if I am annoying you I am very new in programming and game dev :sweat_smile: :sweat_smile: :sweat_smile:

I just exported a Windows build using the same settings you did in your screenshot, release, 32 bit, with debug symbols, texture compression enabled, etc. I get 12.5% steady on the process not moving.

I picked a random project in my list that I could quickly open and run. Britzl’s defold-orthographic master branch cloned from github. The “all features” option in the example project runs at 3% CPU just as a debug build running under dmengine.exe process.

I can’t speak for other games, as I’ve never really had to pay this any attention or needed a release build before. I am also new to game dev.

Edit: I went ahead and bundled the defold-orthographic example project using the same build settings. Moving the guy around and the camera and stuff, I still get 3% CPU usage. It does seem high on the pixel platformer example.

I don’t think you should include debug symbols in a release build, but I don’t think that is the cause of the high CPU usage here. But it’s worth mentioning. Someone please correct me if I’m wrong.

1 Like

IDK if you are using a Laptop or a PC, But when I am working on my machine and testing my ( ctrl + B ) game then temperature is going high very soon. ( I have a Laptop ).

At this rate, I am not sure that if the size of the game increases, then the CPU usage will be affected or not.

I’m on a PC; the CPU is pretty decent and cooled well. I have 8 cores and 16 logical processors, so it is basically maxing out two of those threads as it runs. There is a difference in performance between our CPUs of about 103%.

The usage may be normal for your CPU, but someone else with more experience with the engine than me should advise.

So I diffed the project settings file between the two projects I mentioned. Several lines were different, but these jumped out at me:

vsync = 0
update_frequency = 60

I reset these to defaults and CPU usage is normal now. Notably, these settings are in the pixel platformer template like this. Try to reset those in the project settings by clicking the revert button (the circle arrow button). This removes them from the game.project file completely. You can search for these settings in the filter box, but they are under display.

Edit: what I meant to say above is that the pixel platformer template probably needs to be fixed.

could you please explain in detail how to do this. Britzl also mentioned it and it looks like I could not do it in right way.

In your project, double click the game.project file. Then navigate to Display on the left pane. Scroll down, and find these options. Click the revert button to reset them is usually the best thing to do.

As far as diffing the files, I used p4merge and drag/drop into the GUI since I don’t like CLIs. You can do that however you want. This tool just shows both files next to each other and highlights the differences by line.

image

1 Like

I’m not sure what the expectation is here?
I might point out that game engines in general don’t work like regular desktop applications, and Defold is no exception.
In short, he goal is to run as fast as possible, to have as smooth framerate as possible.

E.g. disabling vsync, is one way to make it run as fast as possible.
Try removing that variable (it’s deprecated, it’s equal to swap_interval = 0) to see if the project will ease up on the cpu usage.

2 Likes

You could also check for driver updates, check your power plan and switch to a non-saving plan (I’d try the default “balanced” first): https://www.intel.com/content/www/us/en/gaming/resources/how-to-fix-high-cpu-usage.html#:~:text=If%20a%20process%20is%20still,that%20cause%20increased%20CPU%20usage.

Personally, I’d look into the overheating at just 40% load. Do you get worryingly high temperatures or is it just that the fans start to spin? Maybe the fan/vents could do with a clean. I’d also add some ram to the system.

fully empty project

fully empty bundled project

and so on 2 laptops

win7 to win10

intel uhd610 - radeon r5

how to reduce load? changing the number of frames or turning off vertical sync - does not help

p/s driver latest version

1 Like

Yes, same case with me. I tried it in other mid end laptop as well ( i5 13th the gen 16 GB RAM)

Strain was about 10-18 % but constant…

When I tried on i3 550 PC processor strain was way more 55-65 % constant strain but no heat issue ( PC Fan ).

Heat sink in laptops is not as efficient as PCs

Please check the profiler to identify what is taking up the most time. My guess is that Vsync is the culprit