A multiplayer first person shooter game based on Unity3D, to improve players' game experience, I added different kinds of input device such like Kinect, Xbox controller, Leap motion and VR Glasses. (All in different branches)
-
Login panel
-
Game interface
- Player's HP showing on the top left corner
- The message panal showing on the bottom left corner, which is used to notify player other players status (like dead or respawn)
- A gun (AK-47) will always show on the bottom right corner above every thing you can see
- A red shooting sight always in the center of the screen
-
Player model
-
There are three type of player model:
-
Animation:
- Walk towards four different direction
- Run towards four different direction
- Jump without affact upper part body (achieved by unity3d body mask)
- Shooting without affact lower part body (achieved by unity3d body mask)
- All the original models and their animation can be get from Mixamo, which is a pretty good game model website runned by Adobe
-
Unity Blend Tree
-
State Machine
-
-
Player movement
-
Gun model
-
Networking
- Used Photon Unity Networking which is a good network model in Unity Assets Store
-
Bullet effects
-
Door animation
- CameraRotation.cs
- Used to rotate the scene camera in every updated frame
- DoorAnimtion.cs
- Used to control the door animation, detect if player enter or exit the door trigger area
- GunFirstPersonView.cs
- Used to control the first person view of gun shooting animation
- GunShooting.cs
- Used to control the gun shooting action on the network domain, send shooting function to evert client if necessary
- IKControl.cs
- Used to make sure the model hold the gun on their hand no matter how they moved and rotated
- ImpactLifeCycle.cs
- Used to destory the bullet after several seconds to save CPU and memory
- NameTag.cs
- Used to set other players' name above their head on local game
- NetworkManager.cs
- Used to control the whole network connection
- PlayerHealth.cs
- Used to calculate and update each player's health
- PlayerNetworkMover.cs
- Used to sychronize player's postion among different clients
- ShowName.cs
- Used to show the player name above their head
- WeaponPos.cs
- Used to move the gun to the place near player's hand
-
Mouse and keyboard
- The traditional way
- Cheap and easy to use
-
Kinect
- Detail see below
- This part was implemented by my friend Ruochen Jiang, thanks to him!
-
Xbox Controller
- Like the combination of mouse and keyboard
- Most Xbox games use this way to play
-
Leap Motion
- User hand gestrue to control game
- More advance, maybe future it will be more popular
-
VR glasses
- More vivid, like reality
- Recently very popular but devices are most likely expensive
- Player can't move now due to my device limitation
-
Tools and Platform:
- Kinect for Xbox One
- Kinect for Windows SDK
- Unity
- Visual Studio
-
Recogonition Method:
-
Use Kinect for Windows SKD (BodySourceManager) to get the positions of skeleton of the player, then use those positions to judge the actions of moving, jumping, shooting and view rotation as game’s input.
-
Shooting: Use the action of lifting right arm to shoot in the game, so I calculated the distance between the nodes of skeleton of right hand and right shoulder. If it reaches a critical value, then mark the action as shooting.
-
Moving: Use the action of stepping front, back, left and right to move in the game, so I recognized moving actions by the offset of right foot’s skeleton node on x-z plane. If the offset reaches a critical value, it will be recognized as moving.
-
Jumping: Use the action of jumping to jump in the game. I used offset of right foot’s skeleton node on z-axis to recognize jumping. If the offset reaches a critical value, I recognized the action as jumping.
-
View Rotation: Use right hand as a virtual mouse to control the camera rotation. I record the initial position of left hand as the initial position of mouse. Then recognize the camera rotation by left hand’s offset.
-