Game data to send and syncing...

Started by
9 comments, last by Mindcry 23 years, 4 months ago
I''m designing a small action game. And it will have network support. My problem isn''t writting the transfer stuff itself, i already earned enough experience with that. BUT i would like to discuss how to update the game and sync it. This game wouldn''t be a Dedicated Server/Client system. It''s more like, that everyone can open up a game, and others can join. So when we have 2 players with 8 moving objects: 2 for the players itself 6 computer controlled things (for example an enemy) transfering the x and y coords of every object every frame or even every second would be to much overhead. so i would like to have each computer controlled thing run on every computer and only sync the players itself... Any ideas suggesstions? "¨¨°º©o.,MiNdCRY,.o©º°¨¨" ------------------------------------------ http://mindcry.cjb.net ------------------------------------------
Advertisement
Well, if you seed the random number generator with the same seed on each machine, I beleive they will all produce the same sequence of numbers.

But I wouldn''t be willing to let a game run for any number of minutes without ''sync'' what those npc guys are doing.

Games like WarCraft, AoE, etc. have hundreds of moving guys.
You can send a client update out as one packet
8 things is not much at all! It''s only 80 bytes!
(2 byte ID, 4byte x, 4 byte y) A modem can send 4575 bytes a second, so given a 28byte udp overhead, you can send 40 updates a second.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Yes the sseed must work, at least i imagined it that way.

But how should i sync the game then?
When i have to send all the data all time?
Lets take your example: we have to send the 80bytes packet 30 times a second to up to 8 players.. you see it''s way to much for a internet gameplay... i don''t want to add a requirement for the game that i need a 2mbit connection

and when i only transfer velocity vectors, and only send new ones when it has changed, the game wouldn''T be synced on all computers...

thanks
Kevin
10 updates a second... max. 30 is way too many for most things.
But wouldn''t be the animation on the other machines go jerky?
Yes, you''ll have to use some form of movement prediction, cubic extrapolation, etc...

Basically, you''ll take the vector and velocity of their last couple moves, and determine where they are headed, then render along that path until you get the new position / delta information, where you''ll correct your prediction. You won''t get an update packet for every location, just enough to build the ''path'' that they''re moving on.
Yes, you''ll have to use some form of movement prediction, cubic extrapolation, etc...

Basically, you''ll take the vector and velocity of their last couple moves, and determine where they are headed, then render along that path until you get the new position / delta information, where you''ll correct your prediction. You won''t get an update packet for every location, just enough to build the ''path'' that they''re moving on.
But i may only have at max 20 objects or so, is it worth to write some movement prediction. This is only a small game, and not a 3d shooter or stuff..

Isn''t there another, more simple, way?

Ohh btw you can view the gamedocs etc. at www.mindcry.net -> projects->balloon combat (twice)...
The accessment of how much and what type of movement prediction you should uses depends heavily on what type of a game you are writing.

For example, in a driving game, prediction would be very helpful.

If however, your game is a bumble bee sim, prediction won''t help much.

FYI -- I think starcraft predicts by simply sending a packet saying, "Marine should end up at 50, 25." Each computer than has an identical pathfinding algorthim and calculates their position like that. no other information is communicated unless the marine runs into some enemies. Then the computers sync up and one comp says, "Yes there are seige tanks within range of killing your marines. Does your state say the marines are nearby as well?" Then the two machines sync.

What I think Halflife does is if you shoot where the enemy is according to your local state (say you lost a packet), it still registers a hit. Many ppl have complained about this.

What specifically are the objects and how are they supposed to behave?

quote:Original post by Mindcry

But i may only have at max 20 objects or so, is it worth to write some movement prediction. This is only a small game, and not a 3d shooter or stuff..

Isn''t there another, more simple, way?

Ohh btw you can view the gamedocs etc. at www.mindcry.net -> projects->balloon combat (twice)...


Alexander "DmGoober" Jhinalexjh@online.microsoft.com[Warning! This email account is not attended. All comments are the opinions of an individual employee and are not representative of Microsoft Corporation.]
Here is the link to the design document so you can see the exact game type:
http://www.cdx.sk/userwebs/zdrpg/files/balloon%20fight.doc

the playersarecontrolledvia joystick/keyboard so i don''t know a final destination like in starcraft, which so doesn''t fit for my game.

i first thought about sending only the velocity to each player when the velocity changes. And do the rest of the calculating on each pc, but wouldn''t it go out of sync, cause the packets will be deliverd on differenttimes, and so the velocity will change differently on each pc, what would end in different postiions of the players

This topic is closed to new replies.

Advertisement