Stark
Try free
  1. Stark
  2. Answers
  3. What is a single-file HTML5 game and how do you share one

What is a single-file HTML5 game and how do you share one

Do not be afraid.

A single-file HTML5 game is one .html file that holds the game's page, styling and code, and usually its pictures and sounds too. Open it and any current browser runs it, with no install and no server. To share it, send the file or put it behind a download link, and tell people to save it and open it in a browser.

Leer en espaƱol

Steps

  • Keep everything in the one file: the HTML, the CSS and the JavaScript. Pictures and sounds go in as data URLs, which are text versions of the files.
  • Expect the file to grow. Writing a picture as text makes it about a third larger than the original, so shrink images before you embed them.
  • Open the file straight from your disk, then open the browser's developer console and look for red errors about missing files. A missing file means something was linked instead of embedded.
  • Switch your internet off and open the game again. If it still plays, nothing is loading from outside.
  • Name the file with letters, numbers and hyphens only, and keep the .html ending, so mail programs and phones do not mangle it.
  • Send it by email, a download link or a USB stick, and say plainly what to do: save the file, then open it with a browser.

What it can't do

  • It cannot hold a server, so there are no shared accounts or online high scores. Everything the game does happens on the player's own device.
  • Email programs often block or cap attachments, so a large game may need a download link or a USB stick.
  • Anything inside the file can be read by anyone who opens it in a text editor, so keep passwords and private notes out.

Questions people ask

Can I include music and video?

Short sound effects and music loops can be embedded as data URLs. Long video makes the file very large, so keep it short or leave it out.

Will it run on a phone?

Often yes in a current phone browser, but touch controls and screen size are up to the game, and some phones make opening a downloaded file awkward. Test on the phone you care about.

Can I hide my code?

No. The browser needs the code to run the game, so anyone can read it. Scrambling it only slows people down.

Who made this page?

Made by Stark, who also make Stark World Engine. It is an offline game maker: you place three-dimensional or two-dimensional objects, write quests and dialogue, press Play and export the game as one HTML5 file. It has no browser trial; a starter edition and the paid editions are described at https://starkforall.com/studios.html

Try it

A free offline game maker for beginners and classrooms. Place 3D or 2D objects, write quests and dialogue, press Play, and export the whole game as one HTML5 file anyone can open. No account, no install, no engine to learn. $30 one-time.

More answers