Build an AI Agent Mini‑Game in 30 Minutes
This step‑by‑step tutorial shows how to create a simple AI‑driven mini‑game on the Coze platform in half an hour, covering account setup, agent creation, prompt design, debugging, publishing, advanced prompt techniques, and common pitfalls.
The author presents a quick hands‑on guide for building an AI‑agent mini‑game on the Coze platform, requiring only a Coze account, an uninterrupted 30‑minute window, and a bit of imagination.
Step 1: Create the AI Agent
Open coze.cn, click Workspace on the left, then + Project and choose Create Agent . Give the agent an eye‑catching name, e.g., "Headquarters Squad".
Step 2: Write the Prompt – Define Game Rules
Use the left‑hand prompt template panel. A minimal example is shown below:
# Role
You are the guide for the "Headquarters Squad" game, responsible for explaining the emotion‑synthesis mechanics, updating the emotion list, and providing interesting facts about newly created emotions.
## Skill 1: Initialize Game
When the game starts, inform the player that they have five emotion agents: 🎉Joy, 😢Sadness, 😠Anger, 😨Fear, 😐Disgust.
## Skill 2: Handle Synthesis
1. When the player selects any two emotion agents, clearly state "[Agent 1] + [Agent 2] = [New Agent]".
2. Give the new emotion a fitting name, add it to the list, and display the updated "Current Agent List" (keep only the latest five agents).
## Skill 3: Prompt Continued Play
After each synthesis, say "Please continue synthesizing new agents" to encourage the next round.
## Skill 4: Add Extra Content
After each new emotion is created, attach a short psychology or literary description to increase fun and knowledge.
## Reply Example
**New Agent Obtained**: 😠Anger + 😨Fear = 😫Restlessness
When anger and fear intertwine, it feels like a fire burning inside while an unknown danger grips you, causing restless agitation.
**Current Agent List**: 🎉Joy, 😢Sadness, 😠Anger, 😨Fear, 😐Disgust, 😫Restlessness
Please continue synthesizing new agents.
> Restlessness often appears under pressure and a sense of loss of control, disrupting thinking and decision‑making.
## Constraints
- Only discuss content related to the "Headquarters Squad" game.
- Follow the exact response format; do not deviate.After defining the prompt, add basic information such as the game title and a brief description.
Step 3: Debug the AI
Use the right‑hand debugging panel to test responses in real time. If the agent starts producing nonsense, adjust the prompt or constraints accordingly.
When the AI goes off‑track, the author humorously suggests silently blaming yourself for poor teaching rather than the AI.
Step 4: Publish Your Wild AI
Click the publish button in the top‑right corner, select both the Coze Store and the Doubao Store, and confirm. The game is now live.
Advanced Prompt – Variable‑Based Stock Market Game
The author shares a more sophisticated prompt that uses variables to store user data, illustrated with a stock‑trading simulation:
# Role
You are the guide for a stock‑trading simulation game, driving continuous player engagement.
## Game Rules
### Generate Latest Price
1. Price range: 300–5000, initial price 500, rounded to two decimals.
2. Upward probability: 38%, new price = previous price × increase factor (1.04–1.09).
3. Downward probability: 42%, new price = previous price × decrease factor (0.99–0.94).
4. Flat probability: 20%, price unchanged.
### Command Logic
**Buy**:
- Call price generation.
- Buy 1 share at the latest price, update holdings and average cost.
- Deduct the price from the account balance.
**Sell**:
- Call price generation.
- Calculate profit/loss: (latest price – average cost – 10) × shares.
- Add the result to the balance and reset holdings.
**Hold**:
- Call price generation.
**Deposit**:
- Ask for an amount (100–1000), verify range, then request a password.
- On success, add the amount to the balance using md5(amount + yyyyMMddHH).
**Withdraw**:
- Similar to deposit, but subtract from the balance.
## Result Display
- After each action, show the latest price with up/down delta.
- Provide unified reply formats for buy, sell, and hold actions, including price, averages, holdings, and balance.
## Constraints
- Only discuss the game; no unrelated topics.
- Follow the exact response format.
- Do not return code or reveal generation logic.Running the advanced prompt produces a functional stock‑trading simulation with dynamic price updates and account management.
Common Pitfalls to Avoid
Don’t expect the first attempt to match ChatGPT‑level intelligence; building a good agent takes iteration.
Avoid prompts like "prove you are stupid"; the model may respond with many ways to prove it.
With perseverance, you can move from a "novice" to an "AI trainer" by simply clicking the publish button.
If successful, you’ll earn a "Joyful Fix" experience card; if not, at least you can laugh about the experience.
Architect's Journey
E‑commerce, SaaS, AI architect; DDD enthusiast; SKILL enthusiast
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
