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

Legacy GM Server to Client Communication

D

Darcocamp

Guest
Hey, I have just started work on my first online multiplayer game, but I don't know too much about networking. I have managed to get the client to send controls to the server but as of now the client can't see anything, I was hoping if someone could help me with this.
 

The-any-Key

Member
You need to make the server send info to the client too. Then make the client process that info. This is a two way communication :)
 
D

Darcocamp

Guest
You need to make the server send info to the client too. Then make the client process that info. This is a two way communication :)
I figured that out but how does the client receive the servers info
 
D

Darcocamp

Guest
I don't know how to get the server to communicate with the clients
 
D

Dobsus

Guest
The players computers (clients) all establish a connection with a single computer (server). This means they send all the necessary information for communication such as IP address and ports to the server and the server stores this info. (TCP only)

From then on whenever a client sends information (packet) to the server you can do whatever you want with it. For things like movement you want to ideally either send the x,y coordinates or key presses (depending on your games needs).

What you want to do is store all the players information in an array or ds map and every 'tick' of your game server you loop through the connected clients (who's info you already have after connection) and send everyones positions.

Good luck :)
 
Top