Skip to content

steven3002/among-us

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛸 Among Us Game - Built with Cartesi

This is a simple version of the Among Us game, developed using the Cartesi Machine, Cartesi Rollup APIs, and JavaScript as the programming language. The frontend is powered by Cartesi CLI.

🎮 How to Play

  1. Create a Room: Start by creating a room, share your room ID (private, only you and the people in the room can see it) and wait for at least 2 players to join.
  2. Host Responsibilities: The host should start the game and will be the admin responsible for managing vote deadlines and the game state.
  3. Role Assignment: Roles are assigned randomly:
    • The number of imposters is determined by the number of players:
      • 1 to 9 players: Maximum of 1 imposter.
      • 10 to 16 players: Maximum of 3 imposters.
      • 17+ players: Maximum of 5 imposters.
  4. Starting Room: All players begin in the Hall room.
  5. Ship Layout: The game takes place in a ship consisting of 8 rooms.
{
    1: 'Engine Room',
    2: 'Hall',
    3: 'Cafeteria',
    4: 'Electrical',
    5: 'Medbay',
    6: 'Navigation',
    7: 'Reactor',
    8: 'Security',
  }

🗳️ Ejecting Players

  • Players can be ejected by voting them out of the game during a meeting.
  • or players can be killed by the imposter

🏆 Winning the Game

  • Imposters Wins if their number(of imposter) is equal to or greater than the number of crewmates.
  • Crewmates Wins if:
    • The number of imposters reaches 0. i.e through voting out players
    • All tasks are completed.

So, hop in and invite your friends for an exciting game!

📋 Prerequisites

Before setting up the game, ensure you have the following installed on your system:

  1. Node.js (v14 or higher)
  2. Docker
  3. Cartesi Machine & Rollup CLI
    • Install using the official Cartesi documentation:
  4. Git (for cloning the repository)

🔧 Setup Instructions

Follow these steps to set up and run the game locally:

  1. Clone the Repository:

  2. Build the Project: Use the Cartesi CLI to build the project

cartesi build
  1. Run the Game: Start the Cartesi Rollup server to handle game logic:
cartesi run

🕹️ Game Functions

Note: The code is based on a frontend CLI, so the inputs are in the format { "method": , "request": }. Since the system processes input from the terminal as a string, I have included a double JSON.parse to make it easier for you to copy and paste from your JSON-to-String converter.

Also, Note: The game uses (report) for error handling and notifications of failed computations, while (notice) is used for successful computations. Therefore, when you send an input, watch out for both.

Inspect State

Note: inspect outputs are all (report)

.../inspect/<method>
  • mainMenu: Access the main menu.

  • seeRoomsAvialable: View available rooms.

Advance State

-standard payload structure, the standard request type will be given for each method

 { "method": <methodName>, "request"<T>: <T> }

the following are the methods:...

  • menuOption: Select options from the menu.
{"request": { "option": <Number>, "roomID": <String>}}
  • startLobby: Start the game lobby.
{"request": null}
  • killPlayer: Eliminate a player.
{"request": <String(AccountId)>}
  • moveToRoom: Move to a different room.
{"request": <Number>}
  • sabotageRoom: Sabotage a room (should be present in that room).
{"request": null}
  • doTask: Perform a task (should be present in that room).
{"request": null}
  • alert: Start an emergency meeting.
{"request": null}
  • addChat: Add a message to the chat.
{"request": <String>}
  • vote: Vote to eject a player.
{"request": <String(AccountID)>}
  • getMynews: Get personal updates.
{"request": null}
  • getRoomNews: Get room-specific updates.
{"request": null}
  • displayChat: View the chat.
{"request": null}
  • showTask: Display the task status.
{"request": null}
  • gameEnded: Check if the game has ended.
{"request": null}
  • getGameState: Get the current state of the game.
{"request": null}
  • getRoomId: Retrieve the room ID.
{"request": null}
  • seePeopleInRoom: View players in a room.
{"request": null}
  • getRoomTaskState: Get the status of tasks in a room.
{"request": null}
  • getRole: get your current role. ie (imposter or crewmate);
{"request": null}
  • endVotesAndDiscussion: End the voting and discussion phase.
{"request": null}
  • test: Run a bug test.
{"request": null}

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors