Deep Dive on Stickman3D

 How it started

I always wanted to make a multiplayer fun game to play with friends but wanted to get unity experience first. After I made about 6 games it was finally time to go for it. I knew multiplayer is a pain before starting Watching some youtubers video's about but I wanted to learn it even if its painful. I can say that after 2 month of game development time in this game now I have a lot of knowledge about multiplayer and can work on it again whenever the time comes.

First, I had to choose which way I am going to implement multiplayer is it pun or unity mirror. After research it seems mirror it better for large scale multiplayer while pun is perfect for small lobbies games. So I choose PUN 2 because my game is a 4 players game and I Started working on the starting main menu UI first and make a lobby and players can join. Thankfully PUN 2 had easy way to implement this into unity and didn't take me a lot of time to do.




Then I started working on the actual game , there are 2 ways of doing this. Make the game first with everything working then implement multiplayer in it or do them both side by side and I choose the second option. 

I started working by implementing the main controls moving and looking around then I started using Blender for making my main model and its bones and animation.




Since Character controller and animations collide with ragdoll / rigidbody  I made the rigidbody sleep and only activate after I die.




It was tricky at first since my bullet wont effect ragdoll physics only after I die not on the initial bullet hit that kills me so I added a check to ragdoll first if the bullet damage will kill me then add the damage later .


Also another issue I faced because I am using character controller and not ragdoll I couldn't use force if the target is alive so I added this script to do force to character controller . For example I added a pushback from shotgun if you fire it.



Now to the multiplier section and issues. First this game has gun so it has bullets and I went with rigid body collider bullets to deal damage instead of rayscan so I can learn more about it. In PUN 2 in unity I am syncing the transform and rotation and animation of every character but I cant do that with bullets because there will be a lot of them and it will lag the game. So instead of syncing the transform of the bullet I will instead only sync the bullet point and call it in RPC to let the other players that I shot and they can see where I shot the bullet.


And I made the bullet deal damage when it collides with the player.

Lastly Spawning players when all are ready. For some reason there is a bug that u cant spawn the player prefab with its camera activated u have to active it yourself in the awake in player script. I also added to check if every player is on then hit spawn and check my many people is in the game so the win condition can work perfectly. 




Lastly I added the UI option for ingame for sensitivity and volume. 


This Project took me 2 month to complete. A 4 player game with 15 levels between volcano theme and water theme. I am proud from what I have accomplished  and learned a lot of things in these 2 months.


















Comments

  1. Nice post! This is a very nice thing that I will definitely come back to more times this year! Thanks for informative post.
    Please join and have fun friv2021.games | Nitro Knight io game

    ReplyDelete

Post a Comment