Giter Site home page Giter Site logo

armour / multiplayer-fps Goto Github PK

View Code? Open in Web Editor NEW
899.0 47.0 298.0 776.68 MB

:video_game: A multiplayer first person shooter game based on Unity Game Engine

License: MIT License

C# 96.42% ShaderLab 2.96% HLSL 0.43% JavaScript 0.19%
game multiplayer multiplayer-fps unity3d kinect vr-glasses leap-motion fps fps-game xbox-controller

multiplayer-fps's Introduction

Multiplayer-FPS

PRs Welcome License: MIT Template from jarvis

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)

Requirement

Unity 2022.3.17f1 (LTS)

Game logic and functionality

  • Login panel

    • Input your player name and the room name you want to join
    • Click 'join or create room' button to join a room or create a new room
    • The network connection state shows on the bottom left corner img
  • Game interface

    • Player's HP on the top left corner
    • The message panel on the bottom left corner, which shows status of other players (e.g. dead or respawn)
    • A gun (AK-47) is always shown on the bottom right corner in front of every thing you can see
    • A red shooting sight is always in the center of the screen
  • 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:

      • Policeman: a policeman-like model with yellow skin
      • RobotX: a robot-like model with dark pink skin
      • RobotY: a robot-like model with dark blue skin
    • 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
        • This makes the player walk or run more naturally. It uses interpolation function to map different combinations of user input to different animations.
        • img
    • State Machine

      • There are multiple layers in the player state machine.
  • Player movement

    • Walking && Running && Aiming
    • Jumping
    • Dying
  • Gun model

    • The original gun model (AK-47) was from Unity Assets Store
    • Shooting animation are added by setting keyframes in unity3d animation panel img
  • Networking

    • This game uses Photon Unity Networking 2, which is a good network model from Unity Assets Store
  • Bullet effects

    • Bullets hitting different materials will cause different effects
      • Wood
      • Ground
      • Metal
      • Concrete
      • Water
  • Door animation

    • Doors will automatically open when there is someone nearby and close when no one is around
    • Before opening
    • After opening

Script files

  • 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

Input Devices

  • 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

Kinect Details

  • 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.

Contribution

See CONTRIBUTING.md

License

MIT License

multiplayer-fps's People

Contributors

armour avatar davidnazw avatar iykon avatar leotada avatar springhhh avatar takashil avatar zeruniverse avatar zzwdbs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

multiplayer-fps's Issues

Server Support?

I just wanted to check on the servers. are you still operational? Are they operating? Which file or folder location can I add all locations of my own servers and how would I do that?

Using MLAgents;

I am trying to import MLAgents to this project.
However I got missing reference error.

The type or namespace name 'MLAgents' could not be found (are you missing a using directive or an assembly reference?)

Things that I tried are:
1. Selected Scripting Runtime Version to .NET 4.x Equivalent
2. Added ENABLE_TENSORFLOW to the Scripting Define Symbols
3. Drag the ML-Agents and Gizmos folders from UnitySDK/Assets to the Unity Editor Project window.

I also tried:
1. Selected Scripting Runtime Version to .NET 4.x Equivalent
2. Added ENABLE_TENSORFLOW to the Scripting Define Symbols
3. Imported TensorFlowSharp Plugin

Any help would be highly appreciated.

just a quick question

How do I add features to the map and new assets, I've tried drag and dropping but it doesn't appear in the map

Thanks in advance - lowerforce77

JoinOrCreateRoom failed

Hi I have this error what should I do?

JoinOrCreateRoom failed. Client is not on Master Server or not yet ready to call operations. Wait for callback: OnJoinedLobby or OnConnectedToMaster.
UnityEngine.Debug:LogError(Object)
PhotonNetwork:JoinOrCreateRoom(String, RoomOptions, TypedLobby, String[]) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1837)
PhotonNetwork:JoinOrCreateRoom(String, RoomOptions, TypedLobby) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1803)
NetworkManager:JoinRoom() (at Assets/Scripts/NetworkManager.cs:70)
UnityEngine.EventSystems.EventSystem:Update()

Unity Version?

I'm submitting a

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior

Environment

Image effects bug

When running in "Windowed" with "Beautiful" or "Fantastic" quality, the image effects will cause the camera not working well

Changing the sounds?

Hi my name is Joey, and i'd like to change the sound of the gun/ other sounds. Is this possible? Found out that the audio source should be located in TPS gun script but have no idea how to change it.... Thanks in advance

tpsgun submit
!

Doesn't work on macOS Ventura, and other.

Hi, can you please help with optimising the game for new versions of Mac, and maybe making a new cool design, adding new weapons and maps and other.
Thank you very much!
Sincerely,
Andrei Motin

PS please reply soon!))

Local Host Functionability

I wonder if you could please help figure out how we can play the unity project in the unity editor on the local host machine for testing purposes and if you could kindly create a video tutorial series on this and help new unity users like me expand their knowledge on game programming. It would be helpful to us and also give you recognitiona nd tthe satisfaction of helping people.

Could this be migrated to mirror?

I'm submitting a question

First of all, Awesome work on this!

I was just wondering if this could be migrated to mirror, as it doesn't have a ccu cap. If this could be done, I would be greatly stoked to use this even more!

help

my u3d lost the scripts in FPSMainCamera,which is child of prefabs, could you please tell me which scrits they are?

New Error List

capture

New bugs

Assets\Standard Assets\Cameras\Scripts\FreeLookCam.cs(3,27): error CS0234: The type or namespace name 'CrossPlatformInput' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)
Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\FirstPersonController.cs(3,27): error CS0234: The type or namespace name 'CrossPlatformInput' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\FirstPersonController.cs(4,27): error CS0234: The type or namespace name 'Utility' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\HeadBob.cs(3,27): error CS0234: The type or namespace name 'Utility' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\MouseLook.cs(3,27): error CS0234: The type or namespace name 'CrossPlatformInput' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\RigidbodyFirstPersonController.cs(3,27): error CS0234: The type or namespace name 'CrossPlatformInput' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\RollerBall\Scripts\BallUserControl.cs(3,27): error CS0234: The type or namespace name 'CrossPlatformInput' does not exist in the namespace 'UnityStandardAssets' (are you missing an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\HeadBob.cs(10,16): error CS0246: The type or namespace name 'CurveControlledBob' could not be found (are you missing a using directive or an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\HeadBob.cs(11,16): error CS0246: The type or namespace name 'LerpControlledBob' could not be found (are you missing a using directive or an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\FirstPersonController.cs(22,34): error CS0246: The type or namespace name 'FOVKick' could not be found (are you missing a using directive or an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\FirstPersonController.cs(24,34): error CS0246: The type or namespace name 'CurveControlledBob' could not be found (are you missing a using directive or an assembly reference?)

Assets\Standard Assets\Characters\FirstPersonCharacter\Scripts\FirstPersonController.cs(25,34): error CS0246: The type or namespace name 'LerpControlledBob' could not be found (are you missing a using directive or an assembly reference?)

Create server button not working.

I'm submitting a

Current behavior

Upon clicking the create server button, nothing happens.

Expected behavior

The desired behaviour is obvious.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior

Environment

Setup Photon Servers

Great work on this!

I would like to use this and edit it to my liking and deploy it. Which server file would I edit to setup Photon and how would I setup photon?

If this is solved, I WILL donate via PAYPAL.

PLEASE HELP!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.