Multiplayer billiards game physics simulation [closed]

一世执手 提交于 2019-12-04 20:05:49

I think that the 3rd one is the best.

But you can make it even better if you compute all the collisions and movement in the server before sending them to the clients (every collisions and movements, etc...) then clients just have to "execute" them.

If you do that you will send the informations only once per shot, that will greatly reduce the network issue.

And as JimR wrote, you should use velocity or movement equation instead of doing small step by small step incremental simulation (like the Runge-Kutta method)

The information that the server send to the client would look like this:

Blackball hit->move from x1,y1 to x2,y2 until time t1
Collision between blackball and ball 6 at time t1
Ball 6 -> move from x3,y3 to x4,y4 until time t3
Blackball -> move from x5,y5 to x6,y6 until time t4
Collision between Ball 6 and Ball 4 at time t3
and so on until nothings move anymore

Also, you are likely to need a bunch of classes representing the differents physics equations and have a way to serialize them to send them to the clients (Java or C# can serialize objects easily).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!