Communication

You have learned a lot by reading the functions about Multiplayer, but, what’s the use you can get for them? Mostly nothing, because here starts the hot part of online games: Communication. What’s that? Communication is the way of keeping both games synchronized, when you’re playing an online game you have 2 different programs running, what do they do? They just keep sending info between each other to tell what’s happening. Do you imagine a multiplayer pong game where you see you hit with the bat but the other sees that missed it? Well, if you don’t keep synchronization that happens.

 

GM has two nice ways to send data, Shared Data and Messages.

 

Shared data is like a huge library where each book has a value; everyone can read and modify it. There are 1000000 of spaces to store data, and that data will be the same for all players. However, using too many slots will slow down the game because both games need to synchronize their slots, and that eats a lot of connection. This can be useful for some quick and not very essential data, like score for example. Nevertheless, if you want to store the x and y of an object is advisable to use better ways.

 

Messages are another quick way to send data. You pack a value (a string or a real, whatever you want) and send it. But there’s a problem, sometimes the messages reach late or they never reach the player. Meaning losing some info, so, it’s advisable to have a plan b in your game to avoid havoc caused by that. Well, the experience will tell you what and how to use both types.

 

gml_josea