Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Fixed in 1.0.53+] GMLive currently not working with HTML5 module

A topic by foreverisbetter created Jul 28, 2021 Views: 332 Replies: 3
Viewing posts 1 to 4
(1 edit)

GameMakerStudio 2.2.3.574 HTML5 module does not work with the newest GMLiveForGMS2.3+

If you try to run a project with obj_gmlive #macro live_enabled 1 you'll find 

Uncaught ReferenceError: GameMaker_Init is not defined at index.html:83

in the browser console or something similar.

It seems like some unused variables are treated as syntax errors and that the HTML5 compiler is complaining about them.

I didn't try yet to simply use those variables for something non-sensical just so the compiler is fine with it. I'll update as soon as I can.

Until then someone else proposed to simply replace the #macro live_enabled 1 in obj_gmlives create event with #macro live_enabled browser_not_a_browser. This way you can at least use it in the project, build everything using GMLive and then simply test it on the target platform.

Developer

It seems like some unused variables are treated as syntax errors and that the HTML5 compiler is complaining about them.

That is not how that works at all.

Here’s the code that is suddenly illegal as of the new update:

function scr_hello() {
    static arr = [];
    static one = 1;
}

Because it produces broken JavaScript:

This can be addressed by globally find-replacing

static __enumParams__=[

to

__enumParams__=[

But wait, there’s more: functions are missing!

Go into GMLiveAPI script and find-replace gc_target_frame_time and gc_get_target_frame_time to l_dummy. You will notice that there are a handful more mentions of l_dummy in the script because this is not the first time.

But wait, there’s more: live_method doesn’t work! Or, rather, method_get_self doesn’t work. This will break the HTML5 runtime:

function scr_a_bug() {
	var f = method({}, scr_a_bug);
	var r = method_get_self(f);
}

Fortunately, most people use neither live_method nor method_get_self, so this might be OK.

Until then someone else proposed to simply replace the #macro live_enabled 1 in obj_gmlives create event with #macro live_enabled browser_not_a_browser. This way you can at least use it in the project, build everything using GMLive and then simply test it on the target platform.

That is not how it works either, browser_not_a_browser is equal to -1 so this is the same as setting live_enabled to 0.

Developer

1.0.53 includes the aforementioned workarounds.

Thanks for the clarification! And of course for the bug fix! 

Maybe I should have been clearer that what I said were really only guesses depending on what I observed happening. I had and have absolutley no idea whats going on with all this. I'm not a native english speaker and I thought using "It seems like" would make that clear. I didn't want to spread misinformation. But I wanted to pass along everything I observed to make it as easy as possible to track down the real bug.