.github/workflows | ||
src | ||
.eslintrc.cjs | ||
.gitignore | ||
.release-please-manifest.json | ||
benchmark.js | ||
CHANGELOG.md | ||
package-lock.json | ||
package.json | ||
README.md | ||
release-please-config.json | ||
vite.config.js |
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 => {} }