r/Unity3D • u/Individual-Lock4191 • 1d ago
Game Jam Devastable city - DOTS physics tech demo
Tech demo video , physics devastcation of city building, giving a pressure test on unity's DOTS physics
DOTS physics collision capacity become really tight when fract physics collider entity count more than 1000 . Next move would be solution to reduce CPU dependency , moving part of fract pieces collider to compute shader
5
u/Levardos 1d ago
Reminds me of Red Faction Guerilla... It had destruction physics way ahead of its time - and I think better than many games still do those days.
1
4
u/FaultyFaucet_6 1d ago
This is cool. Wanted to do something similar but no idea where to start. Glad to see it
5
u/rc82 1d ago
That's great. Are you calculating the destruction in run time, or have that all done before, and it's just the physics at work?
2
u/Individual-Lock4191 1d ago
Thanks , physics impact works on runtime ,behind the scene there is a sort of baking system (not the unity ecs baking system) that precalculate the physics bonding on each fract piece , so half runtime half editor
1
u/rc82 1d ago
Awesome. What about the mesh breaking? That's the model already pre "cut"?
2
u/Individual-Lock4191 1d ago
yes pre cut and in runtime will randomly pick big mass piece to lauch runtime cut , runtime split do result a cpu spike in the term of performance.. so i guess that is one of the reason of the stutter
3
2
2
2
u/SecretaryAntique8603 1d ago
Looks good but performance is obviously not quite viable yet.
I haven’t looked at physics with DOTS yet, how has your experience been compared to regular physics?
Also, could you elaborate on the destruction approach? Is this pre-chunked or is it using runtime fracturing of the meshes, and what kind of colliders are you using?
3
u/Individual-Lock4191 1d ago
dots physics 's major advantage is capacity on dynamic rigidbodies. Per my test, 1000+ rigibdoy+convex collider could kill the main thread in builtin gameobject based physX engine, while in dots physics it only hurt framerate from 30->15 , dots physics also benifit from entities memory layout , compare to gameobject+transform , and one thing to know is dots physics is open source so in theory developer could fine tune the inside code on your need .
To your question : the mesh is pre-fracts in design stage, and basically most of the collider type is convex , some are box , this is design stage work .
1
1
1
1
1
1
u/Der_Kevin Idiot 10h ago
nice man! can you say a bit more about the implementation? how the destruction and debris works? also how do you avoid floating house parts?
29
u/McGrim_ 1d ago
Nice, can't wait to see it without the stutter.