Hi, I'm Endel! Creator of Colyseus Multiplayer Framework ⚔️
- 💖 You can support my work via GitHub Sponsors (Also Patreon, or PayPal)
- ️🐦 Follow me on Twitter
- 💬 Discord: endel#2163
- 💬 Telegram: https://t.me/endeld
(NOT READY TO USE) Experimenting with @colyseus/schema + ECSY
License: MIT License
When importing into a project, VS code reports
Cannot find module '@colyseus/ecs' or its corresponding type declarations.ts(2307)
Looking at the @colyseus/ecs
folder in the node_modules there are no declarations in /lib/index.d.ts
hi,
I tried your implementation. And yes I know "it's just an experiment". But it's sound that's it have great potential.
Currently the execute method in Render (System) is not called. It's because the "mandatory: true" in queries field. If I understand correctly it's not the direct problem. You can see it, if you remove the mandatory field.
It's because: the world.entities in client are not correctly updated after "room.onStateChange".
May you help to explain, what can I do, to fix it?
perhaps the enableAutoDecoding method in class World is not fully implemented. There is also an TODO and perhaps entity.components.onRemove and entity.components.onChange must be implemented correctly.
do you have any ideas here?
I have a monorepo which doesn't do a whole lot yet. However when an entity is instantiated client side, the following error appears:
index.js:120 Uncaught TypeError: Cannot read property 'push' of undefined
at MapSchema.entity.components.onAdd (index.js:120)
at eval (Schema.js:804)
at Map.forEach (<anonymous>)
at _.Schema._triggerChanges (Schema.js:794)
at _.Schema.decode (Schema.js:370)
at SchemaSerializer.setState (SchemaSerializer.js:9)
at Room.setState (Room.js:196)
at Room.onMessageCallback (Room.js:178)
at Connection.onMessageCallback (index.js:14)
Looking at the source code location, the following line is causing the exception:
entity['_ComponentTypes'].push(ComponentType)
It looks like the entity doesn't have any of the expected "reflection" types such as _ComponentTypes
. Looking further into the schema decoding, the type
identified for the entity is f _()
on the client, and when the type is instantiated using this.createTypeInstance
only the Schema
constructor is called.
When I do the same debugging in the @colyseus/ecs
example, the client correctly identifies the entity as of type class Entity
and calls the Entity
constructor:
Win 10
Node 12.16.1 and 14.5.0
"@colyseus/ecs": "^0.4.0-alpha.3"
"colyseus": "^0.14.0-alpha.11"
"@colyseus/schema": "^1.0.0-alpha.39"
"colyseus.js": "^0.14.0-alpha.4"
It is possibly something to do with ES2020 in the client's tsconfig
, although I've played around with targets etc on the server/client/game packages without any luck.
{
"compilerOptions": {
"target": "ES2019",
"module": "ES2020",
"lib": ["es2020", "dom", "dom.iterable", "scripthost"],
...
P.S. I'm happy to do more to debug / fix but at this point I'm a bit stumped and don't know where to look next.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.