Sign in to follow this  
Flayed One

creating a multiplayer game

Recommended Posts

Hello,

I recently have been developing a game in C#. It's based on a 'server - client' architecture. Server handles physics, AI and so on, while client handles rendering and interface. So far everything works perfectly in single player.

The question is - how do i go about converting it to multiplayer?

-Do I make only one server, to which several clients connect, and which sends positions and states of all objects to all clients constantly?(I have a feeling this option is impossible due to communication constraints:P )

-Do I make one central server, and additionally each client also should have one secondary server, and only synchronize those secondary servers with the central one periodically?(seems more plausible)

If it's the second option, how do I factor in network latency?

Share this post


Link to post
Share on other sites
The [url="http://www.gamedev.net/index.php?app=forums&module=forums&section=rules&f=15"]FAQ[/url] in the Multiplayer and Networking forum has a bit on this and a bunch of other stuff you'll encounter.

You'll probably want to do a bit of both - you want a server that enforces the game rules to stave off cheaters, but you want the client to implement those rules (including physics etc) so that it happens quickly, locally. Then you need some smarts in your networking to handle the case where they don't agree with each other :)

Ultimately, designing the solution you want is as specific as designing your game - there's no one-size-fits-all choice.

Share this post


Link to post
Share on other sites
[quote name='Flayed One' timestamp='1317907664' post='4869771']Do I make only one server, to which several clients connect, and which sends positions and states of all objects to all clients constantly?[/quote]Strongly suggested. Updating at 10 fps might do. However, you need to design what will be "client state" and what won't. For example: particle systems mainly dealing with graphical effects can be more or less purely client state.

[quote name='Flayed One' timestamp='1317907664' post='4869771']Do I make one central server, and additionally each client also should have one secondary server, and only synchronize those secondary servers with the central one periodically?[/quote]That would be lovely, but the logic involved in managing this distributed system is rather scary to me. Sure you can figure out something ... but do you really need to? Start easy first. Optimize if needed.

Share this post


Link to post
Share on other sites
first option. use delta compression on the data.. this means only send changes otherwise the client can and will assume any information from the big up front synchronization is constant. To make it responsive, you may look into using client side prediction. This requires your engine to have deterministic physics (events can be repeated exactly the same way on almost all machines).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this