jobez / cairo-ecs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cairo DOJO

A Monorepo containing:

  • Cairo ECS System
  • Dockerised Devnet
  • [] Bevy Game client

Create StarkNet env then

source ~/cairo_venv/bin/activate

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


Languages

Language:Cairo 94.2%Language:HCL 5.8%