JUMP is a library that facilitates writing simple multiplayer games using Unity 3D and Photon Unity Networking.
I was working on a multiplayer game and found myself in trouble trying to handle events from Unity and Photon at the same time; ending up with fragile code - so I worked to streamline and simplify the scenario and build a reusable library.
Out of the box, JUMP Provides:
- A simple flow for connecting to the server, matchmaking and starting a multiplayer game
- Authoritative local Server (using Photon Master Client)
- Streamlined Client-Server communication
- Custom Client Commands and Server Snapshots
- Sample Project and Prefabs to get started in 5 minutes
- Full source code access and great customization.
[0.3.0] - 2016-11-13 - Adding offline bots support!
For details, see Changelog
- How To Install
- Scenario
- Object Model
- (NEW!!) Offline Bots
- DiceRoller Sample
- Testing JUMP
- Features to Add
- License
You can get the source code here or download JUMP from the Unity Asset Store.
JUMP works with Unity 5 and requires Photon PUN to function properly:
- Install Photon PUN Free or Photon PUN+
- Configure your Photon Application ID - see Initial Setup
For more information about configuring PUN, see PUN Setup.
Note: JUMP was tested with Unity version 5.3.4 and Photon PUN Free version 1.67
The Unity Asset Store package includes the DiceRoller sample project.
- Download JUMP from the Unity Asset Store.
- Add all the scenes in the
DiceRollerSample/
to the Unity build - Open the
DiceRollerConnection
scene and start Unity. - The DiceRoller sample should go to the Matchmake scene in connected mode.
Note: To test multiplayer games in Unity, you will need to run two copies of the game, so that they can connect to each other. The best way, is to build a copy of the game (File/Build & Run) for one player and start Unity debugging for the second player. See this Unity forum post for more details.
In alternative to use the Asset store, you can create a folder in the unity project (under Assets) and copy all the files from the JUMP Multiplayer\
folder.
Then you can use the Object Model and the prefabs.
The scenario supported by JUMP is very simple and designed with mobile multiplayer games in mind:
- Two Players networking
- Basic matchmaking
- Streamlined UI flow
- Custom server
- Client-Server communication
JUMP automates building Photon game rooms, easy.
Note: While it supports more than two players, we tested JUMP with the two players scenario
JUMP uses Photon Random Matchmaking without the use of the Photon Lobby making the UI and the object model much simpler to use compared to the use of the Lobby.
JUMP supports up to five different Unity scenes:
- Connection
- Home Page (Master)
- [Room] Waiting for players
- [Room] Playing the game
Note: support for multiple levels can be added to the Playing the game scene.
JUMP cannot provide a dedicated remote server using Photon Unity Networking or Photon Cloud, so it uses the Host model, where one of the clients also hosts the Game Server (sometimes called Local Server)
Photon provides support for this with the concept of Master Client.
JUMP supports the concept of an Authoritative or Semi-Authoritative server using a Command/Snapshot Client-Server communication:
- The Client sends Commands to the Server
- The Server sends Snapshot to the Client
The model is similar to the one explained by [Fast Paced Multiplayer] Gambetta, but we use the term Command instead of Actions and Snapshot instad of New State
The slanted lines indicate that there is lag between the client and server communication, see [Fighting Latency on Call of Duty III] CallOfDuty
While it is possible to optimize the client/server communication in terms of reliability and space utilized with delta compression of snapshots and queues of commands, JUMP simply uses Photon Reliable UDP to communicate, it is a good balance of reliability and ease-of-use.
JUMP Multiplayer with (Semi)Authoritative Server model is based on lots of literature on multiplayer games:
- [Fast Paced Multiplayer] Gambetta (Gambetta)
- What every programmer needs to know about game networking (Gaffer on Games)
- [Fighting Latency on Call of Duty Black Ops III] CallOfDuty (GDC 2016)
- Building a Peer-to-Peer Multiplayer Networked Game
- Unity3D Multiplayer Game Development
- How can I make a peer-to-peer multiplayer game?
- Unity Networking
See Object Model
See Offline Bots
See Testing JUMP
See Features to Add
Unless stated otherwise all works are Copyright © 2016 Juiced Team LLC.
And licensed under the MIT License
If you want to donate, you can simply purchase the JUMP package in the Unity Asset Store.
We are not ready to accept pull requests at the time, we are considering that for the future. If you are interested in contributing, file a bug and we will consider your request. All contributions will be voluntary and will grant no rights, compensation or license, you will retain the rights to reuse your code.
Photon, Photon Engine, PUN: ©2016 Exit Games®
Unity 3D, Unity Engine: ©2016 Unity Technologies