๐ต Web Server Application For Mafia Game Playing On Local Network
Playing mafia game made easy simply by having:
- a system to run mafia on it (We call it FekroBot)
- a hotspot that can provide a local host for us (your WIFI modem or your mobile hotspot)
There you go, lets play some mafia ๐.
After cloning into mafia using command bellow:
$ git clone https://github.com/sadrasabouri/mafia
You should do these tiny steps:
- [Install pip3]
First check if you have pip3
installed in your system:
$ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
if you already have installed pip3
you should see something like above, otherwise run the command bellow to install it:
$ sudo apt install python3-pip
- Instaling requiremets:
Then install mafia requirements by
$ pip3 install -r requirements.txt
- Run the server application
Now everything is ready, lets play:
run the command $python3 mafia.py number_of_players[int]
, for example imagine you want to play mafia with 5 players.
$ python3 mafia.py 5
- Getting roles
There you go, now each player can open a browser and type serverhost:port_name
.
In defualt mode your address should be server_ip:5000
.
What player should see in the browser |
---|
![]() |
- Tracing roles from commandline
After each role assignment a message will be prompt to GOD's commandline which inform players ip, id and his/her role, players should inform the GOD with thier unique id so that GOD can find who is who.
What GOD should see in the CLI |
---|
![]() |
Mafia is a social deduction game, created by Dimitry Davidoff in 1986. The game models a conflict between two groups: an informed minority (the mafia team), and an uninformed majority (the Residents). At the start of the game, each player is secretly assigned a role affiliated with one of these teams. The game has two alternating phases:
- Night Phase
a night role during which those with night killing powers may covertly kill other players
All players close their eyes. The GOD then instructs all Mafias to open their eyes and acknowledge their accomplices. The mafias suggest a "victim" by silently gesturing to indicate their target and to show unanimity then Don (Mafia's head) should decide whom to be killed then close their eyes again. A similar process occurs for other roles with nightly actions. In the case of the Detector, the GOD may indicate the target's innocence or guilt by using gestures such as nodding or head shaking.
- Day Phase
a day role, in which surviving players debate the identities of players and vote to eliminate a suspect.
The GOD instructs players to open their eyes. Discussion ensues among the living players. At any point, a player may accuse someone of being a mafia and prompt others to vote to eliminate them. If over half of the players do so, the accused person should go to the court.Players which goes to the court may have a speech defending theirselves from not being mafia, then GOD should take votes again and this time the player with maximum vote will dead and night begins. Otherwise, the phase continues until an elimination occurs. Dead players are not permitted to attempt to influence the remainder of the game.Because players have more freedom to deliberate, days tend to be longer than nights.
The game continues until a faction achieves its win condition; for the Residents, this usually means eliminating the whole mafia team, while for the minority this usually means reaching numerical parity with the Residents.
Icons made by Vectors Market and Pixel perfect from www.flaticon.com.
Sounds from Soundjay.