defold icon indicating copy to clipboard operation
defold copied to clipboard

The game does not run on the html5 platform

Open Fossean1 opened this issue 1 year ago • 4 comments

Describe the bug (REQUIRED) My game is on the Yandex Games web platform and sometimes when I start the game for reasons I don't understand it won't start and I only see a black screen. The following errors are displayed in the console:

v2:1 Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment
v2:1 exception thrown: RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.,RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
    at abort (<anonymous>:1:12355)
    at ___assert_fail (<anonymous>:1:37497)
    at wasm://wasm/0081e562:wasm-function[855]:0x1a275
    at wasm://wasm/0081e562:wasm-function[2181]:0xa1f53
    at wasm://wasm/0081e562:wasm-function[4090]:0x145af2
    at wasm://wasm/0081e562:wasm-function[1599]:0x63c28
    at wasm://wasm/0081e562:wasm-function[3595]:0x11e71d
    at wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a
    at wasm://wasm/0081e562:wasm-function[1839]:0x7d68b
    at wasm://wasm/0081e562:wasm-function[710]:0xe995
dmloader.js:646 INFO:CRASH: Successfully wrote Crashdump to file: /data/.Defold/_crash
v2:1 ERROR:CRASH: CALL STACK:
v2:1 ["RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.","abort@<anonymous>:1:12355","___assert_fail@<anonymous>:1:37497","@wasm://wasm/0081e562:wasm-function[855]:0x1a275","@wasm://wasm/0081e562:wasm-function[2181]:0xa1f53","@wasm://wasm/0081e562:wasm-function[4090]:0x145af2","@wasm://wasm/0081e562:wasm-function[1599]:0x63c28","@wasm://wasm/0081e562:wasm-function[3595]:0x11e71d","@wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a","@wasm://wasm/0081e562:wasm-function[1839]:0x7d68b","@wasm://wasm/0081e562:wasm-function[710]:0xe995"]Lua Callstack:
v2:1   render/postprocess.render_script:26: in function create_render_target
v2:1   render/postprocess.render_script:30: in function create_render_targets
v2:1   render/postprocess.render_script:55: in function <render/postprocess.render_script:34>
v2:1 
v2:1 CALL STACK END
dmloader.js:649 Exception thrown, see JavaScript console
v2:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info. 
Object
VM565:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
    at abort (<anonymous>:1:12355)
    at ___assert_fail (<anonymous>:1:37497)
    at 0081e562:0x1a275
    at 0081e562:0xa1f53
    at 0081e562:0x145af2
    at 0081e562:0x63c28
    at 0081e562:0x11e71d
    at 0081e562:0x3cc1a
    at 0081e562:0x7d68b
    at 0081e562:0xe995

image

The following is written to the file /data/.Defold/_crash: image

I have an extension in my dependency that is causing this error: https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip

Full list of dependencies: dependencies#0 = https://github.com/indiesoftby/defold-yagames/archive/refs/tags/0.10.0.zip dependencies#1 = https://github.com/britzl/ludobits/archive/refs/tags/7.4.0.zip dependencies#2 = https://github.com/defold/lua-language-server/releases/download/v0.0.5/release.zip dependencies#3 = https://github.com/selimanac/defold-astar/archive/master.zip dependencies#4 = https://github.com/britzl/defold-orthographic/archive/master.zip dependencies#5 = https://github.com/defold/extension-lua-preprocessor/archive/refs/tags/1.1.3.zip dependencies#6 = https://github.com/AGulev/drawpixels/archive/refs/tags/2.0.1.zip dependencies#7 = https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip dependencies#8 = https://github.com/Insality/druid/archive/refs/tags/0.11.0.zip dependencies#9 = https://github.com/britzl/defold-input/archive/refs/tags/4.6.1.zip dependencies#10 = https://github.com/subsoap/defglot/archive/master.zip dependencies#11 = https://github.com/britzl/defold-metrics/archive/master.zip

To Reproduce (REQUIRED) I don't know if this error will work for you, but you can do the following

  1. Put the dependency: https://github.com/TheKing0x9/horri-fold/archive/refs/tags/v1.0.0-beta.3.zip
  2. Use render script from horri-fold library
  3. Bundle the release version for the html5 platform
  4. Try to run the game several times and catch the error

Expected behavior (REQUIRED) The game starts without errors

Defold version (REQUIRED):

Build time2024-04-05T07:34:48.512723
Defold channelalpha
Defold editor sha3e1b2edbded3eaef762f8d416a74714613ece137
Defold engine sha3e1b2edbded3eaef762f8d416a74714613ece137
Defold version1.7.1
GPUNVIDIA GeForce GTX 660/PCIe/SSE2
GPU Driver4.6.0 NVIDIA 474.14
Java version17.0.5+8
OS archamd64
OS nameWindows 11
OS version10.0

