Skip to content

Add ability to simulate physics manually/multiple times at once #2821

@lokimckay

Description

@lokimckay

Describe the project you are working on

Networked player movement with client-side prediction

Describe the problem or limitation you are having in your project

Quick summary of client-side prediction:

  1. Client moves player and stores inputs in an array of pending (un-acknowledged by server) inputs
  2. Simultaneously, client sends those inputs to server
  3. Server uses client inputs to run it's own simulation
  4. Server sends resulting position of player back to the client
  5. Client receives the authoratative position of the player at a time which is now in the past
  6. To calculate where the client should be in the current moment, the client needs to roll back to the moment of the server's position packet, and then re-simulate all pending / un-acknowledged inputs since that time

In Godot currently, there is no way to re-simulate these pending inputs at a single moment in time

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Allowing Godot users to manually execute / simulate physics steps would make the above method of achieveing client-side prediction possible

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

https://docs.unity3d.com/ScriptReference/Physics.Simulate.html

If this enhancement will not be used often, can it be worked around with a few lines of script?

I am not aware of any workarounds that don't involve writing your own custom physics system within Godot

Is there a reason why this should be core and not an add-on in the asset library?

This functionality would give the user control of when Godot's physics executes - IMO it is very closely related to existing core functionality and wouldn't make much sense to segregate as an addon

Related issues:

godotengine/godot#25068
godotengine/godot#24769

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions