Skip to content

Latest commit

 

History

History
 
 

desiege

Discord Twitter

This is an image

🛡️ Desiege

Desiege - A team-based coordination game built on Starknet.

Desiege is a Massively PvP experience built on StarkNet.

This folder contains Desiege Game contracts. If you're looking for another contract, please see the directory of our Realms Smart Contracts.

Game module overview

Module Function Current Status
TowerDefence The core Desiege contract In review
TowerDefenceStorage Storage variables for Desiege In review
GridMovement Checks movement logic In review
Elements Users can mint Elements In review

Understanding the code

🤔 What is the game?

Players select a team (Light or Dark) and need to coordinate to ensure a victory for their team.

Light players can cast a Shield spell and defend the city.

Dark players can cast an Attack spell and destroy the city.

🏗️ System architecture
  • TODO: Add system architecture @micksabox
📦 Contract hierarchy

  • TODO: Add contract hierarchy @micksabox


Getting Setup

Initial Setup

Clone this repo and use our docker shell to interact with starknet:

git clone git@github.com:BibliothecaForAdventurers/realms-contracts.git
cd realms-contracts
scripts/shell starknet --version

The CLI allows you to deploy to StarkNet and read/write to contracts already deployed. The CLI communicates with a server that StarkNet runs, which bundles the requests, executes the program (contracts are Cairo programs), creates and aggregates validity proofs, then posts them to the Goerli Ethereum testnet. Learn more in the Cairo language and StarkNet docs here, which also has instructions for manual installation if you are not using docker.

Development Workflow

If you are using VSCode, we provide a development container with all required dependencies. When opening VS Code, it should ask you to re-open the project in a container, if it finds the .devcontainer folder. If not, you can open the Command Palette (cmd + shift + p), and run “Remote-Containers: Rebuild and Reopen in Container”.

Outline

Flow:

  1. Compile the contract with the CLI
  2. Test using pytest
  3. Deploy with CLI
  4. Interact using the CLI or the explorer

Compile

The compiler will check the integrity of the code locally. It will also produce an ABI, which is a mapping of the contract functions (used to interact with the contract).

Compile all contracts:

nile compile

Compile an individual contract:

nile compile contracts/desiege/01A_TowerDefence.cairo

Test

Run all github actions tests: scripts/test

Run individual tests

scripts/shell pytest -s testing/l2/desiege/01_TowerDefence_test.py

Deploy

  • TODO: Add deploy instructions here @micksabox

Start up a local StarkNet devnet with:

nile node

Then run the deployment of all the contracts. This uses nile and handles passing addresses between the modules to create a permissions system.

scripts/deploy

Contributing

Modules in progress - TODO: Add Modules in progress here @micksabox
How to Contribute

We encourage pull requests!

  1. Create an issue to describe the improvement you're making. Provide as much detail as possible in the beginning so the team understands your improvement.
  2. Fork the repo so you can make and test changes in your local repository.
  3. Test your changes Follow the procedures for testing in each contract sub-directory (e.g. /contracts/settling_game and make sure your tests (manual and/or automated) pass.
  4. Create a pull request and describe the changes you made. Include a reference to the Issue you created.
  5. Monitor and respond to comments made by the team around code standards and suggestions. Most pull requests will have some back and forth.

If you have further questions, visit #builders-chat in our discord and make sure to reference your issue number.

Thank you for taking the time to make our project better!


External Reading Sources

StarkNet is very new. Best practices are being discovered. We have amalgamated the best resources we think to guide you on your journey.

Guides & Docs
Discords to Join

Realms Repositories

The Realms Settling Game spans a number of repositories:

View the list of repositories in /README.md