Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag spikes after exporting to the Web #86913

Closed
mirodorr192 opened this issue Jan 7, 2024 · 10 comments
Closed

Lag spikes after exporting to the Web #86913

mirodorr192 opened this issue Jan 7, 2024 · 10 comments

Comments

@mirodorr192
Copy link

mirodorr192 commented Jan 7, 2024

Tested versions

4.1.3 / 4.2.1

System information

Windows 10, Compatibility mode

Issue description

### FIXED! Just ported to Unity and it works great!

For some reason, when i have exported my project as HTML, i have noticed a lot of lags, especially when instantiating a new objects and adding them as childs using add_child.

Tried to show it here:
Animation

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 (but in 4.2.1 it looks exactly like in browser)

  • i'm NOT using any shaders at all here!

[ Browser testing (.html) ]
I'm getting 28-35 fps from 60 needed on my laptop.
Also, tested on high-res screen -> 22-24 / 60 fps

[ PC testing (.exe) ]
about 55/60 fps on laptop
about 40/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*

Steps to reproduce

  1. create a new project
  2. export to web (html)
  3. open the game and try to create a new object on scene (using add_child)

Minimal reproduction project (MRP)

no need, it works the same for all of my projects

@Mickeon
Copy link
Contributor

Mickeon commented Jan 7, 2024

What browser are you testing these on? To my dismay, it makes a huge difference.

@mirodorr192

This comment was marked as abuse.

@mirodorr192

This comment was marked as abuse.

@AThousandShips AThousandShips changed the title Spike lags after exporting to the Web Lag spikes after exporting to the Web Jan 7, 2024
@mirodorr192

This comment was marked as abuse.

@AThousandShips
Copy link
Member

AThousandShips commented Jan 7, 2024

I corrected it to the normal English phrase, "spike lags" isn't a phrase in English. No one will be confused by a commonly used term being used 🙂

Please be constructive and positive, see the code of conduct.

@mirodorr192

This comment was marked as abuse.

@AThousandShips
Copy link
Member

Please be professional and bringing my profile and my views into this is neither professional nor appropriate, keep on topic and be mature, read the code of conduct

Have a nice day

@Calinou
Copy link
Member

Calinou commented Jan 9, 2024

This is standard shader compilation stutter, which is already being tracked in #61233 (and #86731 for Compatibility specifically). It's more pronounced on the web platform because most browsers go through ANGLE to translate OpenGL to Direct3D (on Windows) or Metal (on macOS).

You need to instance your objects to be visible in front of the camera for a single frame, so that the shader is compiled in advance, rather than during gameplay. The same applies to particle effects, etc.

@mirodorr192

This comment was marked as abuse.

@akien-mga
Copy link
Member

constructive and positive

just seen your github profile description..

I consider this to be a clear breach of our Code of Conduct, both from @mirodorr192 and from the (apparently sockpuppet account, already deleted by GitHub) @raceh25857 who upvoted it.

So this results in a ban. Have a nice further gamedev journey, aim to be more respectful of your peers.

@godotengine godotengine locked and limited conversation to collaborators Jan 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants