-
Notifications
You must be signed in to change notification settings - Fork 10
HTML5 GMS2
GameMaker supports HTML5 (which includes all major browsers, plus releasing games on your own website or via Itch.io, Newgrounds, and other browser-based game-hosting platforms).
Target Manager (near the top-right corner of GameMaker) contains the one export option for this platform:
JS - slower in-game performance than the GX.games platform, but quick to build each time and also supports a GameMaker debugger which runs in your browser.
In this article we give the required steps to set everything up.
There are no additional tools required, beyond downloading the HTML5 runtime inside GameMaker - so, assuming you also have a recent version of a major browser installed also, you have only to check your Preferences and Device Manager inside GameMaker and then you're all set to run your games straight away!
Important
Old Internet Explorer is not fully supported because it does not support WebGL and some older mobile device browsers may have the same issue; however, you can usually run games in these browsers if WebGL is disabled in Game Options > HTML5 within your project. Your games will run more slowly if this is disabled, so this might not be suitable for you.
In most cases you don't need to change any of your Preferences before you can start building your games; however, be aware there are a number of values you can edit in Preferences > Platform Settings > HTML5 in order to control the code which is generated during builds and also to control the webserver ports and allowed IPs if your network/security setup requires you to do this.
For those who wish to get involved with maintaining the HTML5 target via our GitHub repo, you can also point your GameMaker to use a local copy of that GitHub source as well - which can be a route to getting bug fixes sooner for HTML5 games, plus allow you to contribute your own fixes back to GameMaker if you want.
Once the above sections are completed and you have a project ready for testing, you can open Target Manager and select the Target, Output and Device options that you want to use. You can then click the Run button on the menubar to compile the project.
If all goes well, you should soon see your game project running in your default browser on your computer!
Tip
If any build ever fails, please read ALL of the Output Window log to determine why the build failed - do not only look at the two lines at the end, as you're missing the important information which will help you fix the issue right away!
When testing VM builds, you can also launch your game in the HTML5 browser-based debugger by using the Debug button on GameMaker's menubar. The debugger allows you to see in detail how your game is performing, as well as set breakpoints and watch variables which will allow you to check for bugs in your code. For more information on how to use the debugger, see the manual by pressing F1 inside GameMaker or opening the Help menu.
Note that this is not the same in-IDE debugger as all the other targets use - it is a specific extra browser tab that is launched and interacts with your game tab. Accordingly, not all of the same functionality is available. You may wish to do much of your early testing on Windows/macOS/Ubuntu and then do HTML5 testing once you're happy with your game on those other platforms.
Be aware that running the debugger may require some extra permissions from the OS in terms of allowing firewall access, etc.