projects

chain-reaction-reborn2

a polished, modern reimplementation of the classic atomic strategy game with minimax ai.

flutterdartriverpodgo_routerfreezed

Strategic dominance in your pocket. A definitive, cross-platform reimagining of the classic Chain Reaction strategy game, featuring a hybrid rendering engine, background-isolated AI, and a rigorous clean architecture implementation.

The Vision

While the original Chain Reaction concept is timeless, existing implementations often suffered from atom placement bugs (especially prominent since Android 13), poor performance on high-refresh displays, a lack of single-player AI, or rigid codebases that were notoriously hard to maintain.

The engineering goal of this project was to craft the definitive version capable of delivering fluid, 120Hz animations and intricate particle effects. Crucially, the underlying architecture needed to be robust enough to handle complex Minimax calculations without dropping a single frame. This project also served as a comprehensive case study in applying enterprise-grade software engineering principles—specifically Domain-Driven Design—to game development.

Architectural Deep Dive

The application was built entirely with Flutter, structured around a Feature-First Clean Architecture. This ensures a strict separation of concerns between the presentation layer, domain logic, and data sources. Such deep decoupling allows the core game logic to be tested in complete isolation from the UI layer.

State management relies heavily on Riverpod, utilizing automated code generation for type-safe providers and dependency injection throughout the app's lifecycle.

To guarantee perfectly smooth 60fps+ performance during the massive cascading reactions inherent to late-stage play, I devised a split hybrid rendering pipeline:

  • The Grid Layer: Rendered via CustomPainter to ruthlessly minimize the widget tree overhead, which is critical when tracking hundreds of actively updating cells.
  • The Projectile System: Handled via highly efficient overlay widgets designed exclusively for processing complex Bézier curves and dynamic shadow effects.

The Minimax Brain

The computer opponent represents arguably the most complex component of the build. It runs inside a completely separate background isolate utilizing Dart's compute function. By offloading this architectural heavy-lifting, the main thread's UI performance remains buttery smooth even while the AI violently crunches deep heuristic evaluations utilizing the Minimax algorithm combined with sophisticated Alpha-Beta pruning for its decision trees.

Beyond the Board

The final result boasts several advanced capabilities well beyond the core gameplay loop:

  • Intelligent Adversaries: The AI scales seamlessly from pseudo-random moves for beginners to an "Extreme" difficulty employing depth-limited Minimax traversal.
  • Platform Agnostic: First-class compilation support natively across Android, iOS, Windows, Linux, and macOS.
  • Dynamic Theming Engine: Hot-swappable visual themes affecting particles, grids, and backgrounds (such as Earthy, Pastel, or minimalist AMOLED modes).
  • Local Multiplayer: Seamless dynamic state tracking supporting up to 8 simultaneous human players.

Repository Setup

Getting the local development environment running requires standard Flutter tooling:

# Clone the game repository
git clone https://github.com/saatvik333/chain-reaction-reborn.git
cd chain-reaction-reborn

# Install dependencies via Pub
flutter pub get

# Compile and launch on your preferred target
flutter run