I’ve had a bug in my project for a while. If I download my game as a ZIP and publish it on Firebase Hosting, then navigate to it in Chrome it would sometimes freeze on startup. I get a 200 OK response, but there are no files retrieved showing in the DevTools in Chrome, and the page loads indefinitely without showing anything.
For quite a long time I thought it was just my (fairly large) project acting up, so I tried reproducing the problem in a blank project. And strangely enough, the freeze still happens. It doesn’t happen every time, but it’s possible to reproduce at almost 100% repro rate with the correct repro steps.
Steps to reproduce:
- Create empty PlayCanvas project
- Download a .zip file of the project (either through the editor button or the rest api, I tried both)
- Unzip and deploy to Vercel/Firebase Hosting
- (only needed once) Navigate to the URL once in Chrome (so that the page will be “suggested” in the address bar dropdown in Chrome)
- Navigate to the URL using the “suggested” dropdown that appears when typing a URL in the address bar in Chrome
This has a near 100% repro rate of the freeze.
For some reason I figured the freeze was due to the hosting at Firebase Hosting, so I migrated the project to Vercel. The problem persisted. Just to be sure I tried hosting the project at a third server, which just had a simple FTP upload and public_html folder. The problem still persisted. However, I do not get the problem if I use the “Publish to PlayCanvas” option in the editor. That deploys the build to AmazonS3 I believe, but the sourcecode is not identical to that of a downloaded zip build.
I use the latest engine (2.8.2), but just to be sure I tried using an older version of the engine, 1.77-something. The problem still persisted.
As I have been debugging I’ve realized it’s in the initialization of the engine that something goes wrong. I even narrowed it down to the creation of the render device. If I create the render device, the freeze happens, if I skip creating the render device (and return a dummy device) the freeze never happens.
I haven’t been able to reproduce this problem in any other browser than Chrome. So this made me think that Chrome might have a bug or my version is outdated. So I updated Chrome to latest version. The problem persists.
I also figured that the problem might be related to my personal setup, so I tried on another PC. The problem persists.
I figured it might be Windows/PC related, so I tried on an Android phone. The problem persists.
I figured it might be driver issues, so I updated my NVIDIA drivers to latest. The problem persists.
Since I narrowed the freeze down to a specific line related to creating the graphics device (more specifically this line in __ start __.js:159 createGraphicsDevice() pc.createGraphicsDevice(canvas, gfxOptions).then((device) => {
I figured it was related to the graphics device I’m using. So I tried changing the project to use WebGPU (instead of WebGL 2.0). That did in fact remove the freeze. However I don’t want to force my project to be run on WebGPU.
TL;DR - The things I’ve tried:
- Large project & empty project - Problem persists
- Download zip through editor & through REST api - Problem persists
- Download zip and publish & “Publish to PlayCanvas” - Problem only appears on zip published builds
- Different hosting (Firebase/Vercel/rawdogging) - Problem persists
- Old (v1) engine & new (v2) engine - Problem persists
- Chrome & Edge/Firefox - Problem only appears in Chrome
- Windows/PC & Android - Problem persists
- Old graphics driver & updated graphics drivers - Problem persists
- Different PCs & different phones - Problem persists
- WebGL 2.0 & WebGPU - Problem only appears in WebGL
For anyone who is interested in reproducing the problem, here is my Vercel deployed empty project:
https://executive-golf-dev.vercel.app/
For anyone who is interested in taking my empty project and downloading a zip to deploy to your favourite hosting site (you can of course just create your own empty project to be sure it’s really empty):
https://playcanvas.com/project/1361558/overview/debugging-project
Bonus - for anyone who actually read this far, you can play an early version of my actual project here:
https://executive.golf
I’m currently at a loss. Any input on how to solve the issue is highly appreciated.