Skip to main content

Open Mafia Engine

PyPI version Stable Release Docs

Test Python package "open_mafia_engine"

The Open Mafia Engine is a flexible, open-source game engine for Mafia-like games.

See the Wikipedia article for information on what Mafia/Werewolf is.

The Open Mafia Engine actually allows a much broader type of game to be played, with custom roles and very intricate "setups". Most of these custom roles come from either "real-life" games or online forums such as MafiaScum and Bay12Games Mafia Subforum.

Features

  • Event-based architecture, which allows for very complex interactions.
  • Many built-in abilities, victory conditions, etc. (Not "many" yet, but we're working on it!)
  • Games are defined declaratively or using an parametrized GameBuilder.
  • Open source & extensible.

Installing

Install the latest stable version, with recommended dependencies, via pip:

pip install open_mafia_engine[recommended]

See the dev docs to install for local development (using Poetry).

Getting started

This example starts a 5-player "test" mafia game (1 mafioso vs 4 townies):

import open_mafia_engine.api as mafia

builder = mafia.GameBuilder.load("test")
players = ['Alice', 'Bob', 'Charlie', 'Dave', 'Eddie']
game = builder.build(players)

Example Application

This repository includes an example text-based Mafia app, runnable like:

mafia-cli
# or
python -m open_mafia_engine.example.cli

This is what the UI looks like:

Example CLI Application

Release files for open-mafia-engine 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-mafia-engine 0.5.0
File Size Uploaded
open-mafia-engine-0.5.0.tar.gz 52.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for open-mafia-engine 0.5.0
File Interpreter ABI Platform
open_mafia_engine-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 123.7 kB

Release files / open-mafia-engine-0.5.0.tar.gz

Download URL open-mafia-engine-0.5.0.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
89c1f723bf848fa3b393350de16fd346b7a8bb0fbb494af2376d40e9d17d88ce
BLAKE2b-256 checksum
How to use checksums
4506df1be143ce55acc10230a65b066beaef9f05b7033b59f48c48d25d5de367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1033-azure

Release files / open_mafia_engine-0.5.0-py3-none-any.whl

Download URL open_mafia_engine-0.5.0-py3-none-any.whl
Size 71.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e0fbae1e4b1205b69879ff528e4020d07d7e0e52ced9660681df6ba730d7bb7
BLAKE2b-256 checksum
How to use checksums
2140c6fb733eb69e472c489ba5a092f46919a9be7fa149131202a055236cd822
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.2 Linux/5.8.0-1033-azure
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page