> Site index for LLMs: https://www.nandan.fyi/llms.txt

# Chain Reaction

> A strategy game I played obsessively as a kid, rebuilt on the web with 3D rendering and multiplayer.

- Published: 2023-09-24
- Source: https://github.com/nandan-varma/chain
- Live: https://chain.nandanvarma.com
- Canonical: https://www.nandan.fyi/projects/chain

Chain Reaction is a turn-based strategy game where you place orbs in cells and trigger chain explosions across the board. I played it constantly on Android as a kid, but the app got abandoned - slow, outdated, never updated. So I rebuilt it myself, this time in 3D.

## Features

- 3D rendered board using Three.js and React Three Fiber
- Up to 3 players
- Dark mode
- Real-time state via Firebase

## Key decisions

- **React Three Fiber over raw Three.js** — keeps the scene declarative and component-driven; the board state maps naturally to React re-renders rather than imperative scene mutations, which is the right fit for a turn-based game where each move produces a new discrete state
- **Immutable state per turn** — each step produces a new board snapshot; the explosion chain is a sequence of derived states rather than mutations, which makes the animation replay straightforward and keeps the game logic testable
- **Firebase for real-time local multiplayer** — for a shared-screen game the latency requirements are loose enough that Realtime Database handles it without managing a custom WebSocket server

## Future directions

- Online multiplayer (play with friends over the internet, not just locally)
- Configurable board size and player count

## Built with

- [Next.js](https://nextjs.org)
- [Three.js](https://threejs.org) + [React Three Fiber](https://docs.pmnd.rs/react-three-fiber)
- [Firebase](https://firebase.google.com)
- [tailwindcss](https://tailwindcss.com)
- Deployed on [Vercel](https://vercel.com)
