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.
- 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.
- Host Responsibilities: The host should start the game and will be the admin responsible for managing vote deadlines and the game state.
- 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.
- The number of imposters is determined by the number of players:
- Starting Room: All players begin in the Hall room.
- 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',
}- Players can be ejected by voting them out of the game during a meeting.
- or players can be killed by the imposter
- 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.
Before setting up the game, ensure you have the following installed on your system:
- Node.js (v14 or higher)
- Docker
- Cartesi Machine & Rollup CLI
- Install using the official Cartesi documentation:
- Git (for cloning the repository)
Follow these steps to set up and run the game locally:
-
Clone the Repository:
-
Build the Project: Use the Cartesi CLI to build the project
cartesi build- Run the Game: Start the Cartesi Rollup server to handle game logic:
cartesi runNote: 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.
Note: inspect outputs are all (report)
.../inspect/<method>-
mainMenu: Access the main menu. -
seeRoomsAvialable: View available rooms.
-standard payload structure, the standard request type will be given for each method
{ "method": <methodName>, "request"<T>: <T> }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}