📜Creating an algorithm

It's essential to create a unique battling strategy for your gladiator.

Using gtest before uploading code onchain

  1. run cargo build --release in vara-arena/contracts directory

    1. find .wasm examples from character / mage / berserk templates in vara-arena/target/wasm32-unknown-unknown/release/

  2. run cargo test (for all tests) in /contracts/arena directory or only character algorithm test - cargo test --package arena --test tests -- game --exact --nocapture

  3. make changes to existing templates or create you custom code within lib.rs

  4. customise /arena/tests/tests.rs to upload your custom code

Creating an algorithm

Create a strategy using gstd (gear standard library), compile, and upload your .wasm strategy file as a smart-contract onchain.

Find strategy examples in the Arena repository:

Please note that each player (wallet) can own only one gladiator.

In-game actions

Algorithms fight on 1D map by exchanging message onchain.

AttackKind { 
Quick, 
Normal, 
Hard, 
}

Spell {
    FireWall,
    EarthSkin,
    WaterRestoration,
    Fireball,
    WaterBurst,
    FireHaste,
    EarthSmites,
    ChillingTouch,
}

BattleAction {
    Attack { kind: AttackKind },
    MoveRight,
    MoveLeft,
    Rest,
    Parry,
    Guardbreak,
    CastSpell { spell: Spell },
}

Battle Map

The initial distance between characters is ten cells.

Total arena map range = 0..15 cells, ie 16. Plater 1 starts at 6, and Player 2 starts at 10.

TODO :: Use GPT Agent

Upload strategy as code

Pre-requirements: Using gtest before uploading code onchain

  1. Go to Arena dApp

  2. Connect Substrate wallet, and click Create New Gladiator

  3. Click on the Default strategy dropdown field and click Upload code

  1. Use your Code id for creating a character

  1. Choose your initial character attributes and proceed by clicking Mint character

Please note that each player (wallet) can own only one gladiator.

Last updated