Skip to main content
Tweeted twitter.com/StackGameDev/status/1043379758921330688
added 370 characters in body
Source Link

I've been thinking about this a lot. I am trying to implement a simple multiplayer game but I have difficulty figuring out how to "share the scene". For example, there are non-player entities like trucks and ideally I am thinking I will just send all the connected clients the bus location (x,y) and the rotation angle ,however, I am running into difficulty because the bus rotates each frame so I am wondering how I may achieve that on server-side?

It seems like a really tough nut to crack and I went over countless examples online and I think I just can't conceptually clarify how something like that can be accomplished.

Any ideas will be very appreciated.

EDIT: Somewhat related simplified question is this. How to simulate animation by sending (x,y, angle) from the server to the clients? Is it with setTimeout() on the server-side, what about each client having different frame-rate on their end?

EDIT2: Just to give one more example which I think would clarify. Consider a rotating triangle that all players should see. How do you accomplish this, do you adjust the angle in the server part of the code and then just emit to all players, because then the server side of code needs an update() for that object. Damn I hope I am not poorly expressing myself.

I've been thinking about this a lot. I am trying to implement a simple multiplayer game but I have difficulty figuring out how to "share the scene". For example, there are non-player entities like trucks and ideally I am thinking I will just send all the connected clients the bus location (x,y) and the rotation angle ,however, I am running into difficulty because the bus rotates each frame so I am wondering how I may achieve that on server-side?

It seems like a really tough nut to crack and I went over countless examples online and I think I just can't conceptually clarify how something like that can be accomplished.

Any ideas will be very appreciated.

EDIT: Somewhat related simplified question is this. How to simulate animation by sending (x,y, angle) from the server to the clients? Is it with setTimeout() on the server-side, what about each client having different frame-rate on their end?

I've been thinking about this a lot. I am trying to implement a simple multiplayer game but I have difficulty figuring out how to "share the scene". For example, there are non-player entities like trucks and ideally I am thinking I will just send all the connected clients the bus location (x,y) and the rotation angle ,however, I am running into difficulty because the bus rotates each frame so I am wondering how I may achieve that on server-side?

It seems like a really tough nut to crack and I went over countless examples online and I think I just can't conceptually clarify how something like that can be accomplished.

Any ideas will be very appreciated.

EDIT: Somewhat related simplified question is this. How to simulate animation by sending (x,y, angle) from the server to the clients? Is it with setTimeout() on the server-side, what about each client having different frame-rate on their end?

EDIT2: Just to give one more example which I think would clarify. Consider a rotating triangle that all players should see. How do you accomplish this, do you adjust the angle in the server part of the code and then just emit to all players, because then the server side of code needs an update() for that object. Damn I hope I am not poorly expressing myself.

Source Link

Implementing multiplayer aspect of a simple HTML5 game

I've been thinking about this a lot. I am trying to implement a simple multiplayer game but I have difficulty figuring out how to "share the scene". For example, there are non-player entities like trucks and ideally I am thinking I will just send all the connected clients the bus location (x,y) and the rotation angle ,however, I am running into difficulty because the bus rotates each frame so I am wondering how I may achieve that on server-side?

It seems like a really tough nut to crack and I went over countless examples online and I think I just can't conceptually clarify how something like that can be accomplished.

Any ideas will be very appreciated.

EDIT: Somewhat related simplified question is this. How to simulate animation by sending (x,y, angle) from the server to the clients? Is it with setTimeout() on the server-side, what about each client having different frame-rate on their end?