werewolf: A game engine for running werewolf in a chat client

[ bsd3, game, library, program ] [ Propose Tags ] [ Report a vulnerability ]

This engine is based off of Werewolves of Millers Hollow (http:/www.games-wiki.orgwikiWerewolves_of_Millers_Hollow). See https://github.com/hjwylde/werewolf for help on writing chat interfaces.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.3.0.0, 0.3.0.1, 0.3.0.3, 0.3.0.4, 0.3.0.5, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.3.1.3, 0.3.2.0, 0.3.3.0, 0.3.3.1, 0.3.3.2, 0.3.4.0, 0.4.0.0, 0.4.0.1, 0.4.1.0, 0.4.1.1, 0.4.1.2, 0.4.1.3, 0.4.2.0, 0.4.2.1, 0.4.2.2, 0.4.2.3, 0.4.3.0, 0.4.3.1, 0.4.3.2, 0.4.4.0, 0.4.4.1, 0.4.5.0, 0.4.6.0, 0.4.6.1, 0.4.7.0, 0.4.7.1, 0.4.8.0, 0.4.9.0, 0.4.10.0, 0.4.11.0, 0.4.12.0, 0.5.0.0, 0.5.1.0, 0.5.2.0, 0.5.3.0, 0.5.4.0, 1.0.0.0, 1.0.1.0, 1.0.2.0, 1.0.2.1, 1.0.2.2, 1.1.0.0, 1.1.1.0, 1.2.0.0, 1.2.0.1, 1.2.0.2, 1.2.0.3, 1.3.0.0, 1.3.0.1, 1.3.1.0, 1.4.0.0, 1.4.0.1, 1.5.0.0, 1.5.1.0, 1.5.1.1, 1.5.2.0
Change log CHANGELOG.md
Dependencies aeson (>=0.8), base (>=4.8 && <5), containers (>=0.5), directory (>=1.2), extra (>=1.4), filepath (>=1.4), lens (>=4.12), MonadRandom (>=0.4), mtl (>=2.2), optparse-applicative (>=0.11), random-shuffle, text (>=1.2), transformers (>=0.4), werewolf [details]
License BSD-3-Clause
Author Henry J. Wylde
Maintainer public@hjwylde.com
Category Game
Home page https://github.com/hjwylde/werewolf
Source repo head: git clone git@github.com:hjwylde/werewolf
Uploaded by hjwylde at 2016-02-16T05:53:51Z
Distributions Debian:1.5.2.0
Executables werewolf
Downloads 41027 total (178 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-02-16 [all 1 reports]

Readme for werewolf-0.4.2.3

[back to package description]

werewolf

Project Status: Wip - Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status Release

A game engine for running werewolf in a chat client. This engine is based off of Werewolves of Millers Hollow.

Game description

Deep in the American countryside, the little town of Millers Hollow has recently been infiltrated by Werewolves. Each night, murders are committed by the Villagers, who due to some mysterious phenomenon (possibly the greenhouse effect) have become Werewolves. It is now time to take control and eliminate this ancient evil, before the town loses its last few inhabitants.

Objective of the Game:
For the Villagers: lynch all of the Werewolves.
For the Werewolves: devour all of the Villagers.

Roles

The current implemented roles are:

  • Scapegoat.
  • Seer.
  • Villager.
  • Villager-Villager.
  • Werewolf.
  • Witch.

Installing

Installing werewolf is easiest done using either stack (recommended) or Cabal.

Using stack:

stack install werewolf
export PATH=$PATH:~/.local/bin

Using Cabal:

cabal-install werewolf
export PATH=$PATH:~/.cabal/bin

Usage

This section covers how a chat client interacts with the werewolf game engine.

All werewolf commands are designed to be run by a user from the chat client. E.g., to start a game:

> werewolf --caller @foo start --extra-roles seer @bar @baz @qux @quux @corge @grault
{"ok":true,"messages":[
    {"to":null,"message":"A new game of werewolf is starting with @foo, @bar, @baz, @qux, @quux, @corge, @grault!"},
    {"to":null,"message":"The roles in play are Seer (1), Villager (4), Werewolf (2)."},
    {"to":"@foo","message":"You're a Werewolf, along with @baz.\nA shapeshifting townsperson that, at night, hunts the residents of Millers Hollow."},
    ...,
    {"to":null,"message":"Night falls, the village is asleep."},
    {"to":null,"message":"The Seer wakes up."},
    {"to":"@qux","message":"Whose allegiance would you like to see?"}
    ]}

In this example, user @foo ran the start command with the player names as arguments. Note that the calling user, @foo was passed in to the --caller option. All commands require this option.

Any command ran returns a JSON result. The result contains a boolean for whether the command was successful and a list of messages. The to header on a message may either be null---for a public message---or have an intended recipient.

It's the Seer's turn now.

> werewolf --caller @qux see @grault
{"ok":true,"messages":[
    {"to":"@qux","message":"@grault is aligned with the Villagers."},
    {"to":null,"message":"The Werewolves wake up, recognise one another and choose a new victim."},
    {"to":"@foo","message":"Whom would you like to devour?"},
    {"to":"@baz","message":"Whom would you like to devour?"}
    ]}

Let's have the Werewolves, @foo and @baz, vote to devour a Villager.

> werewolf --caller @foo vote @bar
{"ok":true,"messages":[
    {"to":"@baz","message":"@foo voted to devour @bar."}
    ]}
> werewolf --caller @baz vote @bar
{"ok":true,"messages":[
    {"to":"@foo","message":"@baz voted to devour @bar."},
    {"to":null,"message":"The sun rises. Everybody wakes up and opens their eyes..."},
    {"to":null,"message":"As you open them you notice a door broken down and @bar's guts half devoured and spilling out over the cobblestones. From the look of their personal effects, you deduce they were a Villager."},
    {"to":null,"message":"As the village gathers in the town square the town clerk calls for a vote."},
    {"to":null,"message":"Whom would you like to lynch?"}
    ]}

Too bad for @bar. Maybe the village can get some vengeance...

> werewolf --caller @qux vote @foo
{"ok":true,"messages":[]}

This time, even though the command was successful, there are no messages.

> werewolf --caller @qux vote @foo
{"ok":false,"messages":[{"to":["@qux"],"message":"You've already voted!"}]}

Here the command was unsuccessful and an error message is sent to @qux. Even though the command was unsuccessful, the chat client interface probably won't need to do anything special. Relaying the error message back to the user should suffice.

Thus a chat client interface must implement the following:

  • The ability to call werewolf commands. This includes passing the --caller option and arguments correctly. It is possible to only implement the interpret command, which interprets the caller's input.
  • The ability to send resultant messages. Resultant messages may be to everyone or to a specific user.

Commands

See werewolf --help.

Chat clients

Coming soon:

  • Slack