top of page
Writer's pictureDaniel Henshaw

[20/03/2022] Player & Player Manager

Player Controller Script:

For this project I was focusing on multiplayer. This caused me to re-use my player movement script from a previous project. This player script already had movement, sliding and wallrunning. I have converted all of the code from this script to work with multiplayer and added animations to the player. I also created an Input Manager script and converted all input from my player manager over to the input manager script.

The embed on this document show my multiplayer animation system.

If you would like to see the full player movement script used in this game click here.


Input Manager Script:

In order to make inputs easier to manage I created a separate Input Manager script. This allows me to easily manage inputs without having to scroll through hundreds of lines of code in the player movement script.


Player Manager Script:

I created a player manager which spawns the player at the start of the game. This instantiates the player on the server side which causes the player to appear for everyone.

If you would like to see all of the Player code used in this game click here.


Evaluation:

For the player I decided to re-use code that I had already written on a previous project. I decided to do this because I felt I would be limited by the deadline of the project if I had programmed it from scratch I would have limited time to get the other features within the game finished. The player code isn't entirely re-used. As this game is a multiplayer shooter I had to fix a lot of the code to make it compatible with the networking system. I had to use events and the built it Photon View synchronization script in order to sync animations and player positions.


I also had to create a new input system for this player script. This was because all multiplayer players could be controlled by everyone. Making this new input system allowed only the player owner to control their own player.


I had a lot of difficulties while programming this system. The animations caused a lot of errors within my code. The first problem I ran into while adding animations to my player came from the players root bones transform not being exactly 0. This caused a funny error were the player was floating and stretched.

Once this was fixed it came to my attention that using Photons built in animation synchronization missed animation trigger events making it only a 20% chance of synchronization across the network. In order to fix this I decided to code my own event system through photon which worked and successfully synced all of the emote animations.


Unity Configuration:


コメント


bottom of page