3

I am trying to create a real-time multiplayer game using Google Play Game Services. I am trying to set one player as host. Everyone will send their commands to the host (via sendReliableMessage), and they will receive a response of what to render.

However, I am trying to have the host send himself a message (before acting) in order to be in sync with everyone else, but the onRealTimeMessageReceived is not firing for the host when the host himself sends out the message.

Is it possible for the host to send a message to himself? If not, how would I go about this? The Google tutorial even says I should have a host player.

Lathan
  • 145
  • 7
  • I too have this issue, I do not think you can as there is example code to prevent it. The Host is supposed to pick a random leader for the game as the host is picked alphabetically and they in turn choose a random leader. – Graham Smith Oct 27 '14 at 16:38

1 Answers1

2

You cannot do this using the sendReliableMessage() function in RealTimeMultiplayer class. As written here, the function throws an IllegalArgumentException if recipientParticipantId is not a valid participant or belongs to the current player.

The thing that you need to do is to forward all received messages (sent by others) to a common class/method etc (depending on your design/wish) to keep clients updated and keep your game logic running and call the class/method manually for the host.

Seyf
  • 889
  • 8
  • 16