Inspiration
Bagh-Chal has always been more than a game in our family — it is a memory.
Our father grew up playing it in Nepal, where strategy unfolded on a simple 5×5 grid scratched into wood or drawn on paper. When he later taught us, our “board” was a notebook page and the pieces were colored pencil sketches.
Years later, we wanted to honor that memory — but not by simply recreating it.
We asked ourselves: what if this centuries-old strategy game could exist as a living, breathing 3D world?
Instead of digitizing the board flatly, we rebuilt Bagh-Chal as an immersive three-dimensional experience, transforming a childhood paper sketch into a spatial strategy environment accessible to anyone with a browser.
What It Does
Lunch-n-Luncher is an asymmetric strategy game where:
- Four tigers hunt twenty goats
- Tigers win by capturing five goats through strategic jumps
- Goats win by immobilizing all four tigers
Our 3D implementation includes:
- Fully rendered 3D board built on a traditional (5 * 5) grid
- Interactive, animated game pieces
- Player vs Player (local) mode
- Player vs Computer mode with AI decision-making
- Persistent match history stored in a database
- Smooth camera controls and intuitive interaction system
How We Built It
We architected Bagh-Chal -- Lunch-n-Luncher as a full-stack web application.
Frontend (3D Rendering)
We used React Three Fiber to render the board and pieces in WebGL.
The traditional 2D grid was translated into 3D coordinates while preserving historical connectivity rules.
- TypeScript ensured type safety and predictable state handling
- Tailwind CSS powered UI components outside the canvas
- Smooth animations were handled through controlled state transitions
Game Logic
The gameplay operates in two phases:
- Placement Phase — goats are placed on empty intersections
- Movement Phase — both sides move strategically
The most complex component was implementing tiger capture validation.
A tiger at position ( A ) can capture a goat at ( B ) only if it lands at:
[ C = B + (B - A) ]
Subject to:
- ( A, B, C ) being collinear
- (A → B → C) being legally connected grid points
- ( C ) being empty
We implemented a custom areConnected() validator to enforce traditional Bagh-Chal line constraints — not all adjacent intersections are valid moves.
AI System
We built a rule-based AI opponent that:
- Evaluates board states
- Prioritizes captures when available
- Avoids self-trapping scenarios
- Dynamically switches strategy between aggression and mobility
Future iterations will integrate a minimax algorithm with alpha-beta pruning for deeper strategic play.
Backend & Persistence
- Express.js server for game state APIs
- PostgreSQL database for match history
- Drizzle ORM for structured schema management
This allows players to revisit previous matches and analyze strategies.
Challenges We Faced
3D Grid Translation
Mapping a traditional 2D connectivity graph into 3D space required separating visual positioning from logical adjacency. The board may look spatially continuous, but legal moves depend strictly on historical line rules.
State Synchronization
Managing:
- Turn order
- Phase transitions
- Captured goats
- Piece positions
required building a deterministic state engine independent from rendering logic.
Keeping the 3D scene synchronized with state updates without race conditions was one of our most demanding tasks.
Type Safety & Structure
Initial TypeScript constraints slowed development, but ultimately improved maintainability and reduced runtime errors.
What We Learned
We learned that preserving cultural games demands more than copying rules — it requires understanding the geometry and decision theory that make them timeless.
Technically, we learned how to:
- Bridge declarative React patterns with imperative 3D rendering
- Separate game logic from rendering logic for cleaner architecture
- Model spatial graph connectivity independent of visual representation
Most importantly, we learned that technology can serve as a bridge between generations — transforming pencil sketches into interactive worlds that reach a global audience.
What's Next
- Real-time online multiplayer using WebSockets
- Advanced AI with minimax + alpha-beta pruning
- Mobile-optimized 3D controls
- Interactive tutorial mode for new players
- Global leaderboards and analytics
Bagh-Chal began as a board drawn on paper.
Today, it exists as an immersive 3D strategy experience — and this is only the beginning.
Built With
- build
- css
- database:
- drizzle
- express.js
- javascript-frontend-framework:-react-3d-graphics:-react-three-fiber
- node.js
- orm
- postgresql
- react
- runtime:
- three.js-styling:-tailwind-css-backend:-node.js
- typescript
- vite
Log in or sign up for Devpost to join the conversation.