Archived

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

Designing for MultiPlayer

This topic is 5382 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

I''ve never written a multi-player game, but I would like to implement that aspect into my current project in the future. My current project is in the design/baby stage, but it is a good time to start thinking about networking issues. Based on a Client/Server architecture, I am thinking about having something along the lines of the following: Single player mode mimics client/server architecture; the server just resides on the user''s machine. Create an ObjectManager that stores a list of all rendered objects in the game. The ObjectManager resides on the server. Each rendered object is responsible for rendering itself - object.render(); The client machine updates itself(basically input, Camera Movement). Calls object.update() for each object it directly controls (playar avatar), which sends update info to the server. Server calls object.update() for each object it controls (any non-static geometry, projectiles, particles, etc). Client calls render(), which gets a list of renderable objects from the Server, which then render themselves. Basic premise, good or bad? Some questions: Should the client keep a copy of the Object Manager, that is updated based on the server''s ObjectManager? This would prevent updating things that weren''t moving, and would only have to send info concering updating the changed items rahter than sending render object b that hasn''t moved). Scalability? This seems like it would work well for your basic FPS, 15-20 players. But for a MMOG. with 1000+? Seems like it would tank really hard. Creation and Control. Say your basic FPS. Players A, B, C. Player A throws a grenade. As soon as it is thrown, the server gets control of it. Should client for player A get updates concerning this grenade, ot should A already know that it created the grenade, threw it on trajectory x,y,z with force n, and that grenades explode in time t, so just take care of it itself. In fact shouldn''t all geometry and objects that are not Player avatars be tracked by each client and rendered based on their behaviors? Then perhaps the server only cares about updating itself and the other clients when a client modifies itself, another object, or creates a new object? I''m starting to ramble...maybe some insight? The Tyr project is here.

Share this post


Link to post
Share on other sites
It sounds good to have the client/server strategy implemented in this fashion.

As elegant as it looks, I wonder if there would me too much overhead in single player mode.. I.e. do you really want to go through all that work to abstract these two components of the game jsut so it looks nice when in real multiplayer mode?

Chances are you will be performing many tweaks when in multiplayer mode...

just my thougts...


www.cppnow.com

Share this post


Link to post
Share on other sites
Quake1 was developed just like that (and maybe the other quake''s too). it''s a client/server architecture even when playing single player, but the local machine is the server. Really good when making a single player game which also support multi-player.

Share this post


Link to post
Share on other sites
I dont know if quake uses this method or not, but it looks to be inefficient.

I''m assuming u wish to create a fast paced realtime game, such as quake. in this case, it is essential that you send as little data over the net as possible. at initialization, you should be able to know about most of the objects you will have in the game, so both the client and server can have your "ObjectManager". The client should not have to wait for messages from the server, but in the method you have suggested, the objects that are controlled by the server can only be updated by the server, and so if there is any lag then the server-controlled objects will be rendering in a static state at the client, until it receives updates from the server. Therefore a better method would be that both the client and the server contain all information, and the client sends the client-controlled object updates to the server, but the client also attempts to simulate the server-controlled objects until it receives synchronization from the server, at which time it fixes any discrepencies between simulation data and server data, which should be so small that the user doesnt even notice. this update from the server should be frequent and unguaranteed for speed. but beware of the case when lag is too high. the problem that occurs is sometimes seen in the game Rogue Spear, where you think you are firing continuously at someone, but all of a sudden you realise he is not there, but instead is at ur side and just shot you. to solve this, a common technique is to pause the game for all players after a certain time delay, until communication is back to normal.

I understand that you are making a single player game first, and your technique will probably work well on the same computer, but you need to take into account of the fact that when you switch to multiplayer in the future, which you intend to do, then you will have to deal with two massive problems: Lag and Bandwidth. So since you are being so careful and actually thinking ahead, try thinking solutions for this too beforehand, and maybe readup on multiplayer design.

Salman

Share this post


Link to post
Share on other sites