HTML5 compile issues/errors - not existing in Windows

Carcophan

Member
Hello everyone.

I have been pulling my hair out for two weeks, over an error that exists in HTML5 but not in Windows.

There is a grid/region out of bounds error that I get when I compile for HTML5, but GMS lets the game compile just fine in Windows. I've been told GMS should/will one day catch this, but I didn't know I had a problem until I tried HTML5.



One example is the level button, it is showing as 7 for Windows, but as an 8 in the developer tools when I do an F6 debug compile for HTML5.


Code:
Total memory used = 10635759(0x00a249ef) bytes
**********************************.
Entering main loop.
**********************************.
level button was  Lvl7
Code:
Entering main loop...
Map.js?Application Surface created: w=850, h=890
Map.js?level button was  Lvl8


The other, major issue, is how the grids are set up, in that, there is this region out of bounds issue, that I for the life of me cannot find/debug.
Code:
//example of how the mazeWidth data is used
global.mazeWidth = 26;
global.mazeHeight = 26;
global.gridHP_    = ds_grid_create(global.mazeWidth, global.mazeHeight);

//and later :
for ( global.i = 0; global.i < global.mazeWidth ; global.i++){
    for ( global.j = 0; global.j < global.mazeHeight ; global.j++){

//as well as:
var vW, vH, vNoBorder, vNmin, vNmax, vSym, vEL, vER, vET, vEB, vNS;
//where vW and vH are the global.mazeWidth, global.mazeHeight values for the script function

//output from html5 developer screen in chrome:

WebAudio autoplay test passed.
Random Map 7f.js?YKGBC=1999932509:28724 level button was  LvL8
Random Map 7f.js?YKGBC=1999932509:28724 Error: Error: region out of bounds(ds_grid_set_region): 1
--------------------------------------------------------------------
    function _Sg("Error: region out of bounds(ds_grid_set_region): 1")
    function ds_grid_set_region(1, 0, 15, 26, 26, 0)
    function gml_Script_huder_mazeGen([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
    function gml_Object_obj_Level7_Create_0([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function _Re2(9, [unknown])
    function _h23(9)
    function _T13()
    function _y13(29925.601)

Random Map 7f.js?YKGBC=1999932509:28724 ###game_end###-2
Random Map 7f.js?YKGBC=1999932509:28724 Error: Error: region out of bounds(ds_grid_set_region): 1
--------------------------------------------------------------------
    function _Sg("Error: region out of bounds(ds_grid_set_region): 1")
    function ds_grid_set_region(1, 15, 0, 26, 26, 0)
    function gml_Script_huder_mazeGen([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
    function gml_Object_obj_Level7_Create_0([instance], [instance])
    function(0, 0, [instance], [instance])
    function(0, 0, [instance], [instance])
    function _Re2(9, [unknown])
    function _h23(9)
    function _T13()
    function _y13(29925.601)


I have put '-1' in a million different places, and for the most part, that just changes the error message from '26' to '25', though it is the same error. I know it is just a matter of -1 in the right spot but I cannot tell where.

Can anyone pretty please help shed some light on this? I have a few old posts here already, I thought it was resolved but it isn't. I've also been on discord for the last few days, no one seems to be able to understand what is wrong. They say the grid info looks okay.
 

Binsk

Member
Hm, out of curiosity try putting:
Code:
global.gridHP_    = ds_grid_create(global.mazeWidth + 1, global.mazeHeight + 1);
It is saying it is erring out at pos 26. Since you are telling the size to be 26x26 that means your indices will only go from [0..25].

If that above fixes things then you should probably remove the +1 and find why you are looping out of bounds.

From your code I don't see the issue so I'm kinda just guessing.
 

Carcophan

Member
Good suggestion and your comment makes sense, but sadly this does not seem like the solution.

I have added/removed 1's from all over the place, but I still get the same error result:

Error: Error: region out of bounds(ds_grid_set_region): 0
--------------------------------------------------------------------
function _Sg("Error: region out of bounds(ds_grid_set_region): 0")
function ds_grid_set_region(0, 15, 0, 26, 26, 0)
function gml_Script_huder_mazeGen([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
function gml_Object_obj_Level8_Create_0([instance], [instance])
 

rIKmAN

Member
Make a new project, create some grids, set some regions etc and run it in both Windows and HTML5.

If it works in both, add some complexity to the code to make it more like whatever you are doing in your game, test it, repeat.
If it fails in HTML5, you now have a very basic example project which you can strip back and which will be much easier to try and debug to find out what the issue is.

Start off very basic and add complexity each time until you can reproduce the error.
Setup objects and relationships between them (if any) the same way you have in your main project etc, but make everything as simple as possible to start with.

If you prefer you could save your project under a new name and work backwards, commenting out code to strip it down as much as possible and try and find what part of the code introduces the error as you add pieces back in.

I'm suggesting this as in your previous threads you said you had already tried using the debugger, stepping through, checking values etc and have had no luck, same with trying to find any problematic region setting code that could be causing the error etc.
 
Last edited:
Top