Tuesday, 9 February 2016

From uNet to PUN #1

Recently I created a simple multiplayer app using UNET (Unity Networking 5.x). Strictly speaking UNET is not production ready so I decided to give Photon Unity Networking (P.U.N) a try.

Time spent: approximately 2 hours

I downloaded the free PUN asset.


Migrating from UNET, I duplicated my UNET scene to be on the safe side. Then I created a Multiplayer object with PUN and UNET network controllers. Looks like this:

  • Multiplayer
    • PUN
    • UNET

I'm curious to see whether I can create a hybrid setup, so that I can 'easily' switch between solutions.

The quick start doc proved to be out of date but error messages are clear and the APIs look well structured so I quickly got a connection up and running.




Note - Photon also provide a Unity client SDK for their 'Realtime' service. Don't confuse these two, notably when browsing APIs and docs.

The next step obviously is to setup a player object. Like in UNET and other similar APIs this is done via network instantiation. Here the quick start let me down a bit so I used the Paladin Studios tutorial instead.

It's kind of funny to see how my network controller is looking more and more like UNET's NetworkManager.

Easy state Sync

I wanted to replicate my initial setup with UNET so I went to shop for the TransformView. With a PhotonView and a (configured) TransformView on my Avatar, I hope to get position and rotation in sync.



No comments:

Post a Comment