Differences between browser and exe

When running my game the browser requires ~600MB memory and limits the GPU to ~15%
(Tested on chrome, edge and firefox)

When running the exe the game requires ~60MB but dosen’t limit the GPU that is used for the shader, resulting in 100% GPU usage. (Without shader the GPU usage is ~5.5%)

  1. The HTML version looked just as good as the exe (with shader), but used 15% of the GPU. How do you limit GPU usage?

  2. Why does the browser require 10x more memory when running the same game?

  3. The HTML version ran worse (FPS), how do you improve that?

For 1 could you test a blank project with nothing in it and see the GPU usage? Try next adding some sprites with the builtin material and go from there to see if anything is spiking GPU usage.

The default HTML heap size is 256MB. You can set a custom size in the game.project file. Not sure why it would use so much extra MB but you could test that. Let us know! Try to enable the dev tools for HTML5 in the game.project too.

For 3 are you testing the debug engine or release engine in the browser? Debug engine will most certainly run slower.

Use a appmanifest to strip out extra parts of the engine too.

4 Likes

A blank Project takes ~300MB
Google takes ~75MB

When setting the heap size under 200MB on my Project it diden’t start at all. Changing the heap size did not affect the FPS at all.


The GPU usage was linked to the shader, just wondered why it took 100% on the exe but ~15% on the html. The shader affects the FPS much more on the exe build. On the html build the calculationes per second much slower for some reason and not the GPU.

A quick note on memory usage in desktop vs HTML5;

On HTML5 the all game content needs to be downloaded from the server to the client before it can be read/parsed. This means that during HTML5 startup, the webpage will first need to download a bunch of files from the server place them into JS memory (since due to the nature of browsers, it can’t store and read it from the local hard drive). The downloaded data will then be “parsed” and loaded by the engine to setup and create internal structures which will allocate some more memory.

The desktop version of Defold will load data directly from disk by memory mapping. In short this enabled the engine to avoid having to having all the game content in memory while it is being loaded/parsed.

4 Likes