Translating BEPUphysics v1 to Unity ECS & Job System

Discuss topics related to BEPUphysics or physics engine development.
Post Reply
bellicapax
Posts: 3
Joined: Thu May 10, 2018 4:46 pm

Translating BEPUphysics v1 to Unity ECS & Job System

Post by bellicapax »

Hi! I'm a Unity developer that has decided to go in over my head and really just dive deep into a world of pain and hurt - I'm attempting to translate the BEPUphysics v1 library into Unity's ECS & Job System.

My goal is actually to tightly couple the system so that changes within this new BEPU are propagated to Unity automatically - i.e., they will be working on the same components instead of having to bridge the already processed data. Also, since Unity's new ECS and job systems are supposed to be a huge performance increase, I'm really curious about how much of an increase I can manage to squeeze out of them.

This is a huge rewrite and I may give up and I may never complete it and I may do it all ass-backwards, but hey, who knows what'll happen! The goal really is to learn about ECS, job system, physics, and possibly give back to the developer community in some way.

If you want to follow my work, tell me what I'm doing wrong (be nice tho please!), help out, etc... here are the links:

Repo on Github

Twitch Channel (doing some live coding)

YouTube Playlist (archived twitch streams)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Translating BEPUphysics v1 to Unity ECS & Job System

Post by Norbo »

Hoo boy, that should be a... fun... project :)

I would add a cautionary note about v1- it does not map naturally to the performance-minded bits of the new Unity ECS model at all. Revamping it to actually make decent use of Burst and so on would require massive architectural changes. In fact, the end result of such a project would end up looking a whole lot like v2.

If your goal is really pushing performance, I'd recommend starting from v2 unless you just want the substantial learning experience of bringing a ye olde OOP-y codebase over to high performance norms. At the very least, v2 could serve as a guide for data layout and access patterns.

Let me know if you've got any questions. I don't have a great deal of familiarity with the unity systems, but the underlying principles are all shared. I wish you luck :)
bellicapax
Posts: 3
Joined: Thu May 10, 2018 4:46 pm

Re: Translating BEPUphysics v1 to Unity ECS & Job System

Post by bellicapax »

Oh! Good to know! I will take v2 as guiding architecture, although you're right about part of the goal being understanding how to port OO programming to ECS. Having a road map will *definitely* help, though. Thanks! :mrgreen:
User avatar
cosmixy
Posts: 225
Joined: Fri Jul 07, 2006 6:51 am

Re: Translating BEPUphysics v1 to Unity ECS & Job System

Post by cosmixy »

This will be interesting, I'd love to see this developed. A loosely coupled Bepu v1 kinda defeats the purpose of using v1 at all in Unity.

Watching your video, you may already know, but Unity does have c# features up to 7.2 if you enable them with an .rsp file. But v2 makes heavy use of 7.3 so it's still not workable in Unity
bellicapax
Posts: 3
Joined: Thu May 10, 2018 4:46 pm

Re: Translating BEPUphysics v1 to Unity ECS & Job System

Post by bellicapax »

Oh! I didn't know that! Thanks for the tip :)
Post Reply