779 B
779 B
ecstc
This is a library.
ECS
Entities
Components
Systems
Queries
Serialization
ecstc
works with crunches
for binary serialization:
import {Codecs} from 'crunches';
import {Ecs, registerCodecs} from 'ecstc';
registerCodecs(Codecs);
const ecs = new Ecs({Components: {}, Systems: {}});
ecs.create(); // now has entity ID: 1 with no components
const schema = new Schema({ecs, type: 'ecstc-ecs'});
const view = schema.allocate(ecs.entities);
schema.encode(ecs.entities, view);
console.log(schema.decode(view)) // Map(1) { 1 => {} }
// or,
schema.encode(ecs.diff(), view);
console.log(schema.decode(view)) // Map(1) { 1 => {} }