Git Product home page Git Product logo

meet244 / mafia Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 961 KB

Mafia ๐ŸŽญ is a fast-paced social deduction game where players take on roles like Mafia, Doctor, Prankster and Police. ๐Ÿ•ต๏ธโ€โ™‚๏ธ Use deception and strategy to outwit your opponents in this thrilling game of survival. ๐Ÿ’€ Can you identify the Mafia or survive as one?

Home Page: https://mafia-play.vercel.app/

License: MIT License

Python 13.38% HTML 86.62%
mafia mafia-game web-game wolvesville multiplayer roleplay social-game web-game-development

mafia's Introduction

Frame 22

Mafia is a thrilling social deduction game where deception and strategy are key to survival. This game is developed using HTML, CSS, and JavaScript, with a Flask backend hosted on Vercel. Playable on both mobile and desktop screens, Mafia offers an engaging experience for all players. The game includes sound effects to enhance the experience, with audio cues for kills, votes, and other key moments.

Game Rules

Roles ๐ŸŽญ

  1. Mafia (Killer) - Kills one person per night.๐Ÿ”ช

  2. Doctor - Saves one person per night.๐Ÿฉบ

  3. Police - Investigates one person per night to determine if they are the Mafia.๐Ÿ‘ฎโ€โ™‚๏ธ

  4. Prankster - Pranks one person per night, preventing them from using their power.๐ŸŽญ

  5. Civilian (Villager) - A normal villager with no special powers.๐Ÿ‘ค

Game Flow ๐ŸŒ™๐ŸŒž

Joining the Game ๐ŸŒ

Go to MAFIA website. Enter your name and join a room. You can create a new room or join an existing one. The host will start the game, and each player will receive a role card.

Night Phase ๐ŸŒ™

Depending on your role, you will perform the following actions:

  • Mafia: Choose one player to kill.๐Ÿ’€
  • Doctor: Choose one player to save.๐Ÿ›ก๏ธ
  • Police: Choose one player to investigate.๐Ÿ”
  • Prankster: Choose one player to prank.๐ŸŽ‰
  • Civilian: Your choice does not affect the game.๐Ÿ‘ค

Day Phase ๐ŸŒž

  • Discussion Round: Players discuss who they think the Mafia is.๐Ÿ—ฃ๏ธ
  • Voting Round: Players vote on who they think the Mafia is.๐Ÿ—ณ๏ธ
  • Voting Results: If the Mafia is voted out, the game ends. If not, the game continues to the next night phase.โ™ป๏ธ

Winning the Game ๐Ÿ†

The game continues until either the Mafia is voted out or the Mafia successfully kills all other players.

Screenshots ๐Ÿ“ธ


Mobile ๐Ÿ“ฑ m1 m2 m3 m4 m5 m6 m7

Desktop ๐Ÿ’ป pc1 pc2 pc3 pc4

Game Flow Diagram ๐ŸŽจ

For a visual representation of the game flow and states, refer to the diagram given below.

image 10 (1)

Game Designs ๐ŸŽจ

Website designs (low fidelity) ๐Ÿ“:
Designs (low fidelity)

All game dev components used can be found here.

File Structure

Mafia game project structure:

  • API Folder ๐Ÿ“
    1. app.py: Main server file.๐Ÿ–ฅ๏ธ

    2. templates folder:๐Ÿ“„

      • create.html: Create a new game room.
      • index.html: Check if the game is working (old play.html).
      • join.html: Join a game room.
      • landing.html: Landing page for the main game.
      • main.html: Previous landing page (old landing.html).
      • play.html: Main file for playing the game.
      • spectator.html: Spectator page to watch the game.
      • UI.html: Basic UI components for development.
    3. Static folder:๐Ÿ–ผ๏ธ๐Ÿ”Š

      • assets folder: SVG images.
      • audio folder: Audio files.
      • images folder: JPG or PNG images.

Background ๐Ÿ“œ

The game was inspired by the traditional Mafia game played with friends using chats and a human host. This digital version automates the process, making it faster and more convenient, allowing everyone to participate without the need for a dedicated host.

How we used to play... ๐ŸŽฒ

We used to make paper chits or cards, and in those chits, we would write the names of the roles like Civilian, Mafia, Police, and others. These chits were then distributed among the players. There would be a god or a host who controlled the entire game. The host would ask everyone to close their eyes, then call on the Mafia to open their eyes and choose someone to kill. Afterward, the Doctor would open their eyes and choose someone to save. The game was very sequential, with each role acting one after another, making the process quite lengthy and sometimes frustratingly slow. The entire game took a lot of time.

Additionally, some players used to cheat between rounds, trying to gain an advantage by peeking or signaling to each other. This added an extra layer of challenge and suspicion to the game.

Chits game

Contribution ๐Ÿค

If you encounter any issues or have suggestions for improvements, feel free to raise an issue or contribute to the project.


Thank you for playing Mafia! Enjoy the game and may the best detective win.๐Ÿ•ต๏ธโ€โ™‚๏ธ

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.