Skip to content

obacollins-lab/starkludo

 
 

Repository files navigation

StarkLudo

Ludo game, on Starknet

image

What is StarkLudo?

StarkLudo is a classic board game enjoyed by people of all ages. It’s a game of chance and strategy, where players race their game pieces around the board to be the first to reach the finish spot.

At the start of the game, all players are assigned 4 pieces each. The goal is to move all four pieces to the finish spot through a specific route on the board. Each piece is moved one at a time. Each player takes turn rolling a die, and the output of rolling the die determines how many steps forward a piece can move. The first player that moves all their 4 pieces to the finish spot is declared the winner.

The game can be played by either 2, 3 or four people. In each game, there can only be one loser. For example, if the game is played by 4 people, the first 3 players to reach the finish spot are the winners. The player that reaches first gets the first position, the player that reaches second gets the second position, and the third gets the third position.

How to play

Single player mode:

  1. Launch the app
  2. Connect Wallet
  3. Choose resume a game or start a new game
  4. Select number of players you want to use
  5. Choose user account
  6. Start game

Multiplayer mode:

  1. Launch the app
  2. Connect Wallet
  3. Choose join a game or start a new game
  4. Select number of players you want to use
  5. You get an invitation code to invite another player
  6. Customize your avatar theme color
  7. Choose user account
  8. Start game

Screenshots

Development

Steps to build and run StarkLudo locally

Prerequisites

Ensure you have the prerequisites installed before proceeding. Check here for guide on how to install the prerequisites.

NB: Make sure you have node and npm installed. Run node -v && npm -v on the terminal to check if they are installed else install them.

$ node -v && npm -v
v22.12.0
10.9.0

Install tools

  1. Install pnpm
npm install -g pnpm
  1. Install Dojo
# Install dojoup
curl -L https://install.dojoengine.org | bash

# Install Dojo release
dojoup --version v1.0.5

Build and run StarkLudo

Onchain

Requires 2 terminals to run

In both terminals, ensure you are in the onchain directory. You can navigate into the onchain directory by running this command from the root directory: cd onchain

  • Terminal 1
# Start Katana
katana --dev --dev.no-fee  --http.cors_origins "*"
  • Terminal 2
# Build contracts
sozo build

# Deploy contracts to Katana
sozo migrate

# Run Torii with World address generated from previous command
torii --world <WORLD ADDRESS> --http.cors_origins "*"

To locate the world address, scan through the output generated from running sozo migrate, locate the line similar to:

⛩️  Migration successful with world at address 0x0114263853155c7f3c4209d140a05b106d9ce7f64f75058e2b3ab81fc72cc372

Run contract tests

Use the following command to run the tests for StarkLudo contracts

# Navigate to the contracts directory
cd onchain

# Run tests
sozo test

If you want to run a specific test by the test name, use this command:

sozo test -f test_contract_deployment

test_contract_deployment above is the name of the specific function being tested

For more information about testing, check Dojo book

Client

Please note that Katana and Torii servers needs to be up and running before the client server can run successfully

# Navigate to the client directory
cd client

# Install dependencies
pnpm i

# Run
pnpm dev

License

This project is licensed under the MIT License. See License for more information

Contributing

For more info and guidance on contributing, join the contributors Telegram group: https://t.me/+hnjQooODZOA2M2Rk

About

Ludo game on Starknet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 67.4%
  • SCSS 19.4%
  • Cairo 9.2%
  • CSS 1.7%
  • JavaScript 1.1%
  • HTML 1.1%
  • Shell 0.1%