Multiplayer mode – building up on the prop hunt scene
- zm02stor
- Dec 12, 2022
- 2 min read
It was time to bring in multiplayer modes to the game as indicated by the sprint. Although I am a little behind on the must have requirements, I had decided to work on this for a change of pace. And moving onto animating directly after modelling would tire me out.
I started off by uploading the project to Git (incase any problems occur). I had previously attempted to create the prop hunt level in PUN in a separate file, but many errors came up and I had no idea how to fix it. Now with more information and research completed on the topic I can finally start adding it to the main project file. On the main menu there is an option for single player mode, I had PUN only start connecting the player to a lobby once that button is clicked. This is to prevent errors and faults with connecting rooms.
Once the room connected, I instantiated a player prefab into the scene. After having some experience with PUN on an assignment I was able to have it up and running correctly. Instead of repeatedly parenting and unparenting the objects that the player can transform into, (which can cause bugs and glithces in the long run) I changed it so the player prefab has the props as children but are set to be inactive at the start of the game and in the lobby - until the roles are assigned.
3 of the players will have the thief role and the other player the owner role. This is quite tricky to get correct and so far I have had to manually assign roles once the room is full (which means that the hope always ends up being the owner) The roles are workign as intended (not the assigning) and the players can hide as objects. The host is surrounded by walls to prvent them from seeing where the players are going for a certain amount of time before the walls are removed and they can move around. As of now there is no means of catchign the thieves, this will be implemented in the next run of multiplayer as well as a game over or win state.


Comments