clik-engine API
    Preparing search index...

    Interface PredictedInput<TInput, TState>

    Client-side input prediction for responsive multiplayer. Applies inputs locally immediately, then corrects when server confirms.

    Usage:

    const prediction = new InputPrediction();
    // On local input:
    prediction.addInput({ seq: frameNum, input: { moveX: 1 }, predictedState: currentState });
    // On server confirmation:
    prediction.confirmInput(serverSeq, serverState);
    // Get correction if needed:
    const correction = prediction.getCorrection();
    interface PredictedInput<TInput = unknown, TState = unknown> {
        input: TInput;
        predictedState: TState;
        seq: number;
    }

    Type Parameters

    • TInput = unknown
    • TState = unknown
    Index

    Properties

    input: TInput
    predictedState: TState
    seq: number