You are here

RBA Files/Level Accessory Animations

Pages

Trent's picture
I was in the War!
Community VIPKickstarter BackerCompetition Winner
Posts: 2986
RBA Files/Level Accessory Animations
#1 Submitted: Thu, 26/05/2016 - 12:59

Last week I started poking around at the RBA files again, which are the animation files which control movement of accessories in levels, such as doors, lifts, the crusher on Sumo, monorail on Outskirts, dock loader, bridge and robot arm on Reprocessor, etc. It turned out Errol had already figured out most of the file format, so working together we finished it off and then figured out what all the variables were used for. There's a few oddities left to figure out but it's 99% there and I've been adding import & export support for it in my MaxScript tools. Unfortunately it seems I'm having some issues with the exported rotation and position data not being exactly as it is in 3DSMax but as the files actually worked and gave an amusing result, I figured I would post about the progress.

I used the Robot Arm as a test because it's one of the more complicated animations in the game, here it with the RBA imported into 3DSMax:

Notice at one point the hand rotates backwards through the arm? Yeah, I thought that was an error in my importing code too but it just so happens to be how the thing was animated in the first place. Gee, aren't there any competent animators working on this game? FIX IT SCi! ;P Anyway, re-exporting the same animation crashes the game so I figured there's some issue with the way the animations are put together by my code and knocked up this simpler animation to test it out:

Which led to this unfortunate series of events when I was testing it (I changed the robot arm to trigger the animation when it's touched):

Fun times. Anyway, I'm going to try and get the code fixed up and working properly, after that it means it will be possible to do such things as porting C2 levels like the Airport and Funfair which have planes, rollercosters, etc. Possibly also drone cars too. Also it would open the doors to creating dynamic levels which change based on events, such as fissures opening in the ground, buildings collapsing, giant robots attacking cities, catapults which launch cars across the map, etc. A world of possibilities come from being able to animate accessories!

shane's picture
Community Manager
Stainless
Posts: 1275
Submitted: Thu, 26/05/2016 - 13:53

Excellent progress Trent and Errol! Can't wait to see what creations modders will come up with this!

Espyo's picture
Velociraptor Fister
Community VIPKickstarter BackerModerator
Posts: 1471
Submitted: Fri, 27/05/2016 - 11:16

This is a really great development, you guys! I laughed way harder than I should've at the flinging gif! So, are we any closer to that fabled story on that one blog post, where some object was spinning so fast it was causing physics to break? (Or did we reach that point already?)

PS: omg sci what crapy animatons y dos the hand go throu the arm omg???

I'm Espyo from the Carmageddon Wiki!
I'm currently working on a fangame engine for Pikmin games.

lemonrev's picture
Velociraptor Fister
Kickstarter Backer
Posts: 1627
Submitted: Sat, 28/05/2016 - 05:59

I love to hear new stuff like this, I had no idea the animations for the Robot arm wasn't something that could have been messed with. But now it is, Im glad to see the result, As the flying car and then the auto hit, you could make a fake cricket or ping / pinball and all sorts of mini games that could be made with the game.

Will be keeping an eye on this one closely like everyone else.

I have to laugh at Espyo's Ps comment :). You made me laugh there :)

starbuck's picture
Velociraptor Fister
PayPal Backer
Posts: 1406
Submitted: Sat, 28/05/2016 - 16:08

Nice find Trent. I havent even gotten anywhere that far yet. I was assuming it was all done by basically TXT files.

Why is it that when you are a child at the dinner table you can get punished asking for someone to please pass you the fork and knife ?

Mad Mike's picture
Velociraptor Fister
Kickstarter Backer
Posts: 1128
Submitted: Sun, 29/05/2016 - 08:17

Fantastic work Trent & Errol! Another excellent development & lots of potential for the future.

Edited by: Mad Mike on Sun, 29/05/2016 - 08:18

One man... Alone... Wrecking opponents in the Automobile he loves
Twitter Manifestation, Mods for Max Damage

Trent's picture
I was in the War!
Community VIPKickstarter BackerCompetition Winner
Posts: 2986
Submitted: Sun, 29/05/2016 - 14:39

Thanks guys, I was pissing myself when it launched me the first time!

@Starbuck: RBA files are binary. If they were text files it would have been substantially easier and we would have had it cracked long ago ;) RBA's have been sitting down on the list of to-do file formats to figure out for ages, it was only last week that I decided to get it figured out. It was only when I had figured out the footer listing the object names and a bit of the header when I found out errol had already got most of the binary format deciphered already D:

