naughty.games
Play All games
Live Cams
Home Browse Random Live Saved
Left on Read 2 is out. New accounts get 100 free credits until Dec 6. See how →
Home / Guides

How to export your GameMaker game to HTML5

Pick HTML5, not GX.games, from GameMaker's Target Manager: GX.games publishes to Opera's GX.games site, while HTML5 gives you plain files you can host anywhere. Every licence tier, including Free, includes HTML5 export, though Free is non-commercial only. Run Create Executable to get a zip with index.html, test it on a local server, then re-zip it with index.html at the top and upload it.

Last checked 2026-10-04

Add in-game ads to your GameMaker game: copy this prompt

Paste it into Claude Code, Cursor, Copilot or any coding agent. It adds the SDK to your project and tests it.

Preview the prompt
Goal: integrate the naughty.games in-game ads SDK (lifecycle and ad breaks only) into this GameMaker (HTML5 export) project.

Setup:
1. Download https://naughty.games/sdk/wrappers/gamemaker/naughty_games_sdk.js and https://naughty.games/sdk/wrappers/gamemaker/scr_naughty_games_sdk.gml.
2. Create an extension, add the JavaScript file for the HTML5 target only, and add the functions listed in the notes at the top of that file (Name and External Name identical). Add the GML file as a script.
3. Make one persistent controller object: Create event calls ng_sdk_start(); Step event calls ng_sdk_step(). While global.ng_paused is true, skip game logic.
4. Call ng_sdk_game_loading_finished(), ng_sdk_commercial_break(function() { ... }) and ng_sdk_rewarded_break(function(_granted) { ... }).
5. In the extension editor, open Platform Settings > HTML5 and paste this into the Code Injection box, so every HTML5 export writes the tag into <head> of index.html (a custom index.html must keep its ${GM_HTML5_PreStyle} line):
   <GM_HTML5_PreStyle>
   <script src="https://naughty.games/sdk/v1.js"></script>
   </GM_HTML5_PreStyle>
6. The wrapper restores the player's own master gain after each ad.

API (global NgSdk, added by the script tag; the engine wrappers call these for you):
- NgSdk.init(): Promise of { env, signedIn, locale }. Call it first. env is naughty, local (test mode) or inert; signedIn is whether the player is signed in to naughty.games.
- NgSdk.gameLoadingFinished(): the game finished loading.
- NgSdk.gameplayStart() / NgSdk.gameplayStop(): active play starts or stops (menu, pause screen, game over).
- NgSdk.commercialBreak(): Promise of nothing. Shows an ad if one is due.
- NgSdk.rewardedBreak(): Promise of true or false. true only when the player watched the ad to the end.
- NgSdk.on('pause' | 'resume' | 'mute' | 'unmute', fn): fired around every ad.

Rules:
- The SDK only works in games hosted on naughty.games (an uploaded zip build). A game embedded from itch.io or another site runs in a third-party frame, so the SDK stays inert there and shows no ads.
- Every call settles, and the game must carry on once it does. A commercial break may finish at once (no ad, or too soon), so never wait for an ad to appear.
- Grant a reward only when rewardedBreak() resolves true. Not on the button tap, not when the promise settles.
- On pause and mute, stop the game loop and silence audio; restore both on resume and unmute. Keep the handlers quick, they can arrive back to back.
- Place commercial breaks at natural pauses (between levels, after game over), never mid-action or mid-dialogue, and not at startup.
- Put rewarded breaks behind a button the player chooses to tap, and say what the reward is first. Never block progress behind one: on false the player keeps playing.

Verify:
- Run the game from localhost, or add ?ngsdk=test to its address. A test ad covers the game with Complete and Skip buttons. Check both paths: Complete must grant the reward, Skip must not, and the game must continue after each. Left alone, the test ad closes itself after 5 seconds and a rewarded break resolves false: only Complete grants.
- Zip the build with index.html at the top level and upload it. The Build tab in the naughty.games developer console shows "SDK detected" when an HTML file in the build loads https://naughty.games/sdk/v1.js with a script tag, or an uncompressed .js file names that URL in its code.

Ask me before changing any gameplay. If anything is unclear, read the full guide at https://naughty.games/guides/in-game-ads-sdk before guessing.

What you need

  • A current GameMaker release (the monthly release or the LTS branch), installed and signed in.
  • A licence that covers HTML5 export. Every tier, including Free, includes HTML5 export, but Free is non-commercial only. If you plan to make money from the game, including through your own Patreon, Ko-fi or Steam links, you need the Professional (one-time purchase) or Enterprise (subscription) licence for a commercial licence.
  • A project that already runs in the VM or YYC compiler.

Your build runs inside an iframe on naughty.games, behind the site's own age gate, so nothing extra is needed inside the project for that.

Export for the web

  1. Select the HTML5 target. Open the Target Manager in the top right of the GameMaker IDE and choose HTML5, not GX.games. GX.games is a separate export that publishes to Opera's GX.games site; HTML5 gives you plain files you can host anywhere, which is what naughty.games needs.
  2. Test-run from the IDE. Click run as you normally would. GameMaker starts its own local test server and opens the build in your default browser, which may trigger a one-time firewall prompt.
  3. Check the Game Options for HTML5. Open the HTML5 Game Options and review the Graphics tab: Texture Page size defaults to 2048x2048 and can go up to 8192x8192, but a larger texture page means a bigger download and less browser and device compatibility. Set WebGL support to auto-detect rather than required, since requiring WebGL cuts out browsers that would otherwise run the game fine.
  4. Turn off unused built-in assets. Uncheck Use Built-In Particles and Use Built-In Font if your project uses its own particle sprites or fonts, so GameMaker does not package assets you never use.
  5. Create the executable. Click Create Executable and pick a save location. GameMaker compiles the project into a zip that includes index.html and the rest of your game's files.

Test it locally

GameMaker's own IDE test run already serves the build through its local server, which is the easiest way to check it works before you export a zip. If you unzip the Create Executable output separately and want to test it again outside the IDE, do not open index.html directly from your file system: browsers block the requests the game makes for its own data files over a file:// URL.

Serve it over HTTP instead. From inside the unzipped folder, run:

python -m http.server 8000

Then open http://localhost:8000 and play through the build.

Zip it for upload

  • GameMaker's Create Executable output is meant to be unzipped and hosted, not uploaded as-is: unzip it to a folder first, confirm index.html sits at the top next to your game's data files, then re-zip that folder's contents for naughty.games.
  • Stay under 250 MB unpacked and 2,000 files. Texture pages are the most common size culprit in recent GameMaker versions, so pack sprites into fewer, well-sized texture pages and compress source art before you import it rather than relying on the runtime to shrink it.

Common problems

  1. The game runs in the IDE but the exported zip shows a blank page. You likely tested it over file:// instead of a server. Serve it locally, or upload it and preview it on naughty.games directly.
  2. Audio does not play or cuts out on the web. Audio support is more limited in HTML5 than on other targets. Check the audio_system_is_available function in the GameMaker manual for the standard workaround if sound refuses to start.
  3. Save files do not seem to load. file_exists only checks local browser storage on the HTML5 target, not files on a remote server. Use GameMaker's own file and ini functions for saving, which read and write browser storage automatically on this target.
  4. The download is huge for a small 2D game. Texture pages have grown in recent GameMaker versions. Make sure Use Built-In Particles and Use Built-In Font are off, and keep Texture Page size modest instead of maxing it out.
  5. The game feels slow or freezes compared to the desktop build. HTML5 is GameMaker's slowest target since it runs as JavaScript rather than native code. Limit blend modes, since they are expensive to run on this target unless you are using WebGL, and cut down heavy per-frame work, especially for phone players, since a large share of naughty.games traffic is on phones.
  6. A browser other than the one you tested in behaves differently. GameMaker's own setup guide recommends testing your HTML5 build across more than one browser before you ship, since WebGL and audio support both vary between them.

Add in-game ads (optional)

