Unity multiplayer tutorial, physics calculations on server

Share

Unity multiplayer tutorial, physics calculations on server

In this Unity multiplayer tutorial you will be shown how to create a unity multiplayer game with physics calculations on server using Unity and uLink network Library. This Unity multiplayer game tutorial will be using Unity 4.2.2 version and uLink Lina 1.5.5 version and the will be based on authoritative server mode.

Basically we want the clients to send the actions the players want to do the server, the server will check the player request and approve them and apply these actions to other objects in the game calculating the results of physical interactions. Then the server will send back to the clients the new position and speed of the object subject to the actions and the clients will render them to show the player the actual situation.

Point is, if we need to calculate the physics interactions on our server there must be something that takes care of the delays involved in the client-server server-client communication. Thanks to uLink network library uLinkSmoothRigidbodyImproved we can implement this logic inside our Unity project. This unity multiplayer tutorial can now start !

A simple multiplayer concept, pong online !

The multiplayer game that we will be creating in this unity multiplayer tutorial is an online multiplayer version of a classic game, pong, with simple 3d graphics. Each players will control one of the two rackets, the ball will be controlled by the server and will react to the forces applied by the rackets. When a player scores a goal the ball will be reset in the start position ready for service.

We will be using the uLink Network Library, a free to try Unity plugin that expands the Unity network basic apis.

Installing uLink Network Library plugin and importing into Unity

The first step of this Unity multiplayer tutorial with physics on an authoritative server is about installing uLink into your Unity editor, the uLink installation procedure is very trivial and only require to launch the uLink installer that you can download via this link :

uLink network library download page for Windows, MacOS, Linux

  1. Double click on the installer you downloaded and follow the installer.
  2. You now need to import the uLink network library plugin inside our project, so create a new Unity Project  and select the uLink package option in the wizard and hit the Create button.01-Unity-ulink-multiplayer-authoritative-physics-server-tutorial

With the new project (name it as you like) empty with only uLink resources imported we are ready to start building our Unity multiplayer game with authoritative server and physics calculations on server.

Leave a Comment