Server

How i set up the photon server during the project.

Setting up the server

After we decided on what we were going to make for FRT, I started working on making a server for users to join. After working on my maze for the pressure cooker, this was a fairly easy process.

For the network I used Photon2 which gave us a lot of out of the box possibilities.

Photon gives us the possibillity to have up to 20 players on a server at the same time.

It uses a callbacks to check whether or not someone joins or disconnects from a server.

It's also really easy to set up room options like how many players are able to join the room or the name of the room when someone wants to join so they can find it.

During the first week this was a really basic server that created a room and detected other users that joined and left.

In our project we have a mechanic where multiple people embody 1 player so we needed to decide on which player would get which body part. For this i started working with Tirso so that we could both join a server together, as he was the one creating the controllers for the players.

We came to the decision to make the host have control over the headset by checking if this was the master client or not. Once the the server had been started we needed 2 people before players could control the body.

As long as the room was non existent or there were less than 2 players in the room nothing would happen. which meant multiple people had to join the server to be able to do anything.

Multiple Users in 1 body?

Now that we had a running server, it was important that we tracked the players movements over the network. I started working with Tirso for this. As we were using Photon we started looking into if there were any ways in Photon to keep track of this. It was.

Photon tracks players that are connection by using a PhotonView. This is a component that is placed on anything that needs to be tracked on the server. Along with a PhotonView we have a TransformView

which we can use to synchronise position, rotation and scales of the objects needing to be synched. And a RigidBodyView

which is used for tracking rigidbody values like velocity.

All of these components are used to track objects over the network.

Looking back

I would of liked to do more on the networking side but as this was a learning goal of Tirso's i did not want to take up too much of this. It might have been a good idea to work on the server together with Tirso, which might of sped up progress but that was kind of difficult as whenever Tirso had an idea or wanted to try things he would do it by himself. Perhaps in the future i could aggree to work on the server side of things with someone and not just when necessary.

Last updated