Awesome
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.
demonstrate
crypts and caverns example
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);
}
Components
- Player
- Map
Systems
- Movement
Split into several stages
- 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
How to build
Omitting the installation of Rust, Cairo, and Scarb.
build backend
- 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
- Indexer
torii --world WORLD_ADDRESS
- Add auth
cd scripts & sh default_auth.sh & sh cc_auth.sh
- Invoke the contract:
sozo execute CC_CONTRACT_ADDRESS test
build client
Start the React app.
cd client3
yarn
yarn dev
http://localhost:5173/
Project Structure
Name | Description |
---|---|
client | for testnet c&c |
client3 | for katana c&c |
Version Check
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 |
cc-dojo-map | v0.3.15 | v0.3.15 | update dojo to v0.3.15 |
cc-dojo-map | v0.4.0 | v0.4.0 | update dojo to v0.4.0 |
cc-dojo-map | v0.4.2 | v0.4.2 | update dojo to v0.4.2 |