-
Notifications
You must be signed in to change notification settings - Fork 330
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
p2.js Multiplayer Game issue #357
Comments
Nevermind, I made a custom flattening script. Now my server can't do world.step(1/30) because it returns a maximum call stack reached error. |
Sending the whole world state every tick is extremely inefficient and practically useless. Try to send as little information as possible. For example, only send positions of the objects that move. Then apply this updates to the client's state. Game networking is a complex task |
I use Socket.IO and P2.js for my real-time multiplayer game Deadswitch 3. It's not possible to emit the world instance to a client (hence the maximum call stack error) due to circular dependencies. Instead, simply send any position/velocity/data changes that occurred. I recommend sending this at a interval, not every frame. Personally I send data updates 5 times a second, and let the client handle interpolation. Let me know if you have any other questions! |
I was trying to make a game with socket.io and p2.js. I was thinking of sending the
world
instance to the client from the server, then having the client render it. I wasn't able to send the instance ofworld
to the client because the object has a circular structure. Any idea of how to tackle this issue?The text was updated successfully, but these errors were encountered: