Skip to main content

Why Slot Games Are Built in HTML5: What One Web Build Has to Handle

· 6 min read
Gamix Labs Team
Slot art, Spine animation and HTML5 game development studio

Reviewed by Sagar Dabas, Founder, Gamix Labs · Updated

Ten years ago most online slots ran in Flash. Today almost every new slot is an HTML5 game: JavaScript drawing with WebGL in the browser. The short reason is that Flash is gone. The real reason is that one web build can go everywhere a casino needs it, and that "everywhere" asks a lot of the build.

This guide explains why slots moved to HTML5 and what a modern HTML5 slot has to handle, using our own games, such as Frost Crown and Toon Town Trouble, as examples.

Why Flash lost​

Flash ran most early online casino games, but it had three problems it could not fix: it never ran on iPhones, it was a constant source of security holes, and it was heavy on weak hardware. When Adobe ended Flash at the end of 2020, the industry had already moved. HTML5 needed no plugin, ran on phones and was supported by every browser maker.

Why HTML5 won, and not native apps​

A slot does not live in one place. The same game appears in the lobbies of many casinos, through aggregators, on desktop and on phones. That shapes the technology choice:

  • One build, every screen. A web game runs in any modern browser, so there is no separate iOS, Android and desktop version to build and certify.
  • No app store. Real-money gambling apps face strict store rules in many markets. A web game is opened from the casino's own site.
  • It drops into any casino. Casinos embed a slot in their site and pass it the player's session. The game talks to the casino's wallet through a server, so the same build works for every operator.
  • Instant updates. A fix goes live on the server; nobody has to download an update.

What one web build has to handle​

"Write once, run everywhere" is true, but only if the build is designed for everywhere from the start. Here is what our slots handle in a single build:

Every screen shape​

The game chooses between two layouts with one rule: portrait when the window is at least as tall as it is wide, landscape otherwise. The board, the bet bar and the panels all switch together, and the reels are sized for each. We check every release in both orientations, from a large desktop window down to small phone frames, where even the background texture on panels is reduced so it does not turn into noise.

Seventeen languages​

Frost Crown ships with 17 languages, including Arabic, Hindi, Japanese, Korean, Chinese, Russian and Vietnamese. That brings real work: right-to-left layout for Arabic, script fonts that must load before any text is drawn on the canvas, and longer words in German or Finnish that still have to fit the buttons.

The rules of each market​

Different markets have different rules, so the build reads a set of switches from the platform instead of hard-coding them: autoplay, turbo and stopping the reels early can be switched off, feature buys can be removed, a minimum round time can be enforced, and the session timer and net position can be shown. The same game becomes compliant in a new market without a new version.

Replays​

When a player or a regulator asks what happened on a spin, the platform can open the game in replay mode and play that exact round again. In replay the game moves no money and hides the balance, so nobody mistakes a replay for a live spin.

Money shown correctly​

Balances, bets and wins are shown in the player's currency with the right symbol and decimals, and amounts are formatted exactly, so the win on the banner always matches the win in the balance.

Browser quirks, especially on iPhone​

Every browser has its own habits, and Safari on iPhone has the most. Sound is the classic example. When a player leaves the game and comes back, iOS can do one of three things to the game's audio: resume normally, refuse to resume until the player touches the screen, or report that it is running while playing nothing ever again. Nothing in the browser's own status tells the first case from the third, so our games check whether the audio clock is actually moving, and rebuild the sound from scratch if it is not. Players never notice, which is the point.

The cost of the web: size and speed​

Everything has to be downloaded before the player can spin, often over a phone connection. Frost Crown's web build is about 20 MB, and the engine and game code are only about 1.2 MB of that compressed. The rest is art and sound, which is why our build pipeline packs textures into WebP atlases, merges 40 sounds into one audio file and loads the base game first. We cover that in detail in our guide to HTML5 slot performance.

Which engine?​

HTML5 is a platform, not an engine. We build slots in two:

  • PixiJS: a fast, code-first 2D renderer with a small footprint. Frost Crown uses PixiJS 8 with Spine 4.2.
  • Cocos Creator: a full engine with a visual editor, which suits teams that want designers to lay out scenes themselves.

Both draw with WebGL and run Spine animation and particle effects well on phones. We compare them, with build numbers, in Unity vs Cocos for slots.

A checklist for an HTML5 slot​

  1. Plan portrait and landscape layouts from the first mock-up.
  2. Decide the languages early and load their fonts before drawing text.
  3. Read market rules from the platform; never hard-code them.
  4. Support replays that move no money.
  5. Format money exactly, in the player's currency.
  6. Budget the download: atlas and compress art, load in stages.
  7. Test on real phones in both orientations, including leaving and returning to the game on an iPhone.

If you need an HTML5 slot built or ported, we build them in PixiJS and Cocos Creator, with the art, Spine animation and effects done in-house.