Can we run Havok inside a Web Worker?

Here’s currently what I have:

  • Static ground (gray) and ramp (red)
  • Kinematic platform (green)
  • Dynamic boxes (yellow) and 3rd-person player (blue)

There are 1000 always-active dynamic yellow boxes that can collide with each other

A SharedArrayBuffer is used to share data between the main thread and the Web Worker

H̶a̶v̶o̶k̶ ̶w̶i̶t̶h̶o̶u̶t̶ ̶W̶o̶r̶k̶e̶r̶

H̶a̶v̶o̶k̶ ̶w̶i̶t̶h̶ ̶W̶o̶r̶k̶e̶r̶

EDIT: Please watch videos in the post below instead

I’m on a rather old laptop, and recording with OBS Studio definitely caused a hit to performance. As shown in the videos, the FPS was

  • ~30 without Worker
  • ~90 with Worker

However, the physics step compute time was noticeably slower in a Worker with OBS Studio recording. It’s ~10X faster without OBS Studio recording

You may also notice that the physics is slowing down as it’s struggling to keep up with realtime - related to our chat in your post, @riven04 :slight_smile:

3 Likes