1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

HTML5 [Solved] Game not working in HTML5 mode, works in Windows

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Carcophan, Dec 3, 2019.

  1. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Hello everyone.

    I have a working game file when running in Windows. I then compiled and exported to HTML5 and added to a Virtual Private Server within my own domain - but it is not working for me.

    I am able to get to the game itself online, I think, but it gets stuck on a black loading screen.

    The browser, Chrome, currently craps out after a few seconds, the fans spin up super high on my laptop, and the browser throws the error message that says 'Wait or Exit'.


    I have seen a few dozen forum posts, but not a resolution. Has anyone encountered this or know of a solution?


    Thanks
     
  2. Ricardo

    Ricardo Member

    Joined:
    Jun 20, 2016
    Posts:
    192
    First of all run the game locally in debug mode (press F6 in GMS2) using HTML5. Then, in the browser, open the console (in Chrome click options > More Tools > Developer Tools > Console ) and check the log for errors. There you'll have a good insight of what's crashing the game.
    There are a few things that works well when exporting for Windows, but they behave differently or are not implemented yet in HTML5.
     
  3. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Thanks for the suggestion.

    So when I press F6, with the HTML5 set for the compiler, Chrome pops up and I get the same 'error' / issue as I get on the server.

    A new window pops up, DEBUG console, with a debug output. Everything in that window looks normal, with no data in instances or instance data panes. It freezes, and the only way forward is to close out the window.
     
  4. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    He means to look at the console in the browser, not the GMS console.

    If you are using Chrome open the options menu in the top right and go to More Tools > Developer Tools and then click the "Console" tab at the top.
     
  5. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Wow - so this seems like 'next level' stuff. Modifying cookies? Is that normal for what I thought was just a strait export?

    "A cookie associated with a cross-site resource at <URL> was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at <URL> and <URL>.

    also:
    Failed to load resource: the server responded with a status of 404 (Not Found)

    Which I also don't understand. The file in question is not in the normal folder, so i don't know what it is looking for.

    Is anything in the 'sources' that is relevant?
     
  6. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    I tried a different/newer version of the game, and compiled it in HTML5, and I get similar results. The newer version basically has a UI that the original test version did not have.

    The new UI version sort of loads, using F6/Chrome to debug, but only the UI loads. And even then, the UI has strange errors that do not exist in the windows version (like missing corner images, or the wrong sprite being used in places).

    The console window for this test does have instance information, which the old code/test does not have. But in both cases, the game itself fails to load up, just a loading screen (which i never coded, mind you, so I don't even know how to bypass it.)
     
  7. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Update: I had an idea and went to the marketplace. I downloaded the "My first arena shooter" tutorial, compiled it unmodified in HMLT5 format, and it ran just fine in F6 mode.

    When I run MY code in HTML5 / F6, I get nothing in the developer console in chrome, the browser freezes, and you have to alt_ctrl_del to get it to quit. Very frustrating.

    Is is something in the code? Do i need to add something to it, so it can be compiled in both windows and html5? Are there size limits or restrictions on how 'large' an html5 file can be? Why does the UI portion work in the browers, partially, but the game craps out when loading the level/room? (As i typed that out, it makes me wonder is size is the issue after all, I do have a lot of extra stuff in there?) ((That's what she said.))
     
    Last edited: Dec 5, 2019
  8. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    What happened to the 404 errors you said you were getting in the Chrome console?
     
  9. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    That was with a different 'earlier' version of the code, I stripped down for testing. So one set, the old code, gets those errors, while the newer more complete code throws no errors/messages.

    I created a separate thread for this in the more advanced technical forum, I thought maybe it didn't belong in this section so I am okay with either being deleted.
     
  10. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    Just to clarify - you are looking at the correct console?
    The one in Chrome I mentioned earlier and not the GMS2 console?

    If it is freezing with no error messages then it sounds like an infinite loop of some sort, but if that same code works in Windows then I would expect there to be more information in the Chrome console as to what the issue is - it's never usually blank even when the game runs successfully.

    Can you post a screenshot of it when the game has frozen?

    Better deleting the other thread as people have taken the time to reply in this one.
    I reported the other as a duplicate for you.
     
  11. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    So I think I found out why the console is 'blank'. I was opening it when the game froze, not 'before' I started interacting with it. When I opened it FIRST, i can actually get data.

    I included what I think you are looking for, below. The console image, the error messages, etc.

    (Thanks for the help with the other post - what do you do, just click 'report' - so I know in the future?)
     

    Attached Files:

  12. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    So grab4.PNG is the entire contents of the Chrome console output, and at that point the game is frozen?

    The first thing I noticed is the line "Max Texture Size = 16384" - is this something you are outputting to the console yourself?
    I don't get any line in the console stating texture size when running a test project, and the max texture page size inside the IDE is 8192x8192.

    What is your texture page size set to inside the IDE for the HTML and Windows targets?
    Do you have any sprites that are so large they could be causing the browser to crash / hang when loaded into vram?
     
    Last edited: Dec 5, 2019
  13. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Yes, that is from when the UI interaction tries to load the room/level - which is when it freezes.

    I don't think so.
    The HTML5 compilation created two texture files. One is 383 Kb and the other is 784 Kb.
    I opened them both in Paint, which has a pixel coordinate thing, and both look to be 2048 X 2048.

    I am not sure where to check this. I looked through the preferences page, but I cannot see it in there.

    No, I am not sure what this is honestly.
     
  14. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    I meant size when loaded into memory, which would be width * height * 4 (bytes) as they are uncompressed, but 2048x2048 shouldn't be causing an issue unless you are running on a potato.

    You can check the texture page size in the Resource Tree: Options > [platform] > Graphics.

    If you wanted to export your project and upload it somewhere I'd be happy to take a look, but without any code or usable error messages it's hard to work out what the issue might be - especially as you say it works on Windows.

    DM me a link if you wanted to keep it private, but I understand if you don't want to do that either.
     
  15. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Thanks for pointing that out - I looked and it seems to be default settings for Windows and HTML5, and 2048 for the graphics texture page size output.

    I am happy to share a link/content with you if you think it would help. Thank you for the offer - but I found this just now, which looks helpful.

    Again, I am not sure why it wasn't there last time, maybe I didn't see it, or maybe it didn't get this far last time - but it looks like it is a code error? Interesting.


    I loaded the game back up in Windows instead of HTML, and the only time I get a grid error message in the IDE console, is if the character leaves the acceptable bounds of the map. Which is currently possible, but should be accounted for and resolved in the future. It wasn't really a "problem" for me in Windows - it is interesting to see that it is an exclusionary error in HTML but acceptable in Windows.


    Code:
    Error: Error: region out of bounds(ds_grid_set_region): 0
    --------------------------------------------------------------------
        function _kD("Error: region out of bounds(ds_grid_set_region): 0")
        function _3d(0, 0, 15, 26, 26, 0)
        function _s1([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
        function _65([instance], [instance])
        function(0, 0, [instance], [instance])
        function(0, 0, [instance], [instance])
        function _8p2(9, [unknown])
        function _Pg3(9)
        function _sg3()
        function _7g3(15283.329)
    
    Random Map 7f.js?EYMYB=1976392371:1602 ###game_end###-2
    Random Map 7f.js?EYMYB=1976392371:1602 Error: Error: region out of bounds(ds_grid_set_region): 0
    --------------------------------------------------------------------
        function _kD("Error: region out of bounds(ds_grid_set_region): 0")
        function _3d(0, 15, 0, 26, 26, 0)
        function _s1([instance], [instance], 26, 26, 0, 1, 1, 1, 1, 3, 5, 5, 3)
        function _65([instance], [instance])
        function(0, 0, [instance], [instance])
        function(0, 0, [instance], [instance])
        function _8p2(9, [unknown])
        function _Pg3(9)
        function _sg3()
        function _7g3(15283.329)
     
  16. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    Yeah the runners are different and things that are ignored or "let go" in Windows can sometimes be things that cause errors in HTML (or other targets), which is why you should test regularly on all intended platforms to make sure things run as you intended.

    The same happens between VM and YYC with regards to things like semicolons, brackets and braces as YYC is a lot stricter than VM and will give errors whilst VM happily runs without issue.

    The error message is pretty self explanatory there with the "region out of bounds" error, so that should be your first port of call to get cleaned up and fix or add some error checking clauses around that part of the code so it cannot try to set a region that is out of bounds.
     
    Carcophan likes this.
  17. Carcophan

    Carcophan Member

    Joined:
    Aug 4, 2019
    Posts:
    100
    Yea - already ahead of you :) Amazing, how I have spent about 4 months in this software and I am still so very new to everything.

    Thank you so much!
     
    rIKmAN likes this.
  18. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,772
    You're welcome, happy coding!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice