Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppSpecific storage solution #767

Open
Tracked by #420
jolestar opened this issue Sep 8, 2023 · 0 comments
Open
Tracked by #420

AppSpecific storage solution #767

jolestar opened this issue Sep 8, 2023 · 0 comments
Labels
skill::move Need the Move language skill to complete the issue skill::rust Need the rust language skill to complete the issue status::design The issue need to do more detail design
Milestone

Comments

@jolestar
Copy link
Contributor

jolestar commented Sep 8, 2023

Using the StorageAbstraction(#20) capability provided by Rooch, we can design a dedicated AppSpecificStorage for the application. The main objectives of this design are twofold:

  1. When synchronizing the application state on the client side, the changes specific to that application can be obtained using filters, reducing synchronization costs.
  2. This is a prerequisite for the State Channels and AppSpecific Layer3. With this design, applications running in state channels or Layer3 don't need to rely on global state.

Here's an example of defining a GameEngine using AppSpecificStorage. This example needs further refinement to implement an ECS(Entity-Component-System)-based GameEngine example.

module game_engine::game_context {
  
    
    struct GameWorld{
     	resources: TypeTable,
    	accounts: Table<adress, GameAccount>,
    }
    
    
    struct ScoreComponent{
       table: Table<u256, score>,
    }
    
    struct MoveComponent{
       table: Table<u256, location>,
    }
    

}

module mygame:move_system{
   
   public fun move(entity: EntityID, &mut MoveComponent, offset){
   		
   }
}

module mygame:game_system{
    
    public fun play(world: &mut GameWorld, player: &signer){
       
    }
}

module mygame::main{
    
    public entry fun play(world: &mut Object<GameWorld>, player: &signer){
       let world = object::borrow_mut(world);
       mygame::game_system::play(&mut world, player: &signer);
    }
}
@jolestar jolestar added this to Rooch Sep 8, 2023
@jolestar jolestar converted this from a draft issue Sep 8, 2023
@jolestar jolestar added status::design The issue need to do more detail design skill::move Need the Move language skill to complete the issue skill::rust Need the rust language skill to complete the issue labels Sep 8, 2023
@jolestar jolestar mentioned this issue Sep 8, 2023
15 tasks
@jolestar jolestar added this to the Rooch v0.3 milestone Sep 8, 2023
@jolestar jolestar modified the milestones: Rooch v0.3, Rooch v0.4 Oct 19, 2023
@jolestar jolestar modified the milestones: Rooch v0.5, Rooch v0.6 May 14, 2024
@jolestar jolestar modified the milestones: Rooch v0.6, TBD Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skill::move Need the Move language skill to complete the issue skill::rust Need the rust language skill to complete the issue status::design The issue need to do more detail design
Projects
Status: No status
Development

No branches or pull requests

1 participant