quantum | v2 switch to v1  

Blueless

Level Intermediate
The Quantum Blueless 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 fast and action-packed online 2D platform shooter.

Disclaimer: The sample game was developed by BitCake Studio for Photon Engine.

トップに戻る
 

Download

Version Release Date Download
2.1.5 Mar 21, 2023 Quantum Blueless 2.1.5 Build 38
2.1.1 Dec 05, 2022 Quantum Blueless 2.1.1 Build 37
2.1.0 Sep 16, 2022 Quantum Blueless 2.1.0 Build 35

トップに戻る
 

Before You Start

To run the sample in online multiplayer mode, first create a Quantum AppId in the PhotonEngine Dashboard and paste it into the AppId field in PhotonServerSettings asset. Then load the Menu scene in the Scenes menu and press Play.

トップに戻る
 

Technical Info

  • Unity: 2020.3.20f1.
  • Platforms: PC (Windows / Mac), WebGL and Mobile (Android)

トップに戻る
 

Highlights

Technical

トップに戻る
 

Gameplay

  • Fast paced, 2D platform shooter.
  • Double jump.
  • Area damage.
  • Grenade.
  • Weapon reload time.
  • Change weapon using weapon inventory.

トップに戻る
 

Controls

Use A S to movement, Space to jump, Q E to change weapon, F to use the granade, Left Mouse Button to shoot and use the mouse cursor to aim.

トップに戻る
 

Useful Patterns

Raycast Projectiles Based On Delta-movement

This is a good approach to prevent fast bullets from crossing walls. A raycast based on direction and speed is used to predict the next bullet movement and detect a hit, if any.

Physics2D.HitCollection hits = frame.Physics2D.LinecastAll(bulletTransform->Position, futurePosition);
for (int i = 0; i < hits.Count; i++)
{
  var entity = hits[i].Entity;
  ...
  if (entity == EntityRef.None)
  {
    bulletTransform->Position = hits[i].Point;
    // Applies polymorphic behavior on the bullet action
    data.BulletAction(frame, bullet, EntityRef.None);
    return true;
  }
}

トップに戻る
 

Disconnect System

Using the deterministicinputflags we check if the player is present. So, the entities of players who are not present for a while are removed from the simulation.

public override void Update(Frame frame)
{
  frame.Global->DisconnectTime += frame.DeltaTime;

  var robotsFilter = frame.Filter<PlayerID, Status>();
  while (robotsFilter.NextUnsafe(out var robot, out var playerID, out var robotStatus))
  {
    DeterministicInputFlags flags = frame.GetPlayerInputFlags(playerID->PlayerRef);

    if ((flags & DeterministicInputFlags.PlayerNotPresent) == DeterministicInputFlags.PlayerNotPresent)
    {
      robotStatus->DisconnectedTicks++;
    }
    else
    {
      robotStatus->DisconnectedTicks = 0;
    }
    if (robotStatus->DisconnectedTicks >= 15)
    {
      frame.Destroy(robot);
    }
  }
}

ドキュメントのトップへ戻る