DEV Community

raslanove
raslanove

Posted on

Insults & Cutlasses, Local LLM Sword Fighting on Melee Island

Gemma 4 Challenge: Build With Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

Insults & Cutlasses is a terminal-based insult sword fighting game inspired by The Secret of Monkey Island.

The player enters a world where victory is not achieved through brute force, but through witty insults, structured comebacks, and AI-judged verbal duels.

Each battle follows a strict loop:

  • The opponent generates an insult
  • The player responds with a comeback
  • A judge evaluates whether the response is strong or weak
  • Points are awarded accordingly
  • First to 3 points wins the duel

After each victory or defeat, a new pirate opponent appears and the journey continues toward the Swordmaster of Melee Island.

This project explores how local LLMs can power structured gameplay systems, turning natural language into a competitive game mechanic rather than a free-form chatbot.

Demo

Code

GitHub repository:
https://github.com/raslanove/InsultsAndCutlasses

How I Used Gemma 4

This project is powered by Gemma 4 E2B IT (quantized GGUF version).

I chose the E2B model because:

  • It has a small enough memory footprint to run locally without a GPU
  • It performs well on CPU-only environments (even consumer laptops)
  • It maintains strong instruction-following behavior compared to other small models
  • It is ideal for embedding into real-time interactive applications like games

Why Gemma 4 was essential

Earlier small models struggled with:

  • Consistent roleplay behavior
  • Structured output formats
  • Maintaining "pirate duel logic" across turns

Gemma 4 significantly improved:

  • Instruction adherence for strict insult/reply/judge formatting
  • Stability in multi-turn interactions
  • Creativity in generating themed pirate insults and comebacks

Fine-tuning (LoRA)

To make the model behave like a true Monkey Island-style insult duel system, I trained a LoRA adapter using a custom dataset:

  • MonkeyIslandStylePirateDuelDataset.jsonl

The dataset teaches the model:

Insult → Reply → Judge
Enter fullscreen mode Exit fullscreen mode

Training was done entirely on CPU:

  • AMD Ryzen 5 PRO 4650G
  • 32GB RAM

The LoRA was trained in:

  • InsultsAndCutlasses.ipynb

This allows the base model to consistently:

  • Generate insults
  • Respond in character
  • Evaluate responses fairly

Top comments (0)