FMP – Issues with Gravity Switch and Rotations and issues with Mutliplayer Spawning

Creating the Gravity Switcher

To achieve the floor mirror effect I wanted the players to appear as if they were underneath one another in the experience. To achieve this it meant that the second player had to be upside down and so a reverse gravity script was needed that wouldnt affect player One. After some discussions with my teachers and research online it was found that the rigid body could be singled out and changed on its own without having to change the gravity for the whole level.

This is also easy to trigger in the unity editor by increasing or decreasing the public float to increase or decrease the gravity intensity.

Testing the Gravity Switcher

After setting up the gravity script it was initially working and pulling the XR rig in the opposite direction but there were issues with the Rig going through objects or rapdidly being pushed around the environment. There were also problems with the rotation and position of the player causing some very unplayable conditions.

Issues with the Gravity Switch

Initially there were issues with the colliders affecting how the player could move in the environment and the opposing gravity almost fighting. After a few attempts and tests it was found in a strange way that turning off the character controller and using a capsule collider instead seemed to fix the issue and allow the player to appear upside without any major issues with movement.

Issues with Multiplayer Spawning

I was able to successfully have a stable network connection and able to spawn a player but i am having the issue of differntiating the players and spawning 2 seperate prefabs to have a seperate player one and player 2. It seems to only spawn one player at a time and this seems to be due to the game launching and not recognising that another player has already join the scene as player one

Multiple methods have been attampted including transforming the second player using a counter to see how many people are in the scene which doesnt seem to be working very well. This will need to be continued to be tested and investigated to see how this can be fixed otherwise the two player cooperative experience cannot be achieved…

FMP – Creating Vortex Skybox and Multiplayer Photon 2 Tests

Multiplayer Photon 2 tests

After creating more of the initial elements of the experience i am continuing to test out and learn how to use photon 2. The next step was to create a user interface that will trigger the connection to the server and join the network on command as you can see from the simple execution of the buttons below.

Creating Joinable Rooms

After getting the general connection UI working i began to further experiment with how i could create different rooms and lobbies so following a tutorial i further looked into how this was achieved and it was quite simple overall creating different iterations of the same levels just for different users over the network.

Creating the Vortex Skybox Shader

This is something that i had been wanting to try for a while to create the mysterious “Glass” vortex that is trapping the hotel between the multiverse. After having some classes and feedback on creating shaders, using a simple seamless material i found online which was a white marble like texture this was used as a basis to create a flowing and warping effect that could be used as a skybox.

FMP – Considering Player 2 and Creating his Path through the environments

Due to the style of the story and the environment, the second player is going to need to be able to be shown all around the other player in order to give the feeling of reflections in the environment no matter where they are looking

Creating a Player 2 swap script

In order to achieve this I have laid out multiple XR rigs for player two around the environment in order for the player to move around seamlessly around player one. This is achieves in theory by having the player walk over a collider that will turn off their current rig and turn on the second rig achieving the same effect.

The script below shows how this was achieved by linking all of the different XR rigs as game objects which are then set active true or set active false depending on when and where the player crosses them and the order which they are crossed like in the initial concepts for this.

FMP – Creating Elevator Interactions and hotel Rooms / Changes to Map Layout

Creating the Elevator Puzzle triggers

The elevator puzzle became the most difficult out of all of the events i found because it was quite complex and relying on two players in order to properly test it. I created all of the assets so that the doors animate open, there is an old fuse, a new fuse and a tool to open one of the doors. The code at the moment is set up for just one person at the moment since i do not have a build or a second headset to full test if it is all working correctly for two people. This will need to be tested when I am back on campus after the summer.

Elevator lighting and Changes

To simulate the elevator moving up for the player I created some spot lights that will move up on the left and right side to show in a way that it is all moving up through the floors of the hotel. This was created using a simple looping animation.

I also created a flickering light and red service like to show that the elevator has broken down at the certain point in the narrative of my experience.

Initial Elevator Moving Animations

My initial idea of how to move the player in the elevator from the bottom floor to the upper floor was to create an animation of the whole environment moving up and essentially carrying the player with it. however i had one major issues that when it did move with the animation, the player would fall through the floor and so this was not a very good solution and another way of doing this would need to be done.

Updating the Map layout

So to combat this i ended up moving down the whole hotel room environment to be next to the elevator so that it would be set active false at the start and when the player enters the elevator it would swap and appear for the player to simulate that they have changed floors when the doors open again after that sequence of the story.

Creating Slamming Doors Interaction

I have now added more decorations and assets to the hotel rooms including beds, furniture and bathroom etc. I thought it would be interesting to add some doors slamming open as the player passes near them. I achieved this by placing some colliders with a script to play the door open animation and also triggering a slamming sound effect.

XXXXX

Leaving the Elevator Sequence

When the player starts to leave the elevator the final sequence of dialogue, music and certain events will be triggered which i created using the code below:

FMP – Creating the Hallway Interaction and Alley way interactions

Creating Interactive Lever

For the Hall of Mirrors section of the experience, I want both of the players to pull down a lever together at the same time to open their doors to progress through to the alleyway. So once again using some online tutorials that I followed.

I created some basic objects to resemble a lever and added some hinge points, colliders and grabbable areas to create a pull able lever that also reacts to gravity and can spring back into place after it is released.

Picking up and moving boxes

The alleyway interaction requires the players to move boxes for the other and so i decided to create 6 boxes on each side, three will be normal which the player can pick up and the others will be faded and not interactive. The key will be under one of the non interactive ones for their side so that the other player will need to move their box for them to reveal the key.

Creating the locked door and key

The key interaction is very simple, i created a lock area with a collider so that when the player picks up the key and places it in the lock, it will react to play an animation of the door opening and letting the player through to progress to the other side while also triggering some other events.

Leaving and Entering the Alleyway

when the player leaves the alleyway they will be able to walk over the collider which will trigger the other sides door allowing them to progress to the elevator section. I made it this way so that the other player couldn’t progress without first helping the other cross the gate to the other side (forcing the cooperation).