|
Vehicle game multiplayer
#240205
12/09/08 23:26
12/09/08 23:26
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
Hey, I'm working on vehicle(physics) multiplayer game with ANet plugin and so far it works but when testing over internet it's very very laggy. When testing over localhost (1 host, 1 client) i get 48kb/s sent and 48kb/s received for host and 22kb/s sent and 22kb/s received data for the client. this is a lot, right? each car is moved on it's own pc and then it its entity on other clients + 4 tires also. does anyone know how can i make that traffic smaller? where should i do car movement and how should i update its position? ______________________________________________________________ p.s. you dont need to be familiar with ANet., just if you know any good idea or how it is done on all other car MP games, please let me know
Ubi bene, ibi Patria.
|
|
|
Re: Vehicle game multiplayer
[Re: croman]
#240247
12/10/08 08:23
12/10/08 08:23
|
Joined: May 2008
Posts: 301
Oxy
Senior Member
|
Senior Member
Joined: May 2008
Posts: 301
|
If you send 48000 bytes thats every second, you definetely send 99% unnecicary data to display a car movement.
As rough example: 5 position updates for each car per second with x,y,z, angle and velocity values would need only about 160 bytes per second for the actual data, for 4 cars 640bytes + the overhead. Lets say with sending other information plus the requires overhead, 1 to 2 kiloby/second should be an optimal target.
Moving a car on the client has the advantage of fast reachtion, but will give you problems with synconous interaction (like collisions), so:
-Move all cars only on the server. -send 5 to 10 times per second the x,y,z,pan,tilt,roll and x,y,z velovity values to the clients -interpolate the data manually, and position the cars on the clients
-clients only send the movement commands 5 to 10 times per second to the server
|
|
|
Re: Vehicle game multiplayer
[Re: Oxy]
#240319
12/10/08 14:08
12/10/08 14:08
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Moving something on the server is realy chewy on the client that moves the car. Just imagin, it will need the whole ping (to the server and back) until he sees his car moving.
I would still move the car on the client. Collision is not a big problem if you use collision detection also on the client when interpolating (Of course this could create wrong positions but if you update the positions from time to time, this shouldn't be a problem).
There are a lot of methods and tricks how something could be done. You should do a little testing, and playing around to see which one works best for you!
You could also search the net for good ideas.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Vehicle game multiplayer
[Re: Oxy]
#240330
12/10/08 14:50
12/10/08 14:50
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
You are rigth, I thought he want's to develope for the internet, because he said that he tested it over the internet.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: Vehicle game multiplayer
[Re: Dark_samurai]
#240345
12/10/08 15:21
12/10/08 15:21
|
Joined: Nov 2007
Posts: 1,032 Croatia
croman
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,032
Croatia
|
thnx both of you for your ideas/comments. my main target is playing over internet.
i'll try your method now, Oxy
Ubi bene, ibi Patria.
|
|
|
|