Kodeco Forums

Creating a Cross-Platform Multi-Player Game in Unity — Part 2

In the second part of this tutorial, you'll write the code to have users connect with each other and then get a race started!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2014-creating-a-cross-platform-multi-player-game-in-unity-part-2

Hello Todd,

I still get this problem. How can i solve?

Scripts/MultiplayerController.cs(7,14): error CS0738: MultiplayerController' does not implement interface member GooglePlayGames.BasicApi.Multiplayer.RealTimeMultiplayerListener.OnParticipantLeft(GooglePlayGames.BasicApi.Multiplayer.Participant)’ and the best implementing candidate MultiplayerController.OnRoomSetupProgress(float)' return type void’ does not match interface member return type `void’

Hmm… looks like since this tutorial was written, they’ve added a new method or two to that interface. Here’s the new method they’re expecting to see

/// <summary>
/// Raises the participant left event.
/// This is called during room setup if a player declines an invitation
/// or leaves.  The status of the participant can be inspected to determine
/// the reason.  If all players have left, the room is closed automatically.
/// </summary>
/// <param name="participant">Participant that left</param>
void OnParticipantLeft(Participant participant);

If you just want to get your project going again, you can add your own OnParticipantLeft(Participant leavingPlayer) method to your MultiplayerController object and have it print out a debug message or two.

In an actual game, you could probably use this to make sure, say, your lobby display doesn’t get messed up if a player joins, then leaves while you’re waiting for a third or fourth player to join.

Hello Todd,

Thx for the great tutorial its very detailled. Im having a problem, my app does not autenticate the user, the only message that appears is the “starting a multi-player game…”. I have the same code and classes as the guide. Any ideas what this could be and how i can debug this? thank you


Started again from scratch and magic, everything works :slight_smile:

Hello Ray,

Very informative tutorial.
Thanks for doing such hard work.

Well, I am stuck with the circuit racer build on my android devices.

I have used two android devices logged in with two different tester accounts.
In both of them it shows “starting a multi-player game”
then it shows
" We are 20% done with setup"

Then after some time
One device displays " We are 73.3333333% done with setup"
while other one displays " We are 20% done with setup"

and then nothing happens.

I manually made the whole project as per your tutorial.
and later also downloaded and tried your finished project.

But in both of them i could not run the multi-player game.

It gets stuck at 73.333333% somehow.

Did google play games plugin for unity got updated such that it is not working anymore?
or am i doing anything wrong?

Please help.
Thanks for making tutorials with such details.

Hello paul,

Well, I am stuck with the circuit racer build on my android devices.

I have used two android devices logged in with two different tester accounts.
In both of them it shows “starting a multi-player game”
then it shows
" We are 20% done with setup"

Then after some time
One device displays " We are 73.3333333% done with setup"
while other one displays " We are 20% done with setup"

and then nothing happens.
It gets stuck at 73.333333% somehow.

Did you encounter any such issue?
Please help.Thanks

Hi,

I didnt had that problem, instead i was stuck in starting a multiplayer game dont know why. What i did was create a new project in google play developer console, started a new project in unity imported everything and it was working. Pay close attention when creating on google developer console, i made one small mistake on the first try and nothing worked.

Sorry for not helping much but i am making this for the first time, not an expert at all.

sreejit you fixed the problem?

Thanks for the concern. :slight_smile:
I tried it again still stuck at the same error.
We are 73.33333% done with setup.

I will follow the whole tutorial one more time again :smiley:
Lets see

Hello Todd,

Firstly, thank you for this clear tutorial. I had a problem with Google Play services when i try to setup Android with my AppID, unity complain about there is no libproject folder in Google Play Services tool. (in this path : adt-bundle-windows-x86_64-20140702\sdk\extras\google\google_play_services ) My GPS version is 32 and it has just docs and sample folders. How can i fix it?

How would you go about making 2 teams?

Let’s say a 3v3 game.

Hai My Question is very simple.
i am using PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(minimumOpponents, maximumOpponents, gameVariation, this);
This work fine when i send invitation to other players invitation send and show popup message to top of screen but the problem is that how other player accept invitation and start game?

Hai My Question is very simple.
i am using PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(minimumOpponents, maximumOpponents, gameVariation, this);
This work fine when i send invitation to other players invitation send and show popup message to top of screen but the problem is that how other player accept invitation and start game?

How do assign different variables to a thing because wont both players do the same thing so their variables will equal each other

I am trying to figure out the stupid system.byteconvertor but can I pass variables and the parent of a gameObject through

Hi how to send string to other player using convert to byte? Like you do converting float to byte? I tried and other player cant recived it. Thanx

I am facing the same issue.
Please let me know how to solve it. thanks

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]