The repository already contains the dojo-starter
as a submodule. Feel free to remove it if you prefer.
Prerequisites: First and foremost, ensure that Dojo is installed on your system. If it isn't, you can easily get it set up with:
curl -L https://install.dojoengine.org | bash
Followed by:
dojoup
For an in-depth setup guide, consult the Dojo book.
After cloning the project, execute the following:
- init submodule
git submodule update --init --recursive
- Terminal 1 - Katana:
cd dojo-starter && katana --disable-fee
- Terminal 2 - Contracts:
cd dojo-starter && sozo build && sozo migrate
This template uses the dojo-starter
contract as a base. To connect to your game an player, you will need to update the following:
private string systemAddress = "SYSTEM_ADDRESS"; // gotten from sozo migrate
private string playerAddress = "PLAYER_ADDRESS"; // gotten from Katana
private string playerKey = "PLAYER_PRIVATE_KEY"; // gotten from Katana
You can execute a game function by calling the Execute
method. The first argument is the model name, and the second is an array of arguments.
void Execute(string model, string[] args)
// Examples
// Spawning a new Player
string[] spwanArgs = new string[] { };
Execute("spawn", spwanArgs); // replace `spawn` with your model name and `spawnArgs` with your arguments
// Moving the Player to the left
string[] moveArgs = new string[] { "1" };
Execute("move", moveArgs);
You can also call the GetData
method to get the current state of the game. The first argument is the model name, and the second is an array of arguments.
string GetData(string model, string[] args)