This example is not a complete or fully functional implementation of the game. Instead, it is a basic demonstration that illustrates how to integrate C&C (Crypts And Caverns) into the game world.
A simple game example
Requires Dojo to implement player movement
interface
#[starknet::interface]
trait ICryptsAndCaverns<TState> {
fn owner_of(self: @TState, token_id: u256);
fn get_svg(self: @TState, token_id: u256);
fn generate_dungeon(self: @TState, token_id: u256);
fn get_seed(self: @TState, token_id: u256);
fn mint(ref self: TState);
}
- Player
- Map
- Movement
- Parsing CC map data using Cairo, which can depend on the CC library
- Implementing new map generation based on the CC library, without using the mint form
- Allowing the player to move on the map and interact with local katana
- Implementing points of interest and teleportation points
Omitting the installation of Rust, Cairo, and Scarb.
- Clone the source code:
git clone https://github.com/CheDAOLabs/cc-dojo-map.git
- Execute the script, specifying the Dojo version:
dojoup
- Start Katana:
katana --disable-fee --invoke-max-steps 4294967295
- Compile the contract:
sozo build
- Deploy the contract:
sozo migrate --name cc_dojo_map
- Indexer
torii --world WORLD_ADDRESS
- Invoke the contract:
sozo execute CC_CONTRACT_ADDRESS test
1.Build the frontend:
cd client
yarn
2.Run:
yarn dev
3.Open the following link and use the 'WASD' keys to control movement:
http://localhost:5173/
Name | Description |
---|---|
client | for testnet c&c |
client3 | for katana c&c |
Name | Version | Compatibility Dojo version | Coments |
---|---|---|---|
cc-dojo-map | v0.1.0 | v0.2.3 | testnet C&C integrated into Dojo |
cc-dojo-map | v0.2.0 | v0.3.0-rc9 | update dojo to v0.3.0-rc9 |
cc-dojo-map | v0.2.1 | v0.3.0 | update dojo to v0.3.0 |
cc-dojo-map | v0.3.0 | v0.3.0 | C&C deployed in Katana |