<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: mia pu</title>
    <description>The latest articles on DEV Community by mia pu (@mia_pu_cea9dd9d29db42cba4).</description>
    <link>https://dev.to/mia_pu_cea9dd9d29db42cba4</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4249388%2F3f2ffce1-1833-4092-a6ce-0202cb9bdc30.png</url>
      <title>DEV Community: mia pu</title>
      <link>https://dev.to/mia_pu_cea9dd9d29db42cba4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mia_pu_cea9dd9d29db42cba4"/>
    <language>en</language>
    <item>
      <title>How Modern Slot Games Are Built: A Developer's Look at RNG and Multiplier Reels</title>
      <dc:creator>mia pu</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:55:01 +0000</pubDate>
      <link>https://dev.to/mia_pu_cea9dd9d29db42cba4/how-modern-slot-games-are-built-a-developers-look-at-rng-and-multiplier-reels-2m3m</link>
      <guid>https://dev.to/mia_pu_cea9dd9d29db42cba4/how-modern-slot-games-are-built-a-developers-look-at-rng-and-multiplier-reels-2m3m</guid>
      <description>&lt;p&gt;Slot games look simple from the outside: three reels, a spin button, some symbols. Underneath, they are small real-time systems with strict correctness requirements, and building one teaches you a surprising amount about random number generation, state machines, and payout tables.&lt;/p&gt;

&lt;p&gt;This walkthrough breaks down how a modern three-reel slot with a multiplier reel is structured, using Fortune Gems as a reference point because its mechanics are visible and easy to trace. The same architecture applies to most web-based slot games.&lt;/p&gt;

&lt;h2&gt;
  
  
  The core: a seeded RNG, not Math.random
&lt;/h2&gt;

&lt;p&gt;Every serious slot implementation uses a seeded random number generator rather than the platform's default. The reasons are auditability and reproducibility: when a dispute arises, the operator has to be able to reconstruct exactly which numbers were produced in which order.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// conceptual: a simple LCG for illustration&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123456789&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1103515245&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;12345&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2147483648&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2147483648&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Production games use CSPRNG-backed seeds supplied by the game server, not the client, so the client never generates the outcome itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reels as a state machine
&lt;/h2&gt;

&lt;p&gt;A spin is a transition through states: &lt;code&gt;idle -&amp;gt; spinning -&amp;gt; resolving -&amp;gt; paying -&amp;gt; idle&lt;/code&gt;. Modelling this explicitly prevents a whole class of bugs where a player can trigger a second spin during payout, or where the multiplier reel resolves before the main reels stop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="n"&gt;idle&lt;/span&gt; ──&lt;span class="n"&gt;spin&lt;/span&gt;──&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;spinning&lt;/span&gt; ──&lt;span class="n"&gt;reels&lt;/span&gt; &lt;span class="n"&gt;stopped&lt;/span&gt;──&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;resolving&lt;/span&gt;
  ▲                                          │
  └──────────── &lt;span class="n"&gt;payout&lt;/span&gt; &lt;span class="n"&gt;complete&lt;/span&gt; ─────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The multiplier reel changes payout math
&lt;/h2&gt;

&lt;p&gt;In games like &lt;a href="https://gemsnotesph.top/" rel="noopener noreferrer"&gt;Fortune Gems&lt;/a&gt;, a fourth reel displays a multiplier instead of symbols, and any win from that spin is multiplied by the displayed value. From an implementation standpoint this is a lookup applied after the win evaluation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;baseWin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;evaluatePayline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;reels&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;multiplier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;multiplierReel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 1..10&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;totalWin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;baseWin&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;multiplier&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The design question is where the multiplier distribution comes from. Weighted tables are the norm: a 10x multiplier should be rare, a 1x common, with the exact weights published in the game's technical documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Payout tables and the RTP check
&lt;/h2&gt;

&lt;p&gt;The return-to-player figure is not set by the RNG; it falls out of the payout table. During development you simulate millions of spins and check the empirical RTP converges to the target. If it does not, the payout table is wrong, not the RNG.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;simulate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1_000_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;totalBet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;totalWin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;totalBet&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;totalWin&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;spin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// returns win for this round&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalWin&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;totalBet&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s1"&gt;'%'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What this teaches beyond slots
&lt;/h2&gt;

&lt;p&gt;The same three patterns — server-authoritative randomness, explicit state machines, and simulation-verified payout tables — show up in any system where money and randomness meet: loot boxes, gacha systems, trading-card pack openings. Slots are simply the oldest and most documented version of the problem.&lt;/p&gt;

&lt;p&gt;If you are building one of these systems, start with the payout table and simulate before you write a single line of reel-spinning animation code.&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>javascript</category>
      <category>random</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
