So i have exported my game to the Web, and noticed a lot of lags, currently the main thing i worry about is when i just opened the game and for example pressing shoot button, it takes some time before shoot (looks like it load something, but actually not, it’s just freezes for 0.2 sec and it’s not in-code await or something!).
Generally it have a lot of freezes / lags, i would like to know how to fix it.
The lags appears only when exporting for Web.
on PC this lag seems very small (in 4.2.1 it looks exactly like in browser)
[ Browser testing (.html) ]
I’m getting 28-35 fps from 60 needed on my laptop.
Also, tested on high-res screen → 24-27 / 60 fps
[ PC testing (.exe) ]
about 59/60 fps on laptop
about 50/60 fps on high-res screen
It’s not a such big game to have such lags, it’s not even a demo, it’s just an test run.
upd. What i have noticed is when i creating the bullet (not only bullet but any node stored in var) at first time it have that lag.
@onready var hit_point = preload("res://scenes/weapons/bullets/bullet_hit.tscn")
func shoot():
var hit = hit_point.instantiate()
var world = get_tree().get_root()
world.add_child(hit)
*lag here*
actually i have tried different versions, i always have this stuff on start…
even if i create it on start, on func _ready(), it will freeze when i need to create it manually later
is there way to really pre-load all the possible/used objects on start?
because this way it is not works really well i think: @onready var hit_point = preload("..")
in my opinion the code above must load the assets when game loading, but it works other way, and it’s sad
yeah, godot’s issue
i wanted to recommend other engine that’s far better just for making web games, but i dont think it’s allowed here lol
i merely using export to web just for easily accessible way of testing for many people, but not building actual game for web which godot’s web is not optimized. Memory Usage alone took over 220mb on chrome to run a single label project. other engine can do it less, a playable snake game with particles only needs on average 50mb space to run
I think i just need to find a way out of these lags, because changing engine is not an option for me actually. For example, Unity have very long and stressful loading/import and C# as main language which i hate as well.
So for now i will choose Godot, but not because it’s worth it, but because I’ve already come a very long way in developing my game on it.
Unfortunately, its developers are focusing on the the wrong things.
The most valuable thing is performance, which is smells bad in godot.
There was Construct 2 Engine that was like a god stuff for developing HTML games, but it supports making only 2D games, so what i want to say is i want Godot should be similar to Construct 2 but instead 2D made focus on 3D.