Archived

This topic is now archived and is closed to further replies.

Multiplayer design?

This topic is 6273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Lets explain the situation: I''ve got 2 or more people running around on a background. It''s a multiplayer game, so i have a central/dedicated server. When 1 player moves i send his future x and y coordinates to the server. The server collects all x and y coordinates from all players and send them at regular intervals to every client (only 1 packet, with all x and y coordinates from all clients). When the client receives the data, he change the position of the players. It wil be played on the internet, so it will use udp. Is this "design" correct? and will there be no problems? Can somebody give me some advice to make it better? Thanks! Tint

Share this post


Link to post
Share on other sites
Is the movement tile based or free floating? ie like Chess or like Quake?

If its like quake, I think you need something more concrete for position updates. Time Sync & dead-reckoning (polynomial extrapolation)

And you''re probably going to need to send more stuff than just position updates.

Share this post


Link to post
Share on other sites
Thanks for replying!

You can move everywhere in the game, its a topdown run arround game (in 2d), the field is fixed so there''s no scrolling in any directions.

What do you mean with Time Sync? I''ve put a frame number in each packet send from the server to the client, to handle out of order packets. I now also send a direction (in which direction the player is moving) in the packet.

Greetings,

Tint

Share this post


Link to post
Share on other sites
If you lock the frame rate on both clients to the slower machine that works perfectly well, I think AoE & WarCraft & StarCraft etc.. work this way.

If don''t lock the frames you need to do something to syncronize the time so that you use dead-reckoning properly - or you can cop out and make a crappy mutlipler game like decent ;p

Share this post


Link to post
Share on other sites
thanks again I will try the lock framerate to slower comp method. Some weeks ago i read a article about descent and some other games related to multiplayer, it was very interesting, i think it was somewhere on gamasutra.com .

Greetings,

Tint

Share this post


Link to post
Share on other sites
Magmai Kai Holmlor

Could you explain Dead Reconing and polynomial extrapolation methods? I haven''t done too much research into carmaks stuff. I''m mostly interested in how it would apply to a sidescroller.

Share this post


Link to post
Share on other sites
In retrospect, I think locking frames would be the way to go with a side scroller.

...
Know how to build a polynominal from a set of points?


You need one more point than the order of the poly you want (for exact fit, not best fit) and you fill in a big 'ole matrix with all the info from the points. Then you solve the matrix system of equations - can use guassian elimnation or inversion (as the matrix is square) You could use a best fit poly too, its a little hard math, and a little more math, bt it would garuntee a smooth line - funny things can happen when you extrapolate exact fit curves, so best fit is probably the way to go...

Out comes the coefficents for a poly that goes through your points. The plan is to use the four points that are close together to calculate the coef. Then, instead of sending your position, you send the coef & a time.

You need to create a set of coef for each dimension. 2D -> 8 coef, 3D ->12 coef, plus a syncronized time (see other threads).
As such its important that the coef are for parametric equations (vs time).

Then on client display, you feed the current ticks (adjusted for syncronization) into the coefs & calculate the position of the object to be displayed. Its a lot of math on the time critical path - but it produces smooth movement which is almost a neccessity for this kindov thing.

This is not the way you'd want to make an RTS - those typically lock frames, since it is tatically important that all actions occur on everyones screen. (animations dont need to lock, but actions do!)


...
Someday in near future I'll be writting code for this, if gamedev wants it I'll submit for the snippet section. Or is there already a dead-reckoning snippet?

Edited by - Magmai Kai Holmlor on October 15, 2000 1:10:27 PM

Share this post


Link to post
Share on other sites