HUGE feature request for the upcoming Chaos physics engine.

A problem as old as networking gaming, is the difficulty involved in simulating player-controlled physics objects in network games and having them be Server authoritative. Chaos could really help to address this by making life easier for us in some areas.

I know it’s still early days, but I have been fighting with vehicles and physics in multiplayer since what feels like the birth of the universe as we know it. For the most part it is an unsolvable problem, but there are plenty of ways we can do this with acceptable results if the simulation gives us a little more control.

I therefore ask that when designing the simulation layer - PLEASE allow us to simulate individual physics bodies (or groups of) manually at any given time, within the context of the main physics scene, with whatever delta times and paramaters we desire. Those who are familiar with the way Character Movement Component works may cotton on to why I want this so badly.

PhysX doesn’t let you do this, you either simulate the whole scene as one or you simulate an object in it’s own scene. I understand why - but it’s infuriating. Being able to simulate a single body within the context of all other bodies individually, would allow for an acceptable method of handling server-authoritative, predicted physics for player-controlled objects - without the need for complex buffering and fixed simulation sizes.

I’d be eternally grateful. Please reach out to me if I can help with this or explain more.

If you want anymore background for this request, see this:

Seconded. This is really important.

That would be a great feature.

Definitely +1!

This indeed.

Also fixed timestep by default with proper interpolation for rendering!

I doubt, unfortunately.
Epic are no fans of data-oriented approach in core low-level systems.

If you look at Chaos code it’s pretty much DOD design. Simple tighly packed arrays everywhere, with parallel for to maximize multithreading.

It’s kind of impossible to make this kind of system perform so well across platforms without DOD.

More likely option would be that they would expose individual solvers IMO. It would enable you to do that and Epic wouldn’t need to care about how to solve each funky bug that comes into physics scene from doing that…

Tbh, I’d be more thrilled just to get more control over things:

  • expose physics ticks by design, don’t keep the old delegate route where people has to know the right places to read the data from due to internal engine transform caching not being up-to-date on physics steps.
  • expose physics stepping mechnanism: let people step physics like they want, don’t hardcode it like it’s done now
  • allow option for fixed timesteps and interpolation for it
  • expose individual physics solvers

UE4 competition has done all that except the last one for years, would be nice if actual physics sim got more flexibility instead of keeping the focus on pure visuals.

You can kind of do that already using PhysX immediate mode - but the caveat is that it doesn’t scale well because you have to copy data between scenes/simulations. Here’s the approach I would like to take for Server-Auth physics that I believe is scalable, and could also produce acceptable results for most games. Certainly at least anything that uses characters could utilise this.

CMC-Style Approach to Physics Movement

**Pre-Physics (Client)**
- Resimulate any corrected moves from Server, or delete any acked moves.
- Smoothly interpolate render matrix to collision prim matrix for corrected moves.
- Compute Server Move Delta Time
- Consume Player Input
- Create new 'Saved Move', identified with a timestamp like Character Movement

**Physics (Client)**
- Simulate the clients object, using the calculated delta time and saved input.

**Post-Physics (Client)**
- Gather result of the move, save, decide whether to combine with previous/next move and send to server as required.

**Pre-Physics (Server)**
- Received client move, check validity.
- If valid, place client bodies back at the last acknowledged transform (alternatively, 'pause' simulation on the object between receiving moves, and accumulate forces and impacts).

**Physics (Server)**
- Simulate the clients object from the correct starting transform, using delta time calculated from delta between received packets. Here we're using the latest version of the physics state - which hopefully is similar to client state.

**Post-Physics (Server)**
- Compare result with client result, send ack or correction as neccesary.

There are two barriers to this system right now:

  1. The Server needs to be able to simulate each client-controlled object with an arbitrary delta time, but within the latest state of the physics scene. This is not currently possible without copying all scene data to an immediatte simulation or another physics scene. This has to be done per-client!

  2. The Client needs to be able to simulate it’s controlled object many times, in the context of the main scene, but without (or with, up to you) altering other scene objects. Again this is impossible without copying data continously to an immediatte/duplicate simulation.

  3. The client must be able to separate visual transforms from collision transforms, or risk endless move corrections from the Server. FPhysicsReplication smooths out received physics body states but the collision transform is therefore not fully in sync. This can result in huge amounts of corrections between smoothed objects.

Another thing worth considering is that if this does work, we culd also create non-kinematic character movement components (wouldn’t support root-motion of course).

I’m aware of the physx immediate mode, just hoping there will be something like that on Chaos and this time, properly exposed by UE4 (and not hardcoded for animation physics only like the current immediate mode plugin).

The core thing that annoys me on UE4 physics is that they seem to do things mainly to drive nicer visuals, there’s very little control on physics given out of the box.You can work around the limitations but it’s way harder path than it should be. :slight_smile:

Yeah I agree, I guess the problem with immediatte mode is that you need to deal with a lot of PhysX types natively and reconstruct a lot of data for it - so exposing that nicely is probably easier said than done. I’m hoping the (hopefully) reduced abstration between PhysX and Unreal will help with that too - maybe even offer a performance boost.

There won’t be any reduced abstraction between physx and unreal, because Chaos is going to replace PhysX.

Goal of Chaos is cut any third party physics solution from vanilla engine.

Yeah exactly, what I’m hoping for as a result is reduced abstraction between the physics engine and the actual engine.