Skip to main content
GameDev.net gamedev.net
🔒 Locked

Networked object creation and management

Started by Hacktank Sep 18, 2011 at 8:12 AM 0 replies 1.1k views
Original Post
Hacktank
Hacktank
Hello, I am working on a networked game and I have hit a wall in its development. I am trying to come up with a way to synchronize the creation of objects between the server and all clients in a way that wont be susceptible to hacking or extreme lag. If I allow the client to tell the server what object to create and its position/velocity it will not lag, but it will be easily hacked for quickfire/aimbots etc. If I just send the input data to the server and have it tell the clients to make the objects on their ends the players with high pings will have huge delays. So, I was thinking that the only way to solve this would be to create the object on the client side instantly, send the input data to the server, have the server come to the same conclusion that an object should be created, crate it itsself, and then send the object data to all clients. The problem with this is I do not know how I would synchronize the object IDs between the creating client and server so that further updates(via server scripting) and corrections could be applied.

Am I on the right track, or is there a better method that I have overlooked?

Thank you.
mmakrzem
mmakrzem
You are exactly on the correct track. To synch your client with your server you can create an std::map on your server to identify the mapping between the two sides. So for example, when your client creates an object it gets a unique ID (clientID). You pass your "request to create object", with the clientID to the server. When the server gets this request it will create its own object and get the serverID value to refer to it. Now that the server has the clientID and serverID you can put those into your map so that anytime you get a call from the client about clientID you will know that it actual refers to the serverID that is used on the server. When the server sends something down to the client about serverID, you would also use the map again to get the clientID and pass down your command that way.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.