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
feat: new systems pattern #63
Conversation
@@ -120,6 +122,7 @@ async function bootLayers() { | |||
disposeLayer("local"); | |||
disposeLayer("phaser"); | |||
await bootLayers(); | |||
await bootReact(layers as Layers); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reboot react when the network layer reboots, because block streams etc will be different
moveEntity: (entity: EntityIndex, direction: Direction) => { | ||
"no-op for types"; | ||
}, | ||
moveEntity: curry(moveEntity)({ world, actions, network, LocalStamina }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a circular dependency if the api functions take the layer as input, leading to type issues, we need to find a better solution for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
@@ -0,0 +1,90 @@ | |||
"use strict"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to commit these generated files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Removed them
Co-authored-by: Andy Cernera <kooshaba@gmail.com>
|
||
- Systems must implement the `ISystem` interface. | ||
- Systems must declare an ID following this pattern: `uint256 constant ID = uint256(keccak256("<UNIQUE SYSTEM IDENTIFIER>"));` | ||
- System contracs must be named exactly the same as the file containing them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contracs is a typo 🔭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rekt
} | ||
|
||
function requirement(bytes memory) public view returns (bytes memory) { | ||
// NOTE: Make sure to not include this system in a production deployment, as anyone can cahnge all component values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another typo! cahnge 🔍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing work!
* feat: add systems interface, systemsComponent, registerSystem * chore: clean up * feat: add client mappings for componentComponent, systemComponent * fix: fix hot reloading react * feat: wip MoveSystem * feat: remove diamond * feat: add createSystemExecutor * feat: autogenerate system abis and types * refactor: move from facets to systems, remove persona * refactor: integrate LibStamina, GameConfigSystem * chore: clean up * refactor: port LibECS * refactor: split up DebugFacets into ComponentDevSystem and BulkUploadSystem * chore: remove unused params from deploy script * fix: self review * fix: remove unused console log in Component.sol Co-authored-by: Andy Cernera <kooshaba@gmail.com> * build(cli): gitignore build files, build on prepare * fix: typos Co-authored-by: Andy Cernera <kooshaba@gmail.com>
componentComponent
(a component on the world that stores all registered components) andsystemComponent
(a component on the world that stores all registered systems) to automatically and dynamically sync existing components and systems to the client -> next step is to dynamically display systems that entities can call when selecting an entityyarn build
in the contracts folder, thesystems
object on the client (network layer) automatically contains all existing systems and their typed methods (integrated with the txQueue), so developers can simply call existing systems from there.Followups: