mooball
    Preparing search index...

    Interface StreamWatcherRoom

    interface StreamWatcherRoom {
        currentFrameNo: number;
        currentPlayerId: number;
        destroy(): void;
        extrapolate(milliseconds: number): RoomState;
        gameState: GameState | null;
        maxFrameNo: number;
        readImmediateStream(reader: Reader): void;
        readStream(reader: Reader): void;
        runSteps(count: number): void;
        setSimulationSpeed(coefficient: number): void;
        speed: number;
        state: RoomState;
        takeSnapshot(): RoomState;
        useSnapshot(newRoomState: RoomState): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    currentFrameNo: number

    The current frame number of the room state that you are currently observing.

    currentPlayerId: number

    This is a read-only property that always returns 0. It is only added for compatibility with renderers. (And it is only used in the initialization code of renderers.)

    gameState: GameState | null

    The original object that holds the game state information. Returns null if game is not active.

    maxFrameNo: number

    The original current frame number of the room where the game is actually being played.

    speed: number

    The current speed of the simulation.

    state: RoomState

    An object containing all information about the current room state.

    Methods

    • Frees the resources that are used by this object.

      Returns void

      void.

    • Extrapolates the current room state and sets the ext variables inside original objects to their newly calculated extrapolated states. Normally designed to be used in renderers.

      Parameters

      • milliseconds: number

        The time to extrapolate the state for in milliseconds.

      Returns RoomState

      The extrapolated room state.

    • A callback that reads the data stream for "immediate" streaming mode.

      Parameters

      • reader: Reader

        The stream reader instance.

      Returns void

    • A callback that reads the data stream for "interval" streaming mode.

      Parameters

      • reader: Reader

        The stream reader instance.

      Returns void

    • Runs the simulation count steps. Simulation should be stopped for this function to work as expected.

      Parameters

      • count: number

        Number of steps to run the simulation.

      Returns void

      void.

    • Changes the speed of the simulation.

      Parameters

      • coefficient: number

        The desired speed coefficient. Must be a real number >=0. Meaning of possible value ranges is as follows:

        • value = 0 : stop simulation.
        • 0 < value < 1 : slow-motion simulation.
        • value = 1 : normal speed simulation.
        • value > 1 : fast-motion simulation.

      Returns void

      void.

    • Generates a copy of the given RoomState and sets the current room state reference to the generated RoomState.

      Parameters

      • newRoomState: RoomState

        The RoomState to use. Should be created by takeSnapshot() first.

      Returns void

      void.