[SOLVED] HTML5 build > ultra weird black screen

Hi!

Yesterday I completed my latest feature and wanted to give it a try on mobile (html5).

Surprisingly, one of my collections was displayed as a black screen. The same thing occurs on desktop (HTML5), so this is not mobile-specific but HTML5-specific.
image

Notes:
1/ It works 100% fine in Defold.
2/ My previous 100% functional HTML5 build was like 3 weeks ago.
3/ I did not work on this collection since then (or maybe minor stuff).
4/ Same issue on both Defold 1.3.5 and Defold 1.3.6


I tried to identify where the issue could come from by removing big blocks in this collection:
1/ Looks like something’s wrong with the gui used in this scene (after removing it, the scene is loaded again)
2/ Specifically with the gui script (same).
3/ Specifically with in the update() function, because when I delete the content of this function… it loads again.
Note sure this is the actual source of the problem, but something happens when I remove that stuff.


So I decided to go deeper into the update() function. And there is where it becomes weird.

I commented all the blocks, one by one, until everything is commented… and the issue remains!!

So…
1/ It “works” (no black screen but useless scene) when the update() function is empty.
2/ It doesn’t work (black screen) when everything in the update() function is commented.
3/ WTF. :zipper_mouth_face:


MAYBE IMPORTANT:
With Defold 1.3.6 I have more information when building for HTML5 and is here what is displayed in the console:
image
And here is the full log:
20220928_RagDefold_HTML5_build_console_error001.txt (3.7 KB)

That’s all folks :sweat_smile:

Do you have an idea where the issue could come from?..

Question (out of curiosity but would probably be useful in these situations):

Is there a way to display HTML5-specific “error messages”? (like the console in Defold)

Overall, how to debug HTML5 builds?

The output suggests that there’s something wrong with the lua source :thinking:
It is strange that we don’t output the filename…
Also stranfe that the output comes before locating the LuaBuilderPlugin…

What if you build with bob.jar, and passing the “-v” flag to it? Will it produce more info?

It may be something to do with our update to our LuaBuilder. (ping @britzl)
HTML5 uses vanilla Lua.
Would it be possible for us to have a look at the project? (e.g. share it with us in a DM?)

To be honest, you’re speaking chinese to me :sweat_smile:
(not sure the expression exists in english but you get the idea)

I could learn how to build with bob.jar (never did it before) but in this case it’d probably be 100 times faster if you investigated yourself directly in the project (cf below).

Yeah sure! I just created a private repo with the latest version of the project.

Can you give me your email(s) or Github names so I can share this repo?

1 Like

Our github users are britzl and JCash.

1 Like

@Mathias_Westerdahl @britzl

Invites sent!


Not sure it’ll be useful, but in case you want to load the “black screen” collection:

You just need to click this button (to unlock the button right below):
image

and then this button:
image


And if, for some reason, you need to reset the game save, click this debug button:
image and relaunch the game

1 Like

I haven’t gotten far in the testing yet, but this old script is broken:

gui/0. archived/gui_battle_preparation_OLD_20220904.gui_script:

The file is also missing an “end”, I suspect line 551: for i=1,#self.current_nodes do

1 Like

I guess it’s the comment format that is not supported.
By looking at the console of the game, it shows where to look:


ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_theme-specific/3/gui/g-battle_pvp_async_battle_preparation.guic: FORMAT_ERROR dmloader.js:524:37
ERROR:GUI: Error compiling script: gui/gui_battle_preparation.gui_script:636: nesting of [[...]] is deprecated near '[' dmloader.js:525:40
WARNING:RESOURCE: Unable to create resource: /gui/gui_battle_preparation.gui_scriptc: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_theme-specific/3/gui/g-battle_pvp_async_battle_preparation.guic: FORMAT_ERROR dmloader.js:524:37
WARNING:RESOURCE: Unable to create resource: /_generated_8783c3e96f4f9c40.goc: FORMAT_ERROR dmloader.js:524:37
ERROR:GAMEOBJECT: Could not instantiate game object from prototype /_generated_8783c3e96f4f9c40.goc. dmloader.js:525:40
ERROR:GAMEOBJECT: Child not found: /go

In the end, it was your doubly commented code that caused the problem.
It is invalid to do nested block comments like this:

	--[[
	some code	
                --[[
                some more code
                --]]
	--]]

Remove the comment and it worked for me.

I’m not sure why it’s not picked up by our LuaBuilder. Perhaps @britzl knows?

2 Likes

It fixed the issue indeed. Thanks!

Two things to not forget (for people who would read this topic in the future)

1/ Unused scripts are “read” by the lua compiler so keep them clean or delete them.
2/ Never use nested comments.

1 Like

No, not really. We pass the code through ANTLR to process it in search for go.property() declarations and require() calls and also to strip out comments, but apparently the Lua grammar definition we use with ANTLR has problems with the nested comments.

We could create a ticket for this and see if we could update the Lua grammar we use.

We use this one: https://github.com/stevenjohnstone/lua-grammar

The original one for ANTLR isn’t update to cover all use cases, more info here: https://github.com/antlr/grammars-v4/issues/1824

2 Likes