A build hosted on naughty.games can show ads between levels and rewarded ads ("watch an ad for a bonus") through the naughty.games SDK. For GameMaker, add naughty_games_sdk.js to an HTML5 extension, add scr_naughty_games_sdk.gml as a script, and paste the SDK's script tag into the extension's HTML5 Code Injection box so every export carries it. The in-game ads guide covers the setup, a test mode that runs on localhost, and how the revenue share works.

Publish it

Once your build runs cleanly from a local server, zip it with index.html at the top level (up to 250 MB unpacked and 2,000 files) and upload it to naughty.games, or send us an https URL if you would rather embed it. Review is usually about 2 working days, listing is free and non-exclusive, and any Patreon, Ko-fi, Steam or itch links inside your game earn you 100% of what they bring in. Head to /submit when you are ready.

Questions

Which GameMaker licence do I need for HTML5?
The Free licence includes HTML5 export but is non-commercial only. If you plan to earn money from the game, including through your own Patreon, Ko-fi or Steam links, you need the Professional or Enterprise licence for a commercial licence.
What's the difference between HTML5 and GX.games?
GX.games is a separate export that publishes to Opera's GX.games site. For naughty.games, or any other web host, use the plain HTML5 target, which gives you files you can host anywhere.
Which GameMaker version does this guide use?
Any current GameMaker release, monthly or LTS. HTML5 export steps have been stable across recent versions.
Will player saves work in the browser?
Yes. GameMaker's file and ini functions write to the browser's local storage automatically on the HTML5 target, so progress stays on that browser and device.
Why is my HTML5 build so much bigger than my desktop build?
Texture pages take up more space on the HTML5 target in recent GameMaker versions. Keep Texture Page size modest and turn off unused built-in particles and fonts to bring the download size down.

Sources

  • GameMaker: Export Licences Pricing
  • GameMaker Help Centre: Setting Up For HTML5
  • GameMaker Help Centre: Setting Up For GX Games
  • GameMaker Manual: HTML5 Game Options
  • GameMaker: Which Platforms Can GameMaker Export To?

Free hosting, real players on phone and desktop, and a stats console.

Publish your GameMaker game on naughty.games

More guides

  • Where to publish your adult game

    itch.io, Steam, Patreon, SubscribeStar, Nutaku, DLsite and naughty.games compared for adult games: content rules, fees, browser play and the 2025 delistings.

  • How to make money from your adult game

    Patreon, SubscribeStar, Ko-fi, Steam, itch.io, DLsite and Nutaku for adult games: fees, payouts and rules as of September 2026, plus what drives pledges.

  • Payment processors and adult games: what each platform allows

    Adult content rules and payouts on Patreon, SubscribeStar, Ko-fi, itch.io, Steam and DLsite, and where the 2025 payment processor crackdown stands in 2026.

  • How to add in-game ads to your HTML5 game with the naughty.games SDK

    Add the naughty.games SDK to a hosted HTML5, Unity, Godot, Ren'Py, Construct 3 or GameMaker game: commercial breaks, rewarded ads, test mode and revenue share.

  • How to put your Ren'Py game in the browser

    How to export a Ren'Py visual novel for the web, test it on a local server, zip it correctly, and publish it so players can play in the browser.

  • How to export your Unity game to WebGL for the browser

    How to build a Unity WebGL player, set compression correctly, test it locally, zip it, and publish it so players can play in the browser.

  • How to export your Godot game for the web

    How to export a Godot 4 project to HTML5, why single-threaded export is the safe choice, test it locally, zip it, and publish it to naughty.games.

Browse

  • Play online
  • Live cams
  • All games
  • Tags
  • Platforms
  • Best of
  • Privacy
  • Terms
  • Terms of sale
  • DMCA
  • 2257
  • DSA
  • Advertise
  • No ads
  • For developers
  • Guides
  • Data reports
  • Contact
© 2026 naughty.games Adult content. 18+.

Adult content ahead

naughty.games contains adult-oriented game listings. By entering, you confirm you are at least 18 years old and that adult content is legal in your jurisdiction.

What do you want to see?

You can change this anytime

Nothing selected = show me everything