DEV Community

Cover image for Unit 3 Has 3 HP and I Have an Open-Weight Dungeon Master
Jahnavi S T
Jahnavi S T

Posted on

Unit 3 Has 3 HP and I Have an Open-Weight Dungeon Master

Hacktoberfest Weekend Challenge: Build for a Friend Submission ๐Ÿค

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

What I Built

Syllabus Dungeon: a text RPG where my friend's syllabus is the map and an open-weight AI is the Dungeon Master.

My friend has a DBMS exam coming up, and Unit 3 (normalization) is her villain. Flashcard apps just give her red crosses and a dead streak, which makes studying feel worse. I can't study for her, so I turned the syllabus into a dungeon:

  • ๐Ÿšช Each unit is a room
  • ๐Ÿ‘พ Each topic is a monster with 3 HP
  • โœ… Right answer: the monster loses 1 HP
  • โŒ Wrong answer: you lose 10 HP and the DM explains the right answer
  • ๐Ÿšฉ Weak topics get tracked and come back later

Normalization became the Cursed Swamp, and its first guardian is the Normalization Slime.

Demo

The Dungeon Master greets the player and waits for notes.

Dungeon Master greeting the player and asking for notes

Correct answer: the Normalization Slime goes down to 0/3, and the DM quotes the exact line from my notes as proof.

Dungeon Master quoting the notes as proof after a correct answer, with the Normalization Slime at 0/3 HP

Wrong answer: I deliberately swapped 2NF and 3NF. The DM caught it, explained the right answer, took 10 HP off me, and added "2NF vs 3NF" to my weak topics.

Dungeon Master explaining the correct 2NF and 3NF definitions after a wrong answer and adding it to weak topics

Status screen. This one also shows a bug: I never set a starting HP, so the DM invented 100 on the spot. The final prompt in the repo fixes it.

Player status screen showing 90 of 100 HP, 0 rooms cleared and the weak topic 2NF vs 3NF

Full real test session, bugs included: demo_transcript.txt

Code

โš”๏ธ๐Ÿฐ Syllabus Dungeon

๐Ÿ‰ Your syllabus is the dungeon. Your exam is the final boss.

A text RPG where an AI Dungeon Master turns your own notes into monster fights. ๐ŸŽฎ Built for a friend who kept losing to Unit 3 (Normalization). ๐Ÿธ

๐ŸŽƒ Made for the Hacktoberfest Weekend Challenge: Build for a Friend

๐ŸŽฒ How it works

  • ๐Ÿšช Unit = room
  • ๐Ÿ‘พ Topic = monster with 3 HP
  • โœ… Right answer = monster loses 1 HP
  • โŒ Wrong answer = you lose 10 HP + the DM explains it
  • ๐Ÿšฉ Weak topics come back to haunt you

๐Ÿš€ Play in 5 minutes (no install)

  1. ๐ŸŒ Open Google AI Studio and pick Gemma 4 31B IT
  2. ๐Ÿ“œ Paste dm_prompt.txt
  3. ๐Ÿ“– Paste your notes (or sample_notes.txt)
  4. โš”๏ธ Fight!

๐Ÿ› Real bugs I hit

  • ๐Ÿซฃ The DM leaked the answer under the question โ†’ now it shows the source lineโ€ฆ

How I Built It

The whole game is one system prompt running on Gemma 4 31B IT, an open-weight model from Google DeepMind. I used it through Google AI Studio because my laptop doesn't have the storage for a local install. The prompt is the game engine: it sets the rules, the HP, the roast tone, and the "ask only from my notes" constraint.

I tested it myself, playing as my friend and deliberately mixing right and wrong answers to check both paths. Two real bugs came up:

  1. The DM leaked the answer. My first rule said to quote the exact line from the notes with every question. It did, and printed the answer right under the question. I changed the rule so the quote appears only after you answer, as proof.
  2. The DM invented a starting HP. I never set one, so it made up 100 on the spot and admitted it. The final prompt now sets 100 HP and 10 damage per wrong answer.

There was also a constraint I couldn't fix: AI Studio forces Google Search grounding on for Gemma, which goes against "only use my notes." I handled it in the prompt (no web search or outside knowledge), and the real fix is running Gemma through the API or Ollama.

What My Friend Said

She hasn't played it yet. I'm sending it to her tonight, and I'll update this post with her real reaction once she's fought the Slime. Until then, everything above comes from my own test run, where I played as her and deliberately mixed right and wrong answers.

Why Does Open Innovation Matter?

  • Gemma is open-weight, so the game isn't tied to one company's API. The same prompt works with any capable model, including a local one through Ollama.
  • When the DM misbehaved, I rewrote its rules and re-tested in minutes.
  • It cost โ‚น0 to build and costs โ‚น0 for her to play.
  • Next step: run it fully locally so a student's notes never leave their device. Hosted AI Studio was a trade-off I made because of storage limits, and I'd rather be upfront about that than pretend otherwise.

Prize Categories

  • Best Use of Gemma: Gemma 4 31B IT is the Dungeon Master, handling every question, fight, and weak-topic callback.

Top comments (0)