-
-
Common card
-
Rare card
-
Uncommon card
-
Epic card
-
Legendary card
-
Money
-
Bandit
-
Merchant v2
-
Llama with full caravan
-
Merchant in town
-
Background
-
Home Screen
-
Uncommon back
-
Common back
-
Epic back
-
Legendary back
-
Rare back
-
Green Gemstone
-
Necklace
-
Spice v2
-
Spice
-
NPC merchant
-
Painting of a countryside
-
Book Romeo and Juliet
-
Llama caravan
-
Magic books
-
Back ground with fork
-
Background v2
-
Background with city
-
Backgorund with river
-
Golden Ring
-
Silver Bracelet
-
Yellow Gemstone
-
Lona Misa
-
Book Picture of Dorian Grey
Inspiration
Most roguelites live and die by their loot system - but randomized rewards often feel completely disconnected from how you actually play. You can make all the right decisions and still get punished by a bad roll. We wanted to fix that. The Behavioral Variance System was our answer: what if the game secretly watched how you played and nudged the loot and encounters in a direction that at least made sense for your playstyle? Not handholding - just making the randomness feel a little more earned.
What it does
Traveling Merchant Problem is a risk-reward merchant roguelite where you travel dangerous roads between checkpoints, managing gold, food, and cargo. You choose your route, face encounters like bandits and river crossings, trade at town shops, and try to arrive at the end alive and rich. Under the hood, Google Gemini powers our Behavioral Variance System - it silently profiles your decisions as you play and subtly shifts encounter rewards and loot drops to be more favorable toward your playstyle. The randomness is still there, but it's no longer completely blind. The game remembers how you play and rewards you for having a strategy.
How we built it
We built the frontend with vanilla HTML, CSS, and JavaScript - no frameworks, just clean modular files. Game state is managed through a central GameLogic object with a lightweight pub/sub pattern so every component stays in sync. The backend is built in Python with FastAPI, and Google Gemini powers the Behavioral Variance System, analyzing player decisions and adjusting encounter weights in real time. Assets are served statically and the whole stack communicates through a simple REST API.
Challenges we ran into
Building a reactive UI without a framework meant managing state updates manually across every page - getting the inventory, HUD, and shop to stay in sync took more wiring than expected. Integrating Gemini in a way that felt meaningful rather than just cosmetic was also tricky; we had to carefully design the player behavior payload so the model had enough context to make decisions that actually felt personalized.
Impact
We didn't just build a game — we built a mechanic. The Behavioral Variance System is a black box that sits underneath any randomized reward system and makes it smarter. Feed it player behavior, tell it your designer intent, and it shapes what surfaces — without you scripting every possibility. It works in a merchant roguelite today, but the same system drops into any genre that has randomized rewards: a dungeon crawler's loot tables, a card game's draw pool, an RPG's encounter spawner. The interface is the same. The scorer is swappable. The game just gets better at rewarding the player in front of it. Most games average their way to fairness across all players. Ours gets there for each one individually.
What we learned
Vanilla JS is more than capable for a game this size - the lack of a framework forced us to be intentional about structure, which kept the codebase surprisingly clean. We also learned a lot about prompt engineering for Gemini; getting consistent structured outputs from a generative model in a real-time game context requires much more care than a typical chatbot integration.
What's next for Traveling Merchant Problem
We want to expand the encounter roster, add set bonuses for merchandise collections, and build out the full Behavioral Variance System with persistent player profiles across runs. A proper end screen with a final score breakdown, leaderboard support, and more route variety are all on the roadmap. We also want to explore procedurally generated encounter dialogue driven by Gemini so no two runs ever feel the same.
Log in or sign up for Devpost to join the conversation.