Dinhero21 / game-engine

Fully Open Source Game and Game Engine
0 stars 0 forks source link

Textures not loading #6

Open Dinhero21 opened 1 year ago

Dinhero21 commented 1 year ago

Sometimes, at random, textures simply decide they should not load. AssetLoader.getTexture returns a "bricked" HTMLImageElement, load and error events are never fired and the image never exists this "limbo" state. Clearing the cache does not seem to fix it as when a new image is created and assigned the URL of the "bricked" image it also gets "bricked". The devtools preview shows a missing image with everything apart from that seemingly normal. This issue seems to be impossible to replicate on Firefox but easily on Brave.

Dinhero21 commented 1 year ago

Something I just noticed is that the "bricked" texture has a warning in the Timing section of the Network devtools tab. See below:

image

Dinhero21 commented 1 year ago

It also seems like the texture has to be loaded "naturally" for it to be "bricked". Forcefully loading the texture by calling loader.getTexture does not seem to trigger the issue.

Dinhero21 commented 1 year ago

I would hypothesize that the problem is the server side being somehow overloaded by socket.io and/or the number of textures being fetched at once and not sending the texture properly. But if the issue was server side then it would not make sense for it to be browser-dependent, would it? Well actually maybe Firefox re-tries to get the image if it fails the first time explaining why the image will not "brick".