• Atom Reaction
  • How to play
  • Strategy
  • Videos
  • Shorts
  • Tdm
  • Drills
  • Chess
  • About me
  • Projects
  • Social Medias
    • Instagram
    • YouTube
    • Twitter
  • Games
    • Dice Chess
    • Ultimate Tic Tac Toe
    • Atom Reaction

    • About the games
  • Coding
    • Resume
    • LeetCode
    • Codechef
    • CodingNinjas
โ–S๐’Š๐’๐’†๐’๐’•ใ€…๐’Œ๐’Š๐’๐’๐’†๐’“เฟ

Atom Reaction rules, strategy guides and free browser games, plus gameplay videos and projects by Swapnil Shah.

Connect with me
  • Instagram
  • YouTube
  • Twitter
  • Contact Me

    silentkillerop123@protonmail.com

    How to playStrategyGamesProjectsAboutContactPrivacy PolicyTerms
    ยฉ 2026 Copyright: silentkillerop.me

    Behind the game ยท by Swapnil Shah ยท 23 November 2026

    How the Atom Reaction backend was built

    Atom Reaction looks simple on screen, but a real-time multiplayer game needs a server that every player trusts. This is the story of how I built the backend: the choices I made, what worked, and what I would do differently.

    Starting point: one server is the referee

    In a multiplayer board game nobody should be able to cheat by editing their own browser. So the rule I started with was simple: the server owns the game. The browser sends a move, such as "place an orb in this cell", and the server decides whether it is legal, runs the explosions and sends the result back to everyone in the room.

    I chose Python with FastAPI because it handles WebSocket connections natively, is quick to write and easy to test. React and Vite sit on the front, and the same server serves the built frontend, so the whole game is one small deployable unit.

    Rooms live in memory

    Each game room is a Python object holding the board, the players, whose turn it is and a timer. Keeping rooms in memory makes moves instant, because there is no database round trip on every click. The trade-off is that the server must run as a single worker process, otherwise two players in the same room could land on different workers and see different games.

    That constraint is fine for a game of this size, and I added a cleanup loop that removes empty rooms after five minutes and abandoned ones after a couple of hours, plus a hard cap on the number of rooms, so memory cannot grow without limit.

    The game engine

    The heart of the backend is the engine that resolves a move. It places the orb, checks whether the cell has reached critical mass and, if so, explodes it, sending an orb to each neighbour and flipping them to the mover's colour. Then it repeats for every cell that has become critical, wave after wave, until the board is stable.

    The server does not send every intermediate board to the browser. It sends the first wave in full and then only the cells that changed in each following wave. The browser replays those waves as an animation. This keeps messages small even when a single move sets off dozens of explosions.

    Turns, timers and bots filling in

    Every turn has a timer so a game cannot stall. If a player's connection drops, the server waits a short grace period and then lets a bot play for them, so the remaining players are never stuck. A player who has no legal move is eliminated automatically instead of freezing the game.

    Testing the engine hard

    A game engine bug is painful because players see wrong boards. I wrote tests that play thousands of random games and check invariants after every move, for example that orb counts never go negative and no cell is above critical mass. I also compared the new engine against the old one on tens of thousands of moves to prove they matched.

    The same logic exists in JavaScript for pass and play and the bots, so I replay random games through both implementations and check that they agree move for move. Any mismatch is a bug in one of them.

    What I would do differently

    I would add the endless-chain guard from day one (see the next post), design the room store so it could move to more than one process, and write the replay comparison tests before the second implementation, not after. But the core idea, a small authoritative server and a thin client, has held up well.

    Put it into practice โ†’

    More Atom Reaction guides

    • How to play: The complete rules, critical mass numbers and a worked example of a chain reaction.
    • Strategy guide: Ten practical tips for the opening, middle game, endgame and Battle Royale.
    • Game modes: Online rooms, bots, pass and play, daily puzzle and Battle Royale explained.
    • FAQ: Quick answers about players, bots, accounts and installing the game.
    • Opening moves: Where to place your first orbs and what to avoid in the first five turns.
    • Corner strategy in Atom Reaction: Why corners are the strongest cells and how to build chains out of them.
    • Common Atom Reaction mistakes: Seven mistakes that cost new players games, with a fix for each.
    • Beating the Atom Reaction bots: How each bot level thinks and the habits that beat them.
    • Multiplayer tactics for Atom Reaction: Target selection, kingmaking and surviving a crowded board.
    • Battle Royale survival guide: How the shrinking board works and how to be the last one standing.
    • Two player strategy for Atom Reaction: Tempo, forcing exchanges and corner control in head-to-head games.
    • Reading the board in Atom Reaction: A simple scan routine to spot threats and chains before they happen.
    • Trap patterns in Atom Reaction: The decoy corner, the delayed fuse and the forced capture.
    • Endgame guide: Count orbs, keep reserve moves and finish the last opponent.
    • Choosing the right board size: How the grid size changes pace, tactics and player count.
    • Reviewing your games to improve: Using replay and post-game review to find the move that lost the game.
    • Hosting a game night: Rooms, invite links, spectators, chat and keeping everyone engaged.
    • Playing on your phone: Install it, switch on lite mode and get turn alerts on any phone.
    • Backend challenges we faced and how we fixed them: Endless chains, room floods, rate limits and server hardening.
    • Frontend challenge: why phones got hot and how we fixed it: Cached sprites, frame pacing and lite mode to cool down phones.
    • Making multiplayer reliable: reconnects and dropped connections: Automatic reconnect, seat recovery and bots that cover for dropped players.
    • How the Atom Reaction bots were built: Alpha-beta search, web workers and the experiments that surprised us.
    • Saving games to a database without slowing play: A sleeping PostgreSQL database, background queues and privacy purges.