🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Multiplayer design?

Started by
6 comments, last by tint 23 years, 8 months ago
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
Advertisement
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.
- 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
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
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
- 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
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
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.
There''s actually an article on it right here on Gamedev.Net ;0 It''s a bit obscure, but it''s at least in the right ballpark.

Anthracks
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
- 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

This topic is closed to new replies.

Advertisement