Welcome to Mafia Undercover, a party deception game brought to the web! Built using Python, Streamlit, and SQLite, this app lets friends join remotely, get assigned secret roles, and play a turn-based game of trust, deduction, and survival.
Players are secretly assigned roles: Mafia, Doctor, Detective, or Villagers.
- Mafia work together to eliminate others.
- Doctor can save someone each night.
- Detective investigates players to uncover the Mafia.
- Villagers try to identify and vote out the Mafia.
- 🔒 Host or join games via unique Game ID
- 👥 Real-time lobby with player list
- 🎭 Random secret role assignment
- 🌙 Night phase with Mafia vote, Doctor save, and Detective investigation
- ☀️ Day phase with public discussion and majority voting
- 🗳️ Vote handling and result resolution
- 📦 SQLite-based persistent backend
- 🔁 Refresh button to update state manually
- Streamlit – for the frontend UI
sqlite3– built-in lightweight database for game persistenceuuid– to generate unique Game IDs
-
Clone the Repository
git clone https://github.com/your-username/mafia-streamlit-game.git cd mafia-streamlit-game -
Install Requirements (Only Streamlit is needed)
pip install streamlit
-
Run the App
streamlit run mafia.py
- Create or Join a Game
- Wait in Lobby until Host starts
- Secret Role Assignment
- Night Phase:
- Mafia vote to kill
- Doctor chooses someone to save
- Detective investigates a player
- Day Phase:
- System reveals if someone died
- Players vote on whom to eliminate
- Repeat until Mafia win or all are caught
- Minimum 4 players required to start.
- Refresh button can be used to sync state manually.
- 🎤 Chatbox / discussion simulation
- 📱 Mobile-friendly styling or PWA support
- 🔐 User login and profiles
MIT License — use it freely in your own projects!
(c) Aritro 'sortira' Shome 2025 - Present