Page 1 of 1
Hypothetical question about models and ragdoll physics
Posted: Tue Sep 06, 2016 20:03
by Nash
This is just small talk.
Let's say... IF a skeletal model system is added into GZDoom. Would it be possible to flag an actor's model to ragdoll (probably an A_SetRagdoll(bool) call in the Death state) and have the limbs just uncontrollably ragdoll in the level upon the actor's death?
More specifically, does GZDoom have the required data to make it work (like does the level actually have any 3D collision data so that the limbs can interact with the level)?
I am imagining that, as far as positioning goes, the model's root "anchor" will follow the actor's XYZ coordinates... in most cases, this will either be root bone at the hip, or on the floor, between the legs (depending on the model).
Re: Hypothetical question about models and ragdoll physics
Posted: Tue Sep 06, 2016 20:41
by Graf Zahl
The engine cannot do anything more than its cubic collision boxes when it comes to collision detection. It's just an alien concept to the game.
Re: Hypothetical question about models and ragdoll physics
Posted: Tue Sep 06, 2016 22:18
by Rachael
I think Graf already answered it better than I possibly could - however, theoretically, with a lot of work, it's possible.
With the understanding that more than half of ZDoom and GZDoom's code will be gone in the process. You're basically going to have to rip parts out of the engine and plug them into a different engine - and like setting up a home theatre system, you're going to have to make sure which parts are compatible with which, doing calculations and adaptations to new unit standards along with the process.
And then another worry is license compatibility - if you're doing this all open source you can do whatever the hell you want in your own home - but publishing it is going to be a huge issue for you because of license restrictions. You're likely going to need permission from Blzut3, Graf, *and* Randi for all the code you borrow, unless the target is GPLv2 compatible - and then you have to make sure that the code you are using is actually written by them.
In short - with strictly using ZDoom's logic and data code and a completely new engine, it is doable. But a lot of the familiarity and compatibility you would take for granted would be gone in the process. In essence, it's not much different than how AFADoomer created the WolfTC - with the exception that all his conversion happened outside of the engine.
With all the effort and work required - you might as well just go learn Unity or UE4. You'll have something workable a lot quicker that way.

Re: Hypothetical question about models and ragdoll physics
Posted: Tue Sep 06, 2016 22:32
by dpJudas
I don't think you really have to rewrite the engine to do rag dolls. What you need is a rigid body physics system (Bullet) and then you need to declare the level mesh to it so that the ragdoll can bounce around. You could probably use the BSP tree for this, or iterate over all the sidedefs and then find some clever way to define the planes. The truly hard part is that ZDoom extended the Doom format in so many ways and you'd have to make sure all of them are reflected in the mesh sent to Bullet.
This of course assumes that the actors in Doom doesn't need to interact with the ragdoll. You'd effectively have two independent physics systems running at the same time. And it also assumes you'd have someone willing to invest a substantial time into this. But theoretically it could be done.
Re: Hypothetical question about models and ragdoll physics
Posted: Wed Sep 07, 2016 1:57
by Nash
dpJudas: that's what I was wondering (about the level mesh), thanks for the detailed explanation. And yes, I'd assume that the dead body is just going to interact with the level and not other actors. As far as "actors" go, I'd assume the simple cube Doom collision would still apply and work as it always has before. It's just the limbs that would collide and bounce with the level geometry.
Bullet does indeed sound like the best middleware SDK to use for this situation.