Inspiration

Our project began as an odyssey into the unknown territory of AI social dynamics. We wanted to combine the high-stakes social deduction of the classic party game Werewolf (Mafia) with the cozy, nostalgic aesthetic of Stardew Valley. We were driven by a curiosity: Can AI agents actually lie, deduce, and manipulate like humans? We wanted to create a single-player journey that captures the chaos of a group chat argument without needing to organize 7 real friends to play.

What it does

Werewolf Village is a browser-based strategy game where you play as a resident of a cursed pixel-art village. You are matched against 6 AI agents powered by Large Language Models (LLMs).

Dynamic Conversations:

In a real-time chat interface, the AI participants argue, accuse, defend, and make jokes.

Hidden Roles:

A role (Werewolf, Villager, Seer, Witch, or Hunter) is given to you. Additionally, the AI agents play covert roles and behave in accordance with their covert goals.

Strategic Gameplay:

During the day, you must vote to remove suspects, employ special skills (such as investigations or potions) at night, and use chat logs to determine who is lying.

Opponents of Smart AI:

The Werewolf bots openly plan to murder villages while feigning innocence, and the Seer/Witch bots employ

How we built it

We designed a Centralised Multi-Agent System (MAS) in which six different AI personas are conducted by the backend. We employed a "Shared Blackboard" paradigm in place of straightforward chatbots:

Central Orchestration:

The "Ground Truth" of the game (who is alive, whose turn it is) is managed by Server.js.

Context Injection:

The server provides an agent with a dynamic Context Window that includes a strict list of "Dead Players" (to avoid hallucinations) and the most recent chat history when it's their time.

Role-Based Logic:

Using only prompt engineering, we create emergent social deduction gaming by injecting secret system prompts at runtime, instructing one AI to "lie and deflect" (Werewolf) and another to "use logic" (Seer).

Challenges we ran into

AI Hallucinations:

At first, the AI agents would continue conversing with players who had passed away. To force-feed the AI a list of dead players to disregard, we had to put in place a rigorous "Context Injection" approach.

Position Bias:

On Night 1, we observed that the AI Werewolves consistently killed the same player slot (The Hunter). We used a Fisher-Yates shuffle to randomise target lists before sending them to the API after realising that LLMs are biassed towards the first or last item in a list.

Game State Synchronisation:

To avoid conflicting states, handling intricate logic such as "The Witch saves the person the Wolf just killed" required a precise order of operations on the backend (Wolf Action -> Witch Action -> Resolution).

Accomplishments that we're proud of

The Personality System:

We are proud that the bots feel distinct. The Hunter is aggressive, the Seer is cautious, and the Werewolves are genuinely deceptive.

The "Cozy Horror" Vibe:

Successfully blending the cute pixel art assets with the dark theme of murder and betrayal creates a unique atmosphere we really enjoy.

Robust Game Loop:

Building a fully functioning state machine that handles Day/Night cycles, voting ties, win conditions, and unique role abilities (like the Hunter's revenge shot) without crashing.

What we learned

We discovered that modifying a prompt is just as crucial as developing code. Prompt engineering is game design. The gameplay difficulty was significantly altered when "You are a Werewolf" was changed to "You are a Werewolf who must deflect suspicion onto Player 3".

State Management: In addition to synchronous game rules, we now have a better grasp of managing asynchronous events (AI thinking time).

What's next for Werewolf Village

By including an Omniscient Spectator Mode, where deceased players can view concealed roles and converse in a special "Graveyard" channel, we hope to further enhance the deception. We will introduce a "Wolf Den" to increase the complexity by enabling AI werewolves to plot covertly in a private chatroom to divide votes and plan kills. Lastly, we want to add anarchic roles like the Bodyguard and Fool to the roster and eventually enable multiplayer, which will allow genuine friends and AI imposters to coexist in the same lobby.

Built With

Share this project:

Updates