• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

How to sync objects when networking

I'm thinking of doing it by sending x and y coordinets and the id of the objects in server and check for what's at that x/y in client to give that instance the id sent as a special id. It will happen in create event (probably with using "with all"). After that every object will get any command for them in async event if the buffer starts with their special id.

Is this a good way to do it, or would having an async event in all of the objects in the game checking for their ids cause any problems (fps/networking wise)? Should I have only one client object with an async event?

There's also the option of creating a ds map and storing the special id's in there, so I can do everything from client object.
 
Last edited:

TheWaffle

Member
In my games, I tend to create a random number and save that in the object ...... Here is an example of why/how .....

I am coding a multiplayer tank-battle game ...

When a player shoots a bullet from a tank, I need some way of tracking it ....
The player doing the firing (lets just call this the client, but does not matter)
creates the bullet, the random (irandom(9999)) shotid and direction of bullet.
Then, this information get sent to the server, which must re-create this bullet ....

later, when this bullet hits a tank (the server's tank) the server needs to inform all
clients which bullet (shotid) needs to be destroyed. ....

So, yea, that's a good way of ensuring the correct object is referenced. Using a GM ID will not work.
 
Top