Giter Club home page Giter Club logo

Comments (2)

onedayitwillmake avatar onedayitwillmake commented on May 19, 2024

Hi morfeus87,

Thank you - and please be sure to make an official fork and put any changes you've made updating the code back into the stream.

I will look at your question in a little more detail later, but yes that should be possible in the framework in fact if you look at the DemoBox2D you can see how I approach this.

The gist of it is that, the framework will automatically call 'createEntityFromDesc' (which you should overwrite for your specific game) on the client side, when it comes across an entity it didn't have in the last frame. On the server side whatever information included it will be passed.

So what I would do - create for your game a GameEntity subclass that is 'smart' about it's first call to 'constructEntityDescription' with a firstUpdate flag or something that only publishes those extra details once.....

From a performance point of view, don't do anything 'too javascripty' such as removing and deleting and recreating the prototype chain after the first update, as this will most likely remove the function as a candidate for optimization by V8...
This talk explains what i mean http://www.youtube.com/watch?v=XAqIpGU8ZZk - lots of good info in there for creating a js multiplayer engine running on v8

from realtimemultiplayernodejs.

morfeus87 avatar morfeus87 commented on May 19, 2024

I have already created a subclass "PlayerEntity" extending "GameEntity" that has inside a method "constructEntityDescription" as your commented example in "GameEntity".

But the method "constructEntityDescription" is not only called on the server?
Calling this method the first time I set the flag "firstUpdate" to false on this entity, but then the next client will not receive the full version of the entity description. I'm wrong?
I do not understand :(

ps: I had already watched the video on youtube and found it really interesting, along with almost all other Google Video Team and GDC12 video.
Unfortunately, there is already Ammo.js doing 'too much javascript'

ps2: my changes seem fairly home-made even if they are working. However if you want I can make a official fork.

Thank you for your attention!

from realtimemultiplayernodejs.

Related Issues (15)

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.