Skip to content

diptools/dojo-core

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cairo DOJO

  • Cairo 0.10 ECS System
  • Dockerised Devnet
  • Rust testing client
  • Proxy server to relay client requests to networks
  • Bevy game client example
  • Cairo 1 ECS system

Cairo ECS

Develop Cairo with:

// Create StarkNet env then
source ~/cairo_venv/bin/activate

Build the demo contracts by running

protostar build

See (this guide)[https://docs.swmansion.com/protostar/docs/tutorials/installation] for how to install protostar.

Deploy demo contracts by updating the protostar.toml profile that you want to deploy to {testnet, testnet2, devnet}. You will need to locally define the account-address field to the address you want to deploy from and the private-key-path to the file where you will write the private key of the account address you choose.

Then run

./scripts/deploy.sh <profile>

It will default to the profile devnet if none is passed into the script.

Apibara + Devnet

docker-compose up

Proxy

You will need rust installed. Then run the docker then these commands:

// Starts server and connects to devnet
cargo run --bin helloworld-server

// Test client to ping server. This just exists for testing
cargo run --bin helloworld-client

Theory

What's an Entity-Component-System (ECS)?

An ECS system is a way of organizing and managing the architecture of a game or application. ECS stands for "Entity-Component-System", and it is a design pattern that is often used in game development to create reusable and modular code.

In an ECS system, entities are the objects that exist in the game or application, components are the data that defines their attributes and behavior, and systems are the logic that operates on the entities and components to make the game or application work.

ECS systems are known for their flexibility and scalability, which makes them well-suited for large, complex projects.

High level princibles of an ECS

  • Entities are defined by their components, not their behavior
  • Components should be small and focused
  • Systems operate on entities through their components
  • Data should be stored in components, not systems
  • Entities and components should be created and destroyed dynamically

Why put an ECS on-chain?

The benefits of using an entity component system (ECS) in a blockchain application are mainly related to improved flexibility and composability.

Using ECS can help improve flexibility by allowing developers to easily add, remove, or modify the data and behavior of entities without having to make changes to the underlying blockchain infrastructure. This makes it easier to adapt the application to changing requirements or to integrate new features over time.

Additionally, ECS can help improve composability by allowing developers to distribute the data and behavior of entities across different worlds and applications.

But why do we REALLY care about putting stuff on-chain anyways?

Blockchain's characteristics lie in composability and hardness. Stuff put on-chain can be reused permissionlessly, anything running or stored has to obey clearly defined rules. This means we can write completely novel types of apps: not only games but entire worlds with their rulesets and physics. Blockchains allow a whole new range of affordances never leveraged before (see Gubsheep's on-chain gaming thesis and aaaaaaa's thoughts on on-chain gaming).

An ECS is an abstraction that allows us to build up composable worlds easily and truly leverage what the blockchain can do. Build your own world, interact with others, negotiate metaphysics, and endlessly recompose.

It's a permissionless, infinite sandbox that never runs out of sand.

Are there any on-chain ECS?

The chads at Lattice.xyz have built an ECS in Solidity called MUD.

Videos

Since StarkNet has a lot of gaming projects, let's see if we can build an ECS system in Cairo.

ecs

Overall roadmap

Resources

Wanna contribute?

Reach out to @lordofafew and @sylvechv on Twitter

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Cairo 59.4%
  • Rust 16.8%
  • Shell 10.9%
  • TypeScript 9.8%
  • HCL 3.1%