Nocturna
    Preparing search index...

    MultiScene handles the multiplayer game logic, player management, UI, cameras, object synchronization, and network communication for Nocturna's multiplayer mode.

    • Manages local and remote players and objects.
    • Handles inventory, powers, and HUD updates.
    • Synchronizes object creation, updates, and destruction over the network.
    • Manages camera switching (wide/follow/spectator).
    • Handles collisions, score, and victory conditions.
    • Integrates with Babylon.js for rendering, physics, and UI.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    activeCameraIndex: number = 0

    Index of the currently active camera.

    engine: Engine

    The Babylon.js engine instance.

    inputHandler: InputHandler

    Handles user input for the scene.

    scene: Scene

    The Babylon.js scene instance.

    MaxPlayer: number = 4

    Maximum number of players in a multiplayer game.

    Methods

    • Adds a networked object, assigning local or remote authority based on ownerId.

      Parameters

      Returns void

    • Initializes Havok physics for the scene with high gravity and a fixed timestep. Should be called asynchronously.

      Returns Promise<void>

    • Adds the local player to the scene.

      Parameters

      • player: Player
      • id: string
      • subcube: number

      Returns void

    • Initializes the game scene, inventory, input actions, and physics.

      Returns Promise<void>

    • Cleans up after object drop selection is complete.

      Returns void

    • Returns the number of remote players still alive.

      Returns number

    • Returns the subcube index for a given position.

      Parameters

      • position: Vector3

      Returns number

    • Checks if a position is within the player's subcube.

      Parameters

      • position: Vector3

      Returns boolean

    • Handles contact/collision for a remote object.

      Parameters

      • objectId: string
      • ownerId: string

      Returns void

    • Plays a sound by name if loaded.

      Parameters

      • name: string

        The sound name.

      Returns void

    • Removes a remote object from the scene.

      Parameters

      • id: string
      • owner: string

      Returns void

    • Removes a remote player and their objects from the scene.

      Parameters

      • id: string

      Returns void

    • Rotates the parent node (cube) along the given axis.

      Parameters

      • axis: "x" | "y" | "z"

      Returns void

    • Sets up the main and follow cameras for gameplay.

      Returns void

    • Sets up collision callbacks for all game objects.

      Returns void

    • Sets up cameras for spectator mode after player death.

      Returns void

    • Spawns coins on platforms at intervals.

      Parameters

      • dt: number

      Returns void

    • Switches to the next available camera (wide/follow).

      Returns void

    • Switches to the next available camera in spectator mode.

      Returns void

    • Updates the local player and sends a report to the network.

      Returns boolean

    • Updates the position of a remote object.

      Parameters

      • objectId: string
      • participantId: string
      • position: Vector3
      • timestamp: number

      Returns void

    • Updates a remote player's state.

      Parameters

      • id: string
      • report: any

      Returns void