First-Person Shooter: Getting started

Tutorial: First-Person Shooter in Unity – Getting started

In this series of Elympics tutorials, you’ll be creating a simple FPS game for 2 players. It’ll help you understand how our tool works and what you can achieve with it when building a multiplayer shooter. 💪

We will focus on implementing the core FPS components such as:

  • player movement 🚶
  • managing players’ HP system ❤️‍🩹
  • weapons shooting raycasts and projectiles 🔫

We’ll start with jumping capsules, then go to managing cameras and creating different weapons, and finally handle synchronizing player animations.

All of that fully deterministic and server-authoritative!

Project setup

Before you start, you’ll need to add Elympics to your project. Just like in the Pong2D, you can do it using the Package Manager.

After adding the Elympics package, you’ll need to create a new game config:

First-Person Shooter

First-Person Shooter

Use the right-click menu to add the Elympics System object to the hierarchy too.

First-Person Shooter

After doing so, you’ll start with a very simple scene setup and the implementation of basic character movement. All you need at this point is a plane.

First-Person Shooter

Player game object

Now, let’s focus on creating the player. You’ll have to create a new, empty GameObject that will be the root for all the components of the player prefab. Make sure that the created object is in position 0,0,0 of the game world and add the following components to it:

  • Elympics Behaviour;
  • Rigidbody;
  • Elympics Rigid Body Synchronizer (added by the button in the Elympics Behavior component).

In the Rigidbody component, you can immediately change Interpolate to “Interpolate” and Collision Detection to “Continuous” and then block all the rotation axes in Constraints.

First-Person Shooter

Now, add 3D Object → Capsule as the child of the player object. Make sure that its position is 0,1,0 in relation to the parent so that the entire “body” of your player is above the ground.

First-Person Shooter

In addition to the Capsule Collider, you can add a properly scaled Cube and move it along the Z axis, which will serve as an indicator of which direction the player’s body is currently facing. This cube doesn’t need any colliders and is only a visual aid for the observer, so if you decide to add it, remove the collider from it.

First-Person Shooter

We’re ready! 🔥

Everything is set and we can start coding! In the next part we’ll focus on player’s movement! 🏃🏼

Last modified December 8, 2022: Part 2 of fps tutorial (movement) (79cfefd)