Author Topic: Sync network player's location  (Read 2363 times)

Offline hytparadisee

  • int
  • **
  • Posts: 86
    • View Profile
    • http://peterhi.com
Sync network player's location
« on: November 25, 2006, 04:34:43 am »
I would like more experienced people to share their comments on how to synchronize the current location, current action of avatar of other network players, NPCs and other things you think is necessary to make the scene real in a networked game. Any comments are welcome.
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Sync network player's location
« Reply #1 on: November 26, 2006, 12:07:46 am »
I use a gridded system with each location having a unique id.

Mine is an rpg however.

Games like UT seem to broadcast data about rotations, momentum, etc.

Lag is reduced, because the clients simple interpolate/guess the movements.

EG, if a tank is moving forward at 100km/h, and the client doesnt
get a new packet of data, then its resonable to assume its going to go
in the same direction at the same speed:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline hytparadisee

  • int
  • **
  • Posts: 86
    • View Profile
    • http://peterhi.com
Sync network player's location
« Reply #2 on: November 26, 2006, 09:02:57 am »
Thanks cyberkilla, i think broadcasting a set of critical values and calculate it at the client side is what i am looking for. That would be closer to your second suggestion. And to be more specific, is it like, for example, if a person is walking at a certain speed, all i have to do is to get the location he starts walking, its orientation, and speed and send it to the client to let it do the animation until the other peer stops, and then send its stop location and reflect it to the other peer? That's for synchronization on locations, what about animation frame indices the other network peer is currently playing, should we just ignore them and let the client guess it themselves?
Today I finally found a problem to my soluuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuution

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
Sync network player's location
« Reply #3 on: November 26, 2006, 03:30:27 pm »
No problem:) Im glad I can be of some help.

A few months back, I did read up on this. I found a document on the quake
engine, which was quite helpful. Ill try to track it down for you:).

I use the grid system, as I said above. I use a simple textual message protocol for things like this.
Without going into too much depth, I use TCP for important data, and UDP for positional data, and everything else.

When a player moves on the map, his client sends something like this to the server...
Code: [Select]
move <locationid>
The server then checks that there isnt any speed hacks, and that the new location is next to the old one. If its OK, then it broadcasts a similar message(plus player's id) to all other clients on the same map.

I also have "face <direction>", etc.


For you to properly send data in a 3d game, I cant give the definative answer. I havent looked into this more than I needed to, because it wasnt relevant. I would start trying something like this though....

I would not focus on exact positional data. I would, however send it periodically, to ensure the players are in the right place.

I would focus on sending rotational data(as in, what direction are they facing), and speed. So, velocity essentially.

If you were to implement jumping, you would have to make sure the client knew just how high they could jump.

In answer to your question about synchronised animation frames, I really wouldnt try it hytparadisee:).
There isnt really a need to do it, and people will not really notice the difference.
The IDEAL game to look at with this, is Unreal Tournament!
You just tell the client whats happening and it is up to it to cycle through walking animations, or swinging a sword.


I hope this is even slightly helpful:) I am here a lot now,
so I will try to answer all I can:)

If you happen to be working on a game like UT, then you will need to know how to swap guns and items of clothing on your 3d models.
I am trying to get a foolproof method for this too:)

Edit: Yes, it would be smart to send a stop command when the player stops. It will be tricky, as all things are. But im certain you will get the hang of it. Im just glad I dont have to do any of this right now;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG