Modify or Distribute Physics Workload?

Feedback on past, current, and future development.
Post Reply
CarbonoxInfernox
Posts: 3
Joined: 12 Oct 2017, 19:09

Modify or Distribute Physics Workload?

Post by CarbonoxInfernox »

Hello,

I've been spending a lot of time tweaking various settings to strike a balance between quality and performance; making sure that both the CPU and GPU have something to work on instead of waiting on the other to finish. One thing I've noticed is that physics (and culling, but I don't know enough about how that works to say anything about it) becomes the main user of CPU time as I push exterior cell load distance (ECLD) higher. Specifically, this is true when I hit 3, and overwhelming at 4 and above. The amount of physics demand per cell will vary, but on average the total should increase quadratically with ECLD. I want to be clear that I'm not referring to the positive feedback loop wherein the physics time explodes to hundreds of ms.

I guess I'll phrase this half as a question and half as a suggestion. How feasible would it be to:

1. Reduce, simplify, or altogether stop physics calculations at a certain distance from the player (uncoupled from ECLD or view distance), or
2. Parallelize the physics workload and send tasks to other cores

I've read other threads here about multi-core support, so that's why I'm asking about feasibility rather than saying "Omg guys just use more cores pls". I also realize that this sort of optimization might be slated to occur post-1.0, but we don't really need to have a discussion about that. This is a volunteer project, so an easy task with an interested dev might happen overnight, and a difficult task with no support might never happen. I guess I'm just curious about how this works under the hood, and I don't have coding experience to draw any conclusions from the source.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Modify or Distribute Physics Workload?

Post by AnyOldName3 »

There are probably optimisations that can be applied to the physics system (after all, the library we use, Bullet, manages to do far more impressive things in real time in other games) and there are definite cases where improving the collision meshes associated with certain objects would help, but the big thing here is that you're not really supposed to change the exterior cell load distance. It can break quite a lot of things quite spectacularly if they can be triggered while the player is further away than they expect. We already have distant land support, which can help make things look better with the default ECLD, and distant statics will be supported at some point.
User avatar
xirsoi
Posts: 21
Joined: 21 Oct 2014, 21:14

Re: Modify or Distribute Physics Workload?

Post by xirsoi »

Other content could be created with a larger ECLD in mind, and thus not have the issues seen with vanilla. I think improving performance in this area would be a great idea. However, as it would only benefit non-vanilla content, this is probably a post-1.0, or at the earliest in the final stages of pre-1.0 development.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Modify or Distribute Physics Workload?

Post by AnyOldName3 »

If other content was being made with a larger ECLD in mind, it would probably be made with sensible collision meshes, so the issue would be far less pronounced. Optimisation should be done whenever possible, but it's potentially really difficult and time consuming.
User avatar
xirsoi
Posts: 21
Joined: 21 Oct 2014, 21:14

Re: Modify or Distribute Physics Workload?

Post by xirsoi »

And premature optimization is bad m'kay, hence my suggestion it wouldn't happen soon ;)
Post Reply