Integrating Physx WASM into BabylonJS project

Im trying to integrate this into a multiplayer WebRTC Project but don’t know where to begin… Do I have to create a new Plugin for this or Can I utilise what already exists?

I found the other physics libs lacking!

1 Like

Pinging @syntheticmagus to see if he has a little guidance to offer on this.

1 Like

Hi bozworth,

The direct answer is that I think you would need to add your own physics engine to use this, though that might end up being even trickier than anticipated for this particular use case. (If WebRTC implies P2P, it might be hard to get multiplayer physics collisions working as expected without some sort of authoritative server.)

The other thing to note about this particular repo is that it doesn’t appear to have any sort of license whatsoever, so it’s not clear under what parameters that code is shared or what kind of usage is okay. Do you have a way to reach out to the repo owners for clarification about that?

1 Like

Isnt phsyx a hardware api for nvidia gpus ? Not sure that makes sense to do.

@syntheticmagus
Webrtc is just how you use udp in the browser. Its painful to use, but data channel gives u unordered encrypted udp. Quic3/web transport is doable now but getting the server deployment setup isnt so easy

2 Likes

Right, I was referring to the network architecture. If you’re doing physics on a networked app (in my limited understanding), there are challenges associated with the fact that not every client believes everything to be in the same place at the same time. Because of this, if multiple clients are running the simulation, they may get different answers because their states don’t match, which can be tricky to reconcile. I think there are a lot of ways to solve this, but the one I’ve heard most about is the “authoritative server” model where the server runs a physics simulation that can override the results from the client (if they even have local simulations at all). A P2P architecture based on (my again limited understanding of) WebRTC wouldn’t have an active server, so it might need to use some other approach to figuring out whose physics simulation was “right.”

2 Likes

webrtc doesnt have to be p2p clients in the sense of mesh topology, you can still be server authoritative in the sense of single source of truth for game state. its not ideal but its the only option really. chromium had a web channel api or something along those lines, but they removed it. next thing is now web transport which is pretty cool, because you can use it in a worker. it requires http3 connection though and not very many examples out there. i’ve always thought an alternative to webrtc could be to encode game state into a video or audio stream but i havnt seen anything doing that. hoping web transport gets some adoption so i can copy paste things

1 Like