So I exported my project as HTML5 and uploaded it to itch, setting it so that it plays embedded in the browser, and it lags, a ton. (I'm getting like 5 fps)

I'm fairly confident it's not a problem with code, because when I uploaded a nearly empty test project the lag is still there.

As for settings, I have almost everything on default (project setting's window stuff, HTML export settings stuff all on default). For the itch side of things I have everything on default except for the viewport size which is 1600x900 (same as project setting)

Any clue on how to fix the lag? what more information should I provide?

  • Well GLES2 is supposed to be the better option for the web. If it's already laggy in a simple test program, than it's very likely that either your hardware is too low spec or your Browser isn't configured correctly. Browsers tend to have an hardware acceleration option in their settings menu. Try enabling it. If it's already turned on, try turning it off. Browsers can be weird in that regard.

    Otherwise try going with a lower viewport resolution for your game, like 800x450. 1600x900 may be to costly for your Browser.
    Aside from that avoid dynamic lighting if you have any of that. Reduce drawcalls by using MultiMeshInstances, Tilemaps, etc. But I guess you've done all that already with your test program.

Is it a 2D or 3D game? It's pretty normal for an HTML5 export to be more laggy than running the game in the editor/as an exe. There are many systems in place to interpret the code in the browser and make it therefore runnable. It will put a lot of extra strain on your own machine too. A game that runs on your machine natively may not run in your browser. Have you tried changing the renderer to GLES2/GLES3? Does it change anything for you?

    MartinSenges it's 2D, and I exported while in GLE2, will try GLE3 in a minute

    Update: still incredibly laggy in GLE3 >_<

    Well GLES2 is supposed to be the better option for the web. If it's already laggy in a simple test program, than it's very likely that either your hardware is too low spec or your Browser isn't configured correctly. Browsers tend to have an hardware acceleration option in their settings menu. Try enabling it. If it's already turned on, try turning it off. Browsers can be weird in that regard.

    Otherwise try going with a lower viewport resolution for your game, like 800x450. 1600x900 may be to costly for your Browser.
    Aside from that avoid dynamic lighting if you have any of that. Reduce drawcalls by using MultiMeshInstances, Tilemaps, etc. But I guess you've done all that already with your test program.

      MartinSenges It was hardware acceleration in browser settings, thanks for the tip!