What is the best way to send information?

Posted by PokemasterTT
I am making a Card Game like Hearthstone and currently I create a dummy instance, share it and use the x and y to determine the action.

Replies (1)

Last message on 18 May 2016

Size43 (Administrator) on 18 May 2016, 14:28:17
You can use player-to-player (P2P) messages to send arbitrary data to other players. For example, you could do something like this:

[gml]
gms_p2p_send(p2p_draw_card, other_player_id, "My Card", 4, 22)
[/gml]

Where p2p_draw_card is defined as a constant with a value between 0-255, other_player_id is the ID of the other player, and "My Card", 4 and 22 are the values that you want to send.

Note that while you could technically directly write the number instead of adding a constant (for example, p2p_draw_card), it's better to use a constant so you can assign a logical name to the number and use that instead.