Re: CVE Deformation + CC?
Nonsequitorian wrote:
Box2D would ruin the game for me. I absolutely hate having hitboxes and things like that, I like having odd shapes like we have now.
Duh102 wrote:
These aren't hitboxes, they're MO-MO collision boxes. So they'd only come into effect when you're trying to stand on a dropship.
Well, duh summed the main problem with your problem with it up, except it's likely even as limited as MOSR-MOSR collision boxes, as MOSPs and MOPixels both collide more or less fine with MOSRS. The way I'd do it would be to look at the AtomGroup for an object, check if it has >1 atom in it, and create a polygon out of those atoms if it does.
The other issue ("Yeah, but you'd still have corners cut off.") only applies if you stick to 1 shape per MOSR and there's a low cap.
Just reading over the Box2D documentation now it looks like you can expand the hard limit on vertexes per shape, to say, 32 (as we can't have >255 GetsHitByMOs MOSRs at the moment due to the MOID cap so 32*255 2D float vectors in memory - that isn't expensive at all, ~63.75kb in raw floats + vec2Dfloat class methods, hardly unworkable) and avoid that whole issue - a 32-gon should certainly be enough to describe almost any wacky shape, for example:
That's a 20-gon. Fits the surface like a glove.
Also, even if you did want a huge shape with holes in the middle (something Box2D at least, won't allow) this kind of solution would still address the problem better than the current MOSR-MOSR collision behaviour - 90% of the time, the smaller MOSR (like your actor's leg) gibs everywhere, otherwise you slide over each other.
Furthermore, it's not a hitbox system, it's a rigid body collision system. AFAIK it's what the current system is trying to emulate.
Also, most of the time in CC (>90% afaik) objects are using very very very simple atomgroup structures. The craziest shape in vanilla CC would probably be a dreadnought leg or a gun. Think: Body, more or less elliptical; Rocket, more or less smoothed rectangular; Dropship, more or less elliptical; Head, pretty much circular; Arm, two overlapping ellipses (though could be done with an irregular quad if you wanted low atom/poly count); Gun, series of overlapping squares; Grenade, more or less rectangular.
My conclusion from that - we don't have that many crazy shapes.
The only real issue I can see is potentially some memory overhead from storing the poly data and collision systems. tl;dr using this CC might need another hundred meg ram or so, worst case. Not sure of CPU overhead, this solution could actually use less juice if the RTE MOSR-MOSR collision code is very slow.
Also: Me working on the CC code for this raises issues - I'm not excellent at C++ and haven't worked with a direct C++ implementation of Box2D before. I'm uh, willing to give it a go I guess, but Dan knows his code better than anyone and would be able to put it together a lot sooner if it's possible.
Regardless, implementation possibilities:
all MOSRS (or maybe only GetsHitByMOS MOSRS) have an associated body (which stores their central position, orientation and velocity, so sits at the spriteoffset and is fed pos, vel and rotation (and rotational velocity), as well as any impulses /torques from the other collision phase) and shape (which is interpolated from their atomgroup), which is associated with a box2D world of equal size to the cortex command world and fed the same deltaTimes on its update. When the Box2D physics calcs are done between all the objects, the outcomes are fed back to the RTE physics.
That last step could be tricky or simple, depending on the RTE functional equivalents of the box2D side of things.
Also, the Box2D world wouldn't need gravity, as that'd be taken care of by the RTE side of things too.
This is still all conjecture though. I kind of need Dan's input to know how truly viable it is.
@CC48 - that'd help too, interpolation can be costly though.