• 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!

GameMaker Networking Help

S

Samurai1506

Guest
So im trying to implement networking in my game so that me and my friend can play. I got the code down, but I guess what I need is like clarification. My game has enemies and guns. Would the only things i have to send in a buffer is just the x,y,and hp of players and the x,y,and hp of enemys, and the x,y of the bullets? What other things might I need to send in a buffer.
 

saffeine

Member
the general rule of thumb of networking is to try and send only what is necessary for synchronising the different instances of the game, when you need them.
you could probably get away with sending those things, but there are definitely alternatives that might perform better on a larger scale.

examples:
- rather than sending a player's variables every step or so, only send button inputs and handle all the movement locally to cut down on packet transfers.
- rather than sending a bullet's x and y every step or so, send a single packet when you create the bullet that contains the spawn x and y, and the direction it moves in.

of course these aren't absolutely required and if your game is small enough, those won't really matter, but hopefully it gives some kind of insight as to what you have to send.
online games almost never have to be 1:1, they just have to know when to perform certain actions during certain triggers, and how to respond.
if there's a switch for example, you don't send the switch data every time, just once when you switch it, the client can handle the rest from there since it should know how to respond to it being switched.
that being said though, it's perfectly reasonable to send more data more frequently in the way you're suggesting in your post, just not practical if there's a lot of it.
i hope this answers your question without providing faaar too much information.
 
Last edited:
Top