Giter Club home page Giter Club logo

ecs's Introduction

ecs's People

Contributors

endel avatar will-hart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ecs's Issues

TS declarations not included in build

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

RenderSystem#execute not called in example/client

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?

Client entity instantiated as schema

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.

own_repo

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:

demo_cropped

Platform

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.