Player-to-player messages

P2P messages are an important mechanism when creating more advanced games. If you know the 39dll system, this is an advanced version of plain "packages."

Every player-to-player (P2P) message starts with an ID. This can be an integer ranging 0 to 255. The ID is a simple way of distinguishing different types of P2P messages. It's a good practise to define constants for this. Your code will get very messy otherwise.

You can send a P2P message to every player, by supplying a valid player_id. Besides using a player_id objtained by object.player_id or [gms_other_find] you can also provide the special constant to_server. This will send the P2P message to the server instead of a player.

Replies (4)

Last message on 5 Jun 2017

amkgames on 5 Apr 2015, 21:21:01
What is player ro player message? Is it whisper? Or PM?
Forgeio on 5 Jun 2017, 05:38:09
It's actually not an actual message that you would send to someone, it is a way of sending data to (an)other player(s) instead of to the server.
Size43 (Administrator) on 6 Apr 2015, 11:17:46
It's a way to send a custom message to another player. It's not a chat message, but a set of values that can be strings or doubles.
amkgames on 5 Apr 2015, 21:21:24
I mean To*