One birth chart, two games — a branching AI life story and a BaZi-driven roguelike, both generated from your real Four Pillars of Destiny.

Inspiration Chinese BaZi (Four Pillars of Destiny) is a thousand-year-old system that maps your birth time to a unique life path. But to most young people it feels distant, superstitious, or just boring. I wanted to change that. What if your birth chart could become something you actually play — a character that represents your core nature — and AI could bring that character to life? That's how Mingaigam was born: one birth chart, two ways to play it — a branching AI life story, and a roguelike survival game. A way to make ancient wisdom playable, personal, and alive.

What it does Mingaigam turns your birth chart into two playable experiences, both driven by the same BaZi engine. Enter your birth details and the system generates your unique "fate animal" — your day-master element decides its elemental family, and your chart shapes it further.

First, an AI-powered interactive story: choose a world — Reality, Cultivation, or Animal Kingdom — and the AI narrates your life. At each step you make a choice (or type your own action), and a large language model generates the next branch in real time. You can play it as a classic text chat — where the AI narrates your life and generates every choice in real time, fully driven by your BaZi chart — or in a "situational dialogue" mode that reads like a visual novel. In this mode, AI generates the background scenes and anime-style character portraits. The visual design, personality, and dialogue of your protagonist and the NPCs you meet are deeply fused with your birth chart and the specific elemental traits of your unique spirit animal as the plot unfolds. Your animal sets your image, your favorable and unfavorable elements shape your opportunities and setbacks, and your luck cycles set the odds of good and bad events.

Second, "Roguelike Life": the same birth chart becomes a pixel-art character in a top-down survivor game. Every chart produces a unique character, so no two players look the same. By day you gather resources, open chests, and tame spirit animals; by night you fight waves of enemies and a boss built from your luck cycle. The five-element system drives combat, your weapons are the ten Heavenly Stems, and difficulty, drops, and odds all follow your actual BaZi fortune. Survive ten days — ten luck cycles — and your character ages through a lifetime, ending in a black-and-gold ending card, with an AI illustration of your fate animal saved to your personal gallery. As the days pass, your character visibly ages — growing a beard, changing appearance — reflecting the lifetime you are living through. The roguelike also includes background music and sound effects for gathering, combat, opening chests, and placing turrets — making each run feel complete and immersive.

Try it live at mingaigam.com — if the free daily limit is reached, use the higher-quota review build at bazi-animal-life-review.pages.dev.

Key features BaZi Life Story (narrative mode)

Generates your unique "fate animal" from your Four Pillars of Destiny

Three worlds — Reality / Cultivation / Animal Kingdom — with three difficulty levels and two session lengths

Real-time AI narration with clickable choices and free-text actions

Two presentation modes: a classic text chat where AI narrates and generates every choice in real time, or a "situational dialogue" mode that plays like a visual novel (AI-generated background scenes and character portraits fused with your spirit animal's elemental traits)

A black-and-gold shareable ending card (epithet + verdict + QR code)

A personal gallery of your fate animals, plus full Chinese/English bilingual support

Roguelike Life (survivor game)

A unique pixel-art character generated from your exact birth chart (reproducible for the same input)

A day/night loop — explore and gather by day, fight waves by night — 10 days = 10 luck cycles

Five-element combat, ten Heavenly Stem weapons, and a boss shaped by your luck cycle

Spirit-animal taming, resource gathering, turret building, and an achievement system

Characters visibly age over the ten days — growing beards and changing appearance

Background music and sound effects for gathering, combat, chests, and turret placement

Your ending generates an AI fate-animal illustration saved to your gallery

Built with Languages & platform: JavaScript · HTML · CSS · Node.js · Cloudflare Pages · Cloudflare Workers · D1 (SQLite) · Cloudflare Workers AI · Resend

AI: Zhipu GLM (story narration) · Alibaba DashScope (fallback) · Zhipu CogView + Cloudflare Workers AI FLUX (image generation)

Audio: royalty-free background music and sound effects under the Pixabay Content License.

Key techniques: BaZi (Four Pillars) engine · procedural pixel-art generation · serverless functions with rate limiting and auth

How I built it I have no formal computer science training — I built this entire project by leveraging AI coding assistants (like Cursor and Claude) as my pair programmers: I'd describe what I wanted, they'd write the code, and I'd test, debug, and learn as real problems came up. My focus was never flawless architecture; it was shipping a working, playable loop.

The front end is plain HTML, CSS, and JavaScript — no framework — including a custom Canvas 2D game engine (game loop, camera, collision, procedural pixel sprites) written from scratch for the roguelike. The backend is Cloudflare Pages Functions (serverless) with a D1 (SQLite) database for accounts and saved runs. The story mode calls Zhipu's GLM API, and I spent most of my time on prompt engineering so the AI stays inside one world's rules and every event follows the user's BaZi. The BaZi engine itself (day master, five elements, ten stems, luck pillars) is a shared pure-function layer that powers both modes — in the roguelike it shapes your character, your enemies, and your odds. All pixel art is generated in code (no sprite sheets), and fate-animal illustrations are generated with Zhipu CogView and Cloudflare Workers AI (FLUX).

Challenges I ran into The biggest one was that I had no foundation. When the AI generated a broken block of code, I had to debug it without knowing the fundamentals — reading errors, asking "why" a thousand times, and learning just enough to trace what was actually happening. Keeping the AI story coherent over many turns was another fight: early versions forgot earlier choices or broke character, which I fixed by structuring the prompt with a memory summary and hard world rules. I also had to treat BaZi respectfully and accurately without making it feel like a dry fortune-telling app, and learn API integration, asynchronous handling, and rate limits for the first time. And I did all of this alone, during a school holiday, on a shoestring budget — just the AI compute I paid for myself.

What I'm proud of Mingaigam is live and playable — two complete experiences from one birth chart, with every pixel generated in code. I'm proud of how it bridges traditional Chinese culture and cutting-edge AI in a way that feels natural and fun. And I'm proud that a high school student with no formal programming background shipped a custom game engine plus a serverless backend, using AI tools to turn an idea into a real, deployed product.

What I learned I learned that you don't need a formal degree to build something — you need a clear vision, the willingness to learn, and the right AI tools. I learned how to work with large language models (writing prompts that stay consistent and creative, and handling their unpredictability), and the fundamentals of game development (game loop, collision, procedural generation) and full-stack web development (front end, serverless backend, database, deployment). Most importantly, I learned that "I can't code" is not the same thing as "I can't build."

What's next for https://mingaigam.com/ Next, I want to add more worlds, more animal types, and more weapons and bosses so every user can find a story that feels truly theirs. I plan to add AI-generated illustrations for key scenes and characters, user accounts so players can save progress across both modes, and a community feature where users can share their fate animals and endings. My goal is to turn Mingaigam into a place where ancient wisdom meets infinite imagination — one choice, and one run, at a time.

Built With

  • ai
  • chat
  • destiny
  • game
  • history
  • innovate
Share this project:

Updates

Submission history