Sign in to follow this  

Piece of advice about how my game should work related to networking.

Recommended Posts

HexDump    233
Hi , I would like someone to give me a piece of advice about the system I´m building (about networking) and see if you think it is a good way to do it. The game is simple, it can be thought as a "turn based one". I will have 2 players in the scene sending commands one to the other and this will have an effect on the players. Usually this effects are produced executing a script (I´m using squirrel). So, we have 2 players, one of them doing server tasks too and same scripts in both sides (the 2 machines connecedted). When a player does a command, it will send a message to the server to notify that player X did the command. The server then broatcasts this to all clients. When clients receive the command (through the message sent by server) been performed by player X, the needed script will be executed in the client on player X (on all machines). This is a simple way to do things, the problem I see is that all clients have a copy of the scripts and if anyway would want to modify them he could get a lot of advantages. The other method of doing things could be, sent the command to the server, and the server executes there the script and resend to clients the new state of the player for that command, but this seems a bit more complicated and this messages could be much bigger than first method. For example, when a player executes a command this command can add things to the iventory, modify energy, etc... What do you think? Thanks in advance, HexDump. [Edited by - HexDump on October 24, 2008 10:38:15 AM]

Share this post

Link to post
Share on other sites
oliii    2196
that's two networking model. Peer To Peer, or server-client.

What you can do to improve security on the client in a P2P, is to have the client send his result back to the host to be verified. If it doesn't check out, kick him.

The message would be bigger, but since it is turned based, that should not matter (if you are using a reliable protocol with flow control ect... like TCP/IP). The process of executing a command would be a little slower (we're probably talking 1/10th of seconds), but I think it is a better method. It's turned based, so it should not matter.

To avoid having multiple messages as a reply, you can send the whole player state, so whatever command is required, you would send only one type of reply (or broadcast). Everything that changed on the server state. It depends how much latency you want.

another option would be using UDP, delta compression, maybe command prediction on the client, but that's a lot of work. probably not worth it.

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