This document is about: QUANTUM 2
SWITCH TO

Battle Royale TopDown

Level 4
Available in the Gaming Circle and Industries Circle
Circle
The Quantum Battle Royale TopDown sample is currently only available to users with an active Photon Gaming Circle or Photon Industries Circle subscription.

Your Gaming Circle membership provides all samples, SDKs and support needed to create and launch successful multiplayer games in record time. For non-gaming, our Industries Circle gives you the complete suite plus exclusive license options.

Overview

This sample is provided with full source code and demonstrates how Quantum can be used to create a top-down battle royale game for 32 players.

It showcases the basic features of a battle royale game, such as death zone behavior, inventory, etc.

Download

Version Release Date Download
2.1.7 Jun 22, 2023 Quantum Battle Royale TopDown 2.1.7 Build 260

Technical Info

  • Unity: 2020.3.37f1;
  • Platforms: PC (Windows / Mac), and Mobile (Android);

Highlights

Technical

  • TopDown Character Controller.
  • Raycast projectiles based on delta-movement.
  • Respown Points with Entity Prototypes.

Gameplay

  • Granade Launcher.
  • Custom gravity for 2.5D physics.
  • Rocket launcher with Animation Curve acceleration.
  • Drop weapon system.
  • Battle Royale Death zone.
  • Players combat messages.
  • UI indicator for the safe zone direction.
  • Heal powerup;
  • Mobile-ready UI controls.

Controls

Use W A S and D to move, Q, E or Mouse Scroll to change weapons. Stand close to an item until for a few seconds to collect it.

Grenade Launcher

When fired, the launcher instantiates a grenade that behaves as a bouncing physics object capable of overpass low enough obstacles. To achiev this behaviour in a 2D physics-based game, a custom gravity was emulated in combination with a 2.5D Transform.

C#

public override void Update(Frame f, ref Filter filter)
    {
      EntityRef entity = filter.Entity;
      CustomGravity* customGravity = filter.customGravity;
      Transform2DVertical* transformVertical = filter.TransformVertical;
      PhysicsCollider2D* collider = filter.Collider;

      if (customGravity->VerticalSpeed <= 0)
      {
        var distance = transformVertical->Height + FPMath.Abs(customGravity->VerticalSpeed * f.DeltaTime);
        if (transformVertical->Position <= distance - (collider->Shape.Circle.Radius))
        {
          if (customGravity->VerticalSpeed > _bounceThreshold)
          {
            transformVertical->Position = _groundHeight;
            customGravity->Grounded = true;
          }
          else
          {
            customGravity->VerticalSpeed = -customGravity->VerticalSpeed / (1 + _restitution);
          }
        }
        else
        {
          customGravity->Grounded = false;
        }
      }
      else
      {
        customGravity->Grounded = false;
      }
      if (customGravity->Grounded == false)
      {
        transformVertical->Position += (customGravity->VerticalSpeed) * f.DeltaTime;
        customGravity->VerticalSpeed += _gravityForce * f.DeltaTime;
      }
    }

Death Zone

The Death Zone functions like a typical danger zone in a Battle Royale game and has two states: Waiting - where there are no changes in size, but players outside the safe zone will suffer damage, and Zone Shrinking - where the safe zone gradually reduces in size until it reaches a predetermined target size and randomly assigned position.

C#

DeathZoneConfig config = frame.FindAsset<DeathZoneConfig>(Config.Id);
      FP elapsed = config.Timers[Iteration] - ChangeStateDelay;
      FP t = FPMath.Clamp01(elapsed / config.Timers[Iteration]);

      CurrentRadius = FPMath.Lerp(config.Radius[Iteration], TargetRadius, t);
      CurrentCenter = FPVector2.Lerp(InitialIterationCenter, TargetCenter, t);

3rd Party Assets

The Projectiles Sample includes several assets provided courtesy of their respective creators. The full packages can be acquired for your own projects at their respective site:

IMPORTANT: To use them in a commercial project, it is required to purchase a license from the respective creators.

Back to top