Platforms (REQUIRED):

  • Platforms: html5
  • OS: Windows 11
  • Browser: Google Chrome, Version 123.0.6312.106 (Official Build) (64-bit)

Fossean1 avatar Apr 10 '24 08:04 Fossean1

Could you please attach the full log from the browser console? And the same build is working on Windows?

britzl avatar Apr 11 '24 12:04 britzl

Could you please share a minimal repro case?

britzl avatar Apr 11 '24 12:04 britzl

@britzl, I think I've figured out what the problem is. The problem lies in the render.render_target() function, namely when render.BUFFER_COLOR_BIT parameter is passed with width or height equal to zero:

local color_params = {
  format = render.FORMAT_RGBA,
  width = render.get_window_width(), -- Getting zero
  height = render.get_window_height(), -- Getting zero
  min_filter = render.FILTER_LINEAR,
  mag_filter = render.FILTER_LINEAR,
  u_wrap = render.WRAP_CLAMP_TO_EDGE,
  v_wrap = render.WRAP_CLAMP_TO_EDGE
}
return render.render_target(name, {[render.BUFFER_COLOR_BIT] = color_params })

For some reason render.get_window_width() and render.get_window_height() sometimes return zero when the game starts. Apparently it is related to the Yandex Games platform. And when the render.render_target() function receives the render.BUFFER_COLOR_BIT parameter with a width or height equal to zero, this error occurs:

v2:1 Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment
v2:1 exception thrown: RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.,RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
    at abort (<anonymous>:1:12355)
    at ___assert_fail (<anonymous>:1:37497)
    at wasm://wasm/0081e562:wasm-function[855]:0x1a275
    at wasm://wasm/0081e562:wasm-function[2181]:0xa1f53
    at wasm://wasm/0081e562:wasm-function[4090]:0x145af2
    at wasm://wasm/0081e562:wasm-function[1599]:0x63c28
    at wasm://wasm/0081e562:wasm-function[3595]:0x11e71d
    at wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a
    at wasm://wasm/0081e562:wasm-function[1839]:0x7d68b
    at wasm://wasm/0081e562:wasm-function[710]:0xe995
dmloader.js:646 INFO:CRASH: Successfully wrote Crashdump to file: /data/.Defold/_crash
v2:1 ERROR:CRASH: CALL STACK:
v2:1 ["RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.","abort@<anonymous>:1:12355","___assert_fail@<anonymous>:1:37497","@wasm://wasm/0081e562:wasm-function[855]:0x1a275","@wasm://wasm/0081e562:wasm-function[2181]:0xa1f53","@wasm://wasm/0081e562:wasm-function[4090]:0x145af2","@wasm://wasm/0081e562:wasm-function[1599]:0x63c28","@wasm://wasm/0081e562:wasm-function[3595]:0x11e71d","@wasm://wasm/0081e562:wasm-function[1243]:0x3cc1a","@wasm://wasm/0081e562:wasm-function[1839]:0x7d68b","@wasm://wasm/0081e562:wasm-function[710]:0xe995"]Lua Callstack:
v2:1   render/postprocess.render_script:26: in function create_render_target
v2:1   render/postprocess.render_script:30: in function create_render_targets
v2:1   render/postprocess.render_script:55: in function <render/postprocess.render_script:34>
v2:1 
v2:1 CALL STACK END
dmloader.js:649 Exception thrown, see JavaScript console
v2:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info. 
Object
VM565:1 Uncaught RuntimeError: abort(Assertion failed: false, at: ../src/opengl/graphics_opengl.cpp,2317,AttachRenderTargetAttachment). Build with -s ASSERTIONS=1 for more info.
    at abort (<anonymous>:1:12355)
    at ___assert_fail (<anonymous>:1:37497)
    at 0081e562:0x1a275
    at 0081e562:0xa1f53
    at 0081e562:0x145af2
    at 0081e562:0x63c28
    at 0081e562:0x11e71d
    at 0081e562:0x3cc1a
    at 0081e562:0x7d68b
    at 0081e562:0xe995

Fossean1 avatar Apr 12 '24 08:04 Fossean1

For some reason render.get_window_width() and render.get_window_height() sometimes return zero when the game starts. Apparently it is related to the Yandex Games platform.

I've seen similar things elsewhere when going back to a previously minified window or when a tab has been in the background. It is of course possible to check if width and height is empty and do nothing that frame, but still, the engine should not crash. We will look into it.

britzl avatar Apr 12 '24 10:04 britzl