Giter Site home page Giter Site logo

doperganger / rollyourown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cartridge-gg/dopewars

0.0 0.0 1.0 78.06 MB

An onchain adaptation of the classic Drug Wars game

Home Page: https://rollyourown.preview.cartridge.gg

Shell 0.49% JavaScript 0.99% TypeScript 80.35% Cairo 18.17%

rollyourown's Introduction

Roll Your Own Banner

Roll Your Own

Github Actions

Roll Your Own is an onchain adaptation of the original Drug Wars game, built on Starknet using the Dojo Engine.

Development

Install the latest Dojo toolchain from releases or follow the installation guide

With Katana

# Start Katana
katana --disable-fee

# Build the game
sozo build

# Migrate the world, this will declare/deploy contracts to katana and take note of the world address
sozo migrate

# Start indexer, graphql endpoint at http://localhost:8080
torii --world {world_address}

# Setup default authorization & initialization
./scripts/default_auth.sh [local]

# Copy manifest.json into web directory & do graphql/ts codegen
./scripts/gen.sh

# Start frontend, located at http://localhost:3000
cd web
yarn install && yarn dev

In Scarb.toml, there is various shortcut defined using scripts. For exemple scarb run migrate will execute sozo migrate then gen.sh / default_auth.sh

sozo build && scarb run migrate

Any errors when doing sozo build ?

This might be because your version of sozo is not correct.

Check the Scarb.toml file and get the rev or tag from the dojo dependency:

[dependencies]
dojo = { git = "https://github.com/dojoengine/dojo.git", rev = "ca2d2e6dd1ef0fe311310ba0728be8743b1d5cc8" }
# or
dojo = { git = "https://github.com/dojoengine/dojo.git", tag = "v0.3.15"}

In this example, this is how we would install the correct rev version:

git clone https://github.com/dojoengine/dojo.git
cd dojo
git checkout ca2d2e6dd1ef0fe311310ba0728be8743b1d5cc8
dojoup -p .

For tagged version, you can use dojoup:

dojoup -v v0.3.15

This will reinstall the binaries in your ~/.dojo/bin folder.

With Madara

TBD

Mechanics

As in the original, players will land in Dope Wars locations, arbitraging the price of drugs in an attempt to stack paper and own the streets.

RYO extends the core game mechanic of arbitraging drugs in different neighborhoods to a multiplayer environment where each player’s actions affect the in-game economy, creating a competitive and evolving environment. During each turn, a player will travel to a neighborhood, review the current market prices for drugs, and decide to Buy or Sell. After each turn is complete, the market prices will be affected by the previous player’s turn, adding a new layer of strategy to the game. Random events affect prices between turns to avoid making the game too deterministic.

Game Loop

The following game loop is repeated until the end condition of the game is reached:

flowchart TD
    A[Join game lobby] -->|Deposit fee + Commit to Loadout| B[Wait for Start]
    B --> |Markets initialized, Loadout revealed|C[Arrives at random location]
    C --> |Buys / Sells drugs on local markets|D[Select next location to travel to]
    D --> |Player travels without incident|END[Turn ends]
    D --> F[Player is Mugged]
    F --> F1[Pay]
    F --> F2[Run]
    F2 --> F12[Win] --> END
    F2 --> L[Lose]
    L --> |Player loses their stash|END
    D --> G[Chased by Cops]
    G --> F1[Pay]
    G --> F2[Run]
    F1 --> F12
    F1 --> L
    END --> |Market prices update|C
Loading

Future improvements

Currently, game initialization state is hidden during the join phase, players commit to a loadout (i.e. their weapons, clothing, etc) and reveal it upon their first turn. Once the game has begun, market state is randomly initialized (each location contains a constant product market) and players can start the game loop. Market state is transparent, players can view the prices at other locations as well as other player balances.

  • Player inventories should be hidden until the game end condition is reached, at which point, they would reveal their current inventory
  • Mugging is currently PVE, eventually, it would be cool to do it PVP, in which case, the mugger should not know the loadout of their target until the mugging is performed. Ideally there is a mechanism to force the "mugger" and "muggee" to reveal their loadout. See https://github.com/FlynnSC/zk-hunt#search

rollyourown's People

Contributors

broody avatar larkooo avatar notv4l avatar tarrencev avatar 0xhatsume avatar makluganteng avatar 0xgavinowen avatar zoemeriet avatar akhercha avatar hug0x0 avatar junichisugiura avatar sparqet avatar

Forkers

0xgavinowen

rollyourown's Issues

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.