js13k2019-yet-another-doom-clone icon indicating copy to clipboard operation
js13k2019-yet-another-doom-clone copied to clipboard

Black screen with sound

Open shureek opened this issue 4 years ago • 10 comments

The game is not working on my PC.

I've cloned it on my Windows 10 and opened with Vivaldi browser (also tried FireFox, IE and Edge). After titles and loading it just shows black screen, but the sound is working so the problem is in video.

Browser console shows:

audio.js:20 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ audio.js:20
webgl.js:398 [Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
(anonymous) @ webgl.js:398
setup @ webgl.js:395
setTimeout (async)
window.onload @ webgl.js:407
load (async)
(anonymous) @ webgl.js:407
graphics.js:111 C:\fakepath(182,24-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(90,1): warning X4000: use of potentially uninitialized variable (f_get_shader)
C:\fakepath(114,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

Warning: D3D shader compilation failed with default flags. (ps_5_0)
 Retrying with skip validation
C:\fakepath(182,24-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(90,1): warning X4000: use of potentially uninitialized variable (f_get_shader)
C:\fakepath(114,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

Warning: D3D shader compilation failed with skip validation flags. (ps_5_0)
 Retrying with skip optimization
C:\fakepath(133,7-53): error X3531: can't unroll loops marked with loop attribute

C:\fakepath(133,7-53): error X3511: forced to unroll loop, but unrolling failed.

Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0)

Failed to create D3D Shaders

shureek avatar Jun 18 '20 17:06 shureek

Looks like it's an issue with the shader not working cross-platform. I don't have access to a Win10 machine making it somewhat difficult to debug

My theory is that the dynamic texture lookups are failing in my get_shader function. I'll see if I can get some way to test this.

carlini avatar Jun 18 '20 20:06 carlini

Okay I've tried to debug and I can't reproduce this. I'm running a Win10 VM.

I can either find some browsers where webgl2 doesn't load entirely, or on the latest Edge/Chrome everything works properly.

If you (or anyone who sees this) has additional reproduction information I'm going to need some help getting it to crash on windows.

carlini avatar Jul 06 '20 18:07 carlini

I am not sure if this is related, but I am running Windows 10 and using Google Chome latest version. I am stuck at a black screen at the start. image

ya332 avatar Jul 10 '20 17:07 ya332

Ah yeah. That definitely looks like a related bug. A few questions if you can

  • Are you opening doom.html, or running the build script?

  • Can you paste the developer console error messages? (control+shift+c, console, and reload the page)

  • In the developer console, can you run["webgl", "webgl2", "2d"].map(x=> document.createElement("canvas").getContext(x))?

carlini avatar Jul 10 '20 19:07 carlini

I am running it on this website. https://nicholas.carlini.com/writing/2019/javascript-doom-clone-game.html

javascript-doom-clone-game.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
(anonymous) @ javascript-doom-clone-game.js:1
content.bundle.js:6 runtime.onMessageExternal is not supported
t.default @ content.bundle.js:6
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:38
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:30
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
content.bundle.js:6 runtime.onConnectExternal is not supported
t.default @ content.bundle.js:6
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:38
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:30
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
DevTools failed to load SourceMap: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/include.postload.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
content.bundle.js:6 Uncaught (in promise) Error: You must pass a `userId` or `anonymousId` key
    at Object.t.default (content.bundle.js:6)
    at t.identify (content.bundle.js:6)
    at content.bundle.js:1
t.default @ content.bundle.js:6
t.identify @ content.bundle.js:6
(anonymous) @ content.bundle.js:1
Promise.then (async)
(anonymous) @ content.bundle.js:1
u @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:6
o.persist @ content.bundle.js:1
m @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:38
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:30
t @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
(anonymous) @ content.bundle.js:1
javascript-doom-clone-game.js:1 [Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
(anonymous) @ javascript-doom-clone-game.js:1
Ci @ javascript-doom-clone-game.js:1
setTimeout (async)
window.onload @ javascript-doom-clone-game.js:1
load (async)
(anonymous) @ javascript-doom-clone-game.js:1
43javascript-doom-clone-game.js:1 WebGL: INVALID_OPERATION: getAttribLocation: program not linked
(anonymous) @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
W @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
oi @ javascript-doom-clone-game.js:1
Ci @ javascript-doom-clone-game.js:1
setTimeout (async)
window.onload @ javascript-doom-clone-game.js:1
load (async)
(anonymous) @ javascript-doom-clone-game.js:1
213javascript-doom-clone-game.js:1 WebGL: INVALID_OPERATION: getUniformLocation: program not linked
(anonymous) @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
W @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
oi @ javascript-doom-clone-game.js:1
Ci @ javascript-doom-clone-game.js:1
setTimeout (async)
window.onload @ javascript-doom-clone-game.js:1
load (async)
(anonymous) @ javascript-doom-clone-game.js:1
javascript-doom-clone-game.js:1 WebGL: too many errors, no more errors will be reported to the console for this context.
(anonymous) @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
W @ javascript-doom-clone-game.js:1
(anonymous) @ javascript-doom-clone-game.js:1
oi @ javascript-doom-clone-game.js:1
Ci @ javascript-doom-clone-game.js:1
setTimeout (async)
window.onload @ javascript-doom-clone-game.js:1
load (async)
(anonymous) @ javascript-doom-clone-game.js:1
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 3723ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 1570ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 2217ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 3298ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 1233ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 4206ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 893ms
javascript-doom-clone-game.js:1 [Violation] 'setTimeout' handler took 210ms

This is what I get when I run the command:

["webgl", "webgl2", "2d"].map(x=> document.createElement("canvas").getContext(x))
(3) [WebGLRenderingContext, WebGL2RenderingContext, CanvasRenderingContext2D]
0: WebGLRenderingContextcanvas: canvasdrawingBufferHeight: 
150drawingBufferWidth: 300
__proto__: WebGLRenderingContext1: WebGL2RenderingContextcanvas: canvasdrawingBufferHeight: 150drawingBufferWidth: 300__proto__: WebGL2RenderingContext2: CanvasRenderingContext2Dcanvas: canvasdirection: "ltr"fillStyle: "#000000"filter: "none"font: "10px sans-serif"globalAlpha: 1globalCompositeOperation: "source-over"imageSmoothingEnabled: trueimageSmoothingQuality: "low"lineCap: "butt"lineDashOffset: 0lineJoin: "miter"lineWidth: 1miterLimit: 10shadowBlur: 0shadowColor: "rgba(0, 0, 0, 0)"shadowOffsetX: 0shadowOffsetY: 0strokeStyle: "#000000"textAlign: "start"textBaseline: "alphabetic"__proto__: CanvasRenderingContext2Dlength: 3__proto__: Array(0)

ya332 avatar Jul 10 '20 20:07 ya332

Hm. Okay, thanks. Definitely looks like the same bug.

If you go to this page, I expect it to crash still, but have a more informative error, if you could just copy the error message back:

http://nicholas.carlini.com/tmp/doom.html

carlini avatar Jul 11 '20 00:07 carlini

It still. crashes Here is the copy-pasta from console when it crashes.

doom.html:4024 [Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.
(anonymous) @ doom.html:4024
doom.html:1022 C:\fakepath(182,24-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(90,1): warning X4000: use of potentially uninitialized variable (f_get_shader)
C:\fakepath(114,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

Warning: D3D shader compilation failed with default flags. (ps_5_0)
 Retrying with skip validation
C:\fakepath(182,24-54): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(90,1): warning X4000: use of potentially uninitialized variable (f_get_shader)
C:\fakepath(114,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

Warning: D3D shader compilation failed with skip validation flags. (ps_5_0)
 Retrying with skip optimization
C:\fakepath(133,7-53): error X3531: can't unroll loops marked with loop attribute

C:\fakepath(133,7-53): error X3511: forced to unroll loop, but unrolling failed.

Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0)

Failed to create D3D Shaders

I will try to build from the source code at some point if I have time over the weekend. We will see. Thank you so much Dr. Carlini. huge fan of your work.

ya332 avatar Jul 11 '20 01:07 ya332

I expect building from source will also crash. This looks like the same bug as earlier. Thanks for helping me take a look.

I'll go and find a real native Win10 machine somewhere to fix this on.

carlini avatar Jul 11 '20 02:07 carlini

Update on this bug: I got a little bit of time on a Win10 machine. It's indeed a problem with the shaders. It looks like the windows machine is unhappy with dynamically switching between the array of shaders.

This is something that I will fix in the future eventually, but probably not for a while.

carlini avatar Jul 21 '20 22:07 carlini

(anonymous) @ javascript-doom-clone-game.js:1

The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

[Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead. (anonymous) @ javascript-doom-clone-game.js:1

43WebGL: INVALID_OPERATION: getAttribLocation: program not linked 213WebGL: INVALID_OPERATION: getUniformLocation: program not linked WebGL: too many errors, no more errors will be reported to the console for this context.


Black screen with loader.

Yoda49 avatar Jan 28 '21 11:01 Yoda49

Late to the game, but I tweaked shaders to not use dynamic indexing, here's draft PR #3 Did not test how py build would work.

Simofy avatar Sep 25 '22 14:09 Simofy

This should now be fixed! Thanks.

carlini avatar Oct 09 '22 20:10 carlini