Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"wantsFullUpdate" & full/half "EntityDescription" #4

Open
morfeus87 opened this issue Mar 20, 2012 · 2 comments
Open

"wantsFullUpdate" & full/half "EntityDescription" #4

morfeus87 opened this issue Mar 20, 2012 · 2 comments

Comments

@morfeus87
Copy link

Hi,
congratulations for this framework, but especially for having released as open-source.
I'm starting to use your framework for the construction of a multiplayer game (or at least I try).
I did some initial adjustment to adapt the framework to the latest version of socketio.

the "constructEntityDescription" In "GameEntity" allows for "wantsFullUpdate" but then not used within the function.
"If true, Certain Things That are only sent When changed are always sent"
You have commented.

What can I do about this parameter?

Another related problem is that I would send over the network initially and then only when asked for a full "EntityDescription" to initialize the object (bodymass, bodyfriction, geometryWidth, geometryHeight etc. ..)
Then inside the loop send a simple "EntityDescription" that contains only "position, rotation and id .."

  • I have to edit the source of the framework, or is already prepared for this?
  • It is connected with "wantsFullUpdate"?

I hope I was clear and I apologize in advance for my English "google translated"

@onedayitwillmake
Copy link
Owner

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

@morfeus87
Copy link
Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants