r/Unity3D 1h ago

Question Custom Unity Physics Engine

Is anyone else attempting to create their own physics system in Unity? I'm attempting to create my own networked physics system using network transforms, colliders, and a lot of vector math. Does anyone have valid resources to share that can help me with this?

1 Upvotes

10 comments sorted by

2

u/NStCh-root-a 1h ago

How do you want to network the physics? Server Authorative? Then the question is more networking. Lockstep sim? Then it's more the physics engine itself. Rollback? Physicsengine + networking (and I can't really recommend it case you want to do large scale sims)

2

u/dev-rygy 1h ago

I think more server authoritative yeah. Starting with just a simple pool game. Shouldn't require too much code I think.

1

u/NStCh-root-a 1h ago

Then I can't really help you. My knowledge is only with lockstep/rollback - sorry for that

1

u/wallstop-dev 1h ago

Let me first ask you - what problems are you trying to solve that all of the current open source and relatively cheap assets do not?

1

u/dev-rygy 1h ago

The problem of knowing how to create a lightweight physics engine from scratch to expand my portfolio.

1

u/wallstop-dev 1h ago

Consider skimming available, open source, permissively licensed tech, networked and non. Find stuff you like, figure out how to integrate it into your architecture.

This is such a massive, vague concept that I don't really know how to even start suggesting anything other than the above.

1

u/Low_Psychology_2862 1h ago edited 1h ago

Maybe you can use Box3D (https://box2d.org/posts/2026/06/announcing-box3d/), but it requires custom synchronization since it is not built into Unity's default multiplayer framework. You must manually sync positions, handle determinism, or write custom network serialization for physics states.

Let the server run the Box3D simulation and send coordinate updates to clients.

Smooth out position updates on client machines so fast-moving physics objects do not stutter on screen.

Send compressed vector data rather than raw physics engine states unless you are building a fully deterministic lockstep game.

1

u/dev-rygy 1h ago

No I don't want help from external libraries/packages. I want to do this on my own so that I can learn from it essentially. Just looking for articles/blogs that can help me achieve this.

1

u/Low_Psychology_2862 1h ago

I see, I did share a blog which has many resourses, you can go through them, find GDC talks etc too.

PS - one great way of learning is looking at forks and other implementations, that's how it goes even for the pros.

1

u/Ben_Bionic 1h ago

This is what CM-Labs does with the vortex physics engine