The format is mostly fairly simple:

Byte MinorVersion
Byte MajorVersion
Int16 Unknown (always 0?)
Float AnimationLength (in seconds)
Int32 NumberOfObjects

For each object:
    Int16 Always01 \____ this defines the position section
    Int16 Always02 /
    Int16 NumberOfFrames
    For each frame: 
        Float FrameTime
        Vector3 Position  (Relative to parent)
        Vector3 ChangeFromLastFrame
        Vector3 ChangeToNextFrame

    Int16 Always02 \____ this defines the rotation section
    Int16 Always03 /
    Int16 NumberOfFrames
    For each frame:
        Float FrameTime
        Float Unknown
        Vector4 Rotation (quarternion, relative to parent)
        Vector4 Rotation2 (quarternion, relative to parent, usually the same as above)
        Vector4 Rotation3 (quarternion, relative to parent, usually the same as above)
        Float Unknown2
        Float Unknown3
    Int16 Spacer (always zero)
Int32 NumberOf Objects:
For each object
   String ObjectName (32 bytes)

There's a few Unknown values, mostly in the rotation section. I'd have thought the 3 quaternions would have followed the same pattern as the 3 position vectors but the 2nd and 3rd don't seem to be relative to the previous and next frames. It's also weird there's a float before the the quaternions and 2 floats after them. Those unknown floats always seem to be zero too. It would be handy if Si or someone from the coding team could pop by and fill in the blanks!

Right now I'm just at the point of figuring out why the animations are not exporting correctly. My best guess is it's due to the way tweening works between the rotation frames. It'll take a bit of experimenting to figure it out I think.

starbuck's picture
Velociraptor Fister
PayPal Backer
Posts: 1406
Submitted: Sun, 29/05/2016 - 21:24

I made it a goal to look at them to test what you were having with. And again THAT even got put off. I am like 10 "projects" behind.

Damn looking at the code brings back about 20 years worth of memories. Back when I was learning Windows coding and MS visual etc.

Edited by: starbuck on Sun, 29/05/2016 - 21:27

Why is it that when you are a child at the dinner table you can get punished asking for someone to please pass you the fork and knife ?

Harmalarm's picture
Cunning Stunt Licker
Community VIPKickstarter Backer
Posts: 119
Submitted: Tue, 31/05/2016 - 07:56

Nice work Trent ( and Errol ) I'm sure you will figure out the final details for the exporter, as you have done with most issues for CR :)

Trent's picture
I was in the War!
Community VIPKickstarter BackerCompetition Winner
Posts: 2986
Submitted: Tue, 31/05/2016 - 16:13

Thanks, Harma! This is an example of the issue I was having, the forearm rotates pretty much all the way around the wrong away between two frames:

It seems to be an actual problem with using slerp between two specific quaternions, rather than an export issue or a C:R issue. As an experiment I manually slerped the rotations between frame in 3dsmax. I looked it up and it turns out 2 quaternions can represent the same rotation but be negative to each other so it requires dotting the previous and current frames together and negating the quaternion.

Now it seems to work!

And, yes, I did place the robot arms next to the starting grid so I didn't have to drive all the way to the factory each time I tested it out!

Interesting fact: You can control the animation speed and start offset for accessories in their level.lol entries, which is fun!

CzechDeath's picture
Velociraptor Fister
Community VIPKickstarter BackerCompetition Winner
Posts: 1826
Submitted: Tue, 31/05/2016 - 18:22

smoking hot! <3

Pages

randomness