Creating Multiplayer Game with Unity

Wait…..What?Do you want to make a multiplayer game?Are you sure?These things are hard (Not that much you think).Some things are drive game developer crazy then its look rather than the actual multiplayer game like debugging, testing and bug reproducing.

Despite this, Multiplayer game still worth it.In this tutorial, you’ll see how to create a multiplayer game with google play services for unity.Before starting this tutorial you should have basic knowledge of unity and c#.

Let’s Starting from google play game service.

  1. Create an empty unity project.
  2. Download google play service for unity from Github.
  3. Find the current build directory and install current unity package.
  4. Configure your google play game service.
  5. Copy the game resources from the console and paste into the google play service plugins setup dialog.

Supp!What to do now?Confused?Don’t know how to use google play service easily with unity.Don’t worry, just look at this asset in unity asset store.

This asset will easily integrate google play game service with unity.Now you can seamlessly access real-time multiplayer features into your game.You can get description usage of this asset here.Download and install easy google play service – multiplayer.

After installation and reading usage description of the asset, find and open a demo scene from the asset in unity.Add a scene to build settings and build this project.After building install the generated APK in two Android devices.Now you can be shown a screen like the this.Easy google play service - Multiplayer GameNow log in with your Google account.After this Create a Quick Match from both of the devices.Make sure both device ids are connected together with the google+.

Google play service provides automatic matchmaking function.But in Lan multiplayer game you have to do it by your self.See how you can do matchmaking in Lan Multiplayer.

Wohooooo!!!Multiplayer game just started.Try to Swipe on the screen to move the cube.Ever wonder how this cube’s position is syncing across the devices?.Check the script movement.cs on the player in unity editor which synchronize player position over the network.This script sends player’s position networked message to all connected players in the room.

and receiving this message in the function below:

Convert this data to appropriate type and apply them to the player’s position.How easier is this?Now it’s time to start your own multiplayer game with easy google play service – multiplayer.

Where to go from here?

Still Confused?Get full description here.

Get more Helpful assets:

11 thoughts on “Creating Multiplayer Game with Unity”

  1. I simply want to tell you that I am beginner to blogging and site-building and absolutely enjoyed this web site. Very likely I’m likely to bookmark your site . You really come with really good well written articles. Thanks for revealing your web site.

  2. Hi, I’ve purchased this package some time ago and now is the first time I’m trying to work with it. I have a issue.

    Well, my Google Play are setup correctly, I can Log In normally using a script like this:
    Social.localUser.Authenticate((bool success)=> {
    Debug.Log(“Fail to Connect”);

    Anyway, using your Demo Scene, nothing works on Android device, (it is in the same project I was connecting using the function above). Do you have any idea of what can be happening?

Leave a Reply

Your email address will not be published. Required fields are marked *