A multiplayer first-person shooter game based on Unity3D. Different types of input devices are supported, including Kinect, Xbox controllers, Leap motion, and VR Glasses. (Each contained in a different branch, UPDATE: those are not maintained since 2020, use at your own risk)
-
Login panel
-
Game interface
-
Player models
-
All the original models and their animations were found from Mixamo, which is a pretty good game model website run by Adobe
-
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)
- Shoot without affecting lower part body (achieved by unity3d body mask)
- Unity Blend Tree
-
State Machine
-
-
Player movement
-
Gun model
-
Networking
- This game uses Photon Unity Networking 2, which is a good network model from Unity Assets Store
-
Bullet effects
-
Door animation
- CameraRotation.cs
- Rotates the scene camera in every updated frame
- DoorAnimtion.cs
- Controls the door animation and detect if the player enters or exits the door triggering area
- FpsGun.cs
- Controls the gun in first person view, mainly for shooting
- TpsGun.cs
- Controls the gun in third person view (replicated on network), mainly transform and particle effects
- IKControl.cs
- Ensures the model is holding a gun regardless of movements or rotations
- ImpactLifeCycle.cs
- Destroys the bullet object after several seconds to save CPU time and memory
- NameTag.cs
- Displays other players' names above their heads
- NetworkManager.cs
- Controls the whole network connection
- PlayerHealth.cs
- Calculates and updates health points of each player
- PlayerNetworkMover.cs
- Synchronizes the position of the player among different clients
- 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
- A more advanced interaction that might become popular in the future
- VR glasses
- More vivid and closer to reality
- Recently very popular but devices are most likely expensive
- Players cannot 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 the player's skeleton. Determine the actions of moving, jumping, shooting based on these positions and regard rotation as an input of the game.
-
Shooting:
- Users can trigger shooting by lifting their right arms. The game calculates the distance between the user's right hand and right shoulder based on skeleton nodes. Shooting will be triggered if the calculated distance reaches a threshold.
-
Moving:
- Move in the game by stepping forward, backward, leftward, and rightward. The game recognizes moving actions by the offset of right foot’s skeleton node on x-z plane. A movement will be triggered if the offset reaches a threshold.
-
Jumping:
- Users can jump in the game. The game calculates offset of right foot’s skeleton node on the z-axis to register a jumping action. Jumping will be triggered if the calculated offset reaches a threshold.
-
View Rotation:
- Use your right hand as a virtual mouse to control the camera rotation. The game records the initial position of the left hand as the initial position of the mouse, then calculates the camera rotation by the left hand’s offset.
See CONTRIBUTING.md