A multiplayer first-person shooter game based on Unity3D. To improve game experience, different types of input devices have been added such as Kinect, Xbox controller, Leap motion and VR Glasses. (All in different branches)
-
Login panel
-
Game interface
-
Player models
-
There are three types of player models:
-
Animations:
- Walk towards four different directions
- Run towards four different directions
- Jump without affecting upper part body (achieved by unity3d body mask)
- Shooting without affecting lower part body (achieved by unity3d body mask)
- All the original models and their animations can be found from Mixamo, which is a pretty good game model website run by Adobe
- Unity Blend Tree
-
State Machine
-
-
Player movement
-
Gun model
-
Networking
- This game uses Photon Unity Networking, which is a good network model from 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 and detect if the 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. It will sends shooting function to evert client if necessary.
- IKControl.cs
- Used to make sure the model holding the gun on their hands no matter how they move or rotate
- ImpactLifeCycle.cs
- Used to destroy the bullet after several seconds to save CPU time and memory
- NameTag.cs
- Used to set other players' names above their heads on local game
- NetworkManager.cs
- Used to control the whole network connection
- PlayerHealth.cs
- Used to calculate and update each player's health points
- PlayerNetworkMover.cs
- Used to synchronize player's position with different clients
- ShowName.cs
- Used to show the players' name above their heads
- WeaponPos.cs
- Used to move the gun to the place near the player's hands
- Mouse and keyboard
- The traditional way
- Cheap and easy to use
- Kinect
- See below for details
- This part was implemented by my friend Ruochen Jiang, many thanks to him!
- Xbox Controller
- Like the combination of mouse and keyboard
- Most Xbox games use this way to play
- Leap Motion
- User hand gesture to control game
- More advanced, maybe it will be more popular in the future
- VR glasses
- More vivid and close to reality
- Recently very popular but devices are most likely expensive
- Player can't move now due to the limitation of my device
-
Tools and Platform:
- Kinect for Xbox One
- Kinect for Windows SDK
- Unity
- Visual Studio
-
Recognition Method:
- Use Kinect for Windows SKD (BodySourceManager) to get the positions of skeleton of the player, then use those positions to distinguish 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. The game will calculate the distance between the nodes of skeleton of right hand and right shoulder. If it reaches a critical value, then the action will be marked as shooting.
-
Moving:
- Use the action of stepping front, back, left and right to move in the game. The game recognizes moving actions by the offset of right foot’s skeleton node on x-z plane. If the offset reaches a critical value, the action will be recognized as moving.
-
Jumping:
- Use the action of jumping to jump in the game. The game uses offset of right foot’s skeleton node on the z-axis to recognize jumping. If the offset reaches a critical value, the action will be considered as jumping.
-
View Rotation:
- Use right hand as a virtual mouse to control the camera rotation. The game records the initial position of left hand as the initial position of the mouse, then recognizes the camera rotation by left hand’s offset.
MIT License