Skip to content

Custom input prediction function? #69

@johanhelsing

Description

@johanhelsing

Is your feature request related to a problem? Please describe.

In some cases, it would be convenient to be able to send one-off events as part of the input struct:

struct Input {
    fire_just_pressed: bool,
    jump_held: bool,
}

However, when predicting, we would then get fire_just_presed == true repeatedly when predicting.

Describe the solution you'd like

Instead of just copying the input struct, perhaps it would make sense to be able to inject a prediction function?

session_builder.with_input_prediction(|input| {
    Input { fire_just_pressed: false, ..input }
})

let prediction_to_return = self.prediction; // PlayerInput has copy semantics

Describe alternatives you've considered

Handling just_pressed logic inside the ggrs advance frame step works as a workaround, but sometimes the events you get from game engines are one-offs (bevy ui button press events etc.), so it generates a lot of boilerplate

Additional context

https://discord.com/channels/844211600009199626/844211600009199629/1175361006717898763

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions