Ragdoll and Back Again | The Brick Dead Project

Hiya! Thanks for coming. Today we enter the dark, middle(?) chapter of The Brick Dead Project, the true to life account of a bored grandpop on his ham-fisted attempt to create a video game without any of the prerequisite skills or talent. You are reading part seven of an ongoing series. To catch up on previous events, click this link.

The skeleton on the screen burst into a spasm of elongated polygons and resumed walking. I slammed my fist down on the desk. What was once a rare occurrence had become a weekly outburst. I kicked the desk, spinning my chair around to face the Mrs. on the couch behind me. She lowered her tablet a half-inch to peek over it at me.

“I don’t think I can do this anymore,” I stated with a warble in my voice.

“You can stop if you want.”

“I don’t want to stop!” I roared back. “I’m just not smart enough to keep going,” I added silently to myself.

I stomped out of the house and began weeding the front yard. Screw this crap! I had real work to do.

It would become known as “Ragdoll Week” at the GUO homestead, a dark time referred to only in hushed whispers while making the sign of the cross to ward off ill fortune. It was the second time I quit this project.

The soul would have no rainbow had the eyes no tears – The Century Vol.44 Issue 4, John Vance Cheney

Big plans! Great plans! Great Big Plans for my new lil’ AI constructs. A kneecap shattering whack with a Force Ball would send the little buggers flying across the scene. And then… They would get back up again, determined to soldier on in undeathly defiance until their pool of hit points was depleted. This was the second phase of the Brick Dead project. Basic mechanics established, this was where Breakout met survival.

The first part of skely’s fate was easy. –ish. Ragdoll physics have been used for quite some time as an alternative to scripted animations for dead characters. You just turn off the animation and movement controllers, enable physics and colliders for the limbs, give it a shove in the right direction, and bingo! Dead, crumpled bad guy. Going from a ragdoll back to a fully operational dude is quite a bit more complicated. You need to figure out where the heck the body went, what position it’s in (out of a nearly infinite number of possibilities), subtly move the limbs back to a point where they can be blended into one in a series of ‘getting up’ animations determined by which way the character had fallen, then re-enable and reinitialize the animation and movement controllers. It was a lot to remember, let alone figure out. Particularly for someone with my “mastery” of C# and math.

Of course, the Internet was ready to provide a helping hand.

Enter my hero, Perttu Hämäläinen, an assistant professor in computer games at Aalto University, and writer of the Thoughts and Code blog. Perttu had been kind enough to cast his code, complete with the source for the scene you see running above, adrift on the Web for all to share. All I had to do was figure it out and adapt it to fit into my own project. Easy-Peasy! It was well structured, well commented, and… Well, it might just as well have been written in Hebrew. But, no matter! Less then a month ago I had been chuckling boyishly at the term rigidbody (Heh, still a little funny), now I not only knew what a rigidbody was, but how it worked and the myriad of labyrinthine terms that went with it (So, kinematic IS a real word!). I could certainly handle a helping of copy/pasta, even if I still had to make my own secret sauce.

In everybody’s life there’s a point of no return. And in a very few cases, a point where you can’t go forward anymore. And when we reach that point, all we can do is quietly accept the fact. That’s how we survive – Haruki Murakami, Kafka on the Shore

It had been FOUR F#$!ING DAYS!

I had been raised on Unity tutorials and YouTubers. This was the work of a real programmer. I was in way over my head. Whole chunks of code were embedded in variable declarations. Even the simple script of translating a mouse click to on-screen activity was new to me. Nothing in the demo project related to anything I had used before other than the animation controller. It was a full day before I even knew where to start. It was two more before I had it wired into the skeleton's collision detection. Through it all was the complexities of dealing with a character cobbled together by someone still lacking two clues to rub together.

An army of failed experimental skeletons laid before me. There was, of course, Skely. Then there was CreepSkely. Then there was  CreepSkelyNew, RagdollSkely, RagdollSkely2, CreepSkelyNew2, RagdollSkely2New, CreepSkelyAdv, and, finally, CreepSkelyAdvNew. Some were safely stowed away in their own experimental sandboxes. A great many more lain broken in the bowels of Brick Dead. All had failed to live up to the expectations of their mad necromancer god behind the keyboard.

The skeleton would walk. I would hit it. It would crumple and fly backwards. After a time, it would burst into a spasm of stretched out skeleton bits before coalescing back into its upright form to continue the march.

It worked right in the demo project. It worked right in the sandbox project. It worked right when I moved Brick Dead’s assets to those other projects. It failed spectacularly inside the game itself. And I didn’t know why.

I was close. I also wasn’t getting any closer. I had been staring at this f@&$ing code for what felt like years and yet its mysteries still eluded me. I mean, there was only a freaking Rosetta Stone of programmer comments guiding me every single bloody step of the way. What the heck was wrong with me?!

I’m just not smart enough to keep going.

I had yard work to do, anyway.

The definition of insanity is doing the same thing over and over and expecting different results – Narcotics Anonymous, frequently misattributed to Benjamin Franklin, Mark Twain, Albert Einstein, and Far Cry 3

I mean, did you really think this quote originally came from Far Cry 3? The writing and characterizations in that game are God-awful! It was the first game that made me feel so bad for playing it that I had to quit. It’s a true shame it has such spectacular performances to back up that dreck! It’s also kinda racist. And not that blatant ‘making a statement’ kinda racism, but the much more subtle racism that you don’t immediately notice it because it’s just so ingrained in the personality and world views of the storyteller that it feels de facto in the world he created. It’s even worse that this California white-boy power fantasy is a follow up to the insightful (if flawed and incomplete) masterpiece that was Far Cry 2. I mean, Far Cry 2 has you-

What? Oh, right. Sorry about that. Now, where was I? Ah, yes. Blender…

I look a couple days to cool my head by busying my hands. I worked on the yard by day and retreated to my virtual home-away-from-real-life of Star Trek Online at night. Since covering the Free-2-Play launch three years ago during a particularly dark family crisis, STO had become that one place I retreated to when things were at their worst. I mean, if you need a dose of escapism, why not hang out in Spock’s neighborhood? Besides, after three years I knew all the big people, flew the best ships, wielded the greatest gear, and knew the hottest spots far away from the chatter of the common folk. White-boy power fantasy, indeed. Best of all, there were no ragdolls, just good, ol’ fashioned, scripted animation.

Wait… Scripted animation!

A new plan popped into my head. I was going to do this old-school. On impact, skely would turn to face the collision point and go into a knocked-down animation. From there we transition to a downed animation, and, after the timer cools off, go to the get up animation. Nothing too fancy there! There was just one problem: My cache of motion capture data didn’t have a knocked-down animation. But I had a program that could create one. Blender.

Yeah, Blender. The (redacted) hell-spawned (really redacted) of 3D modeling software. It is a testament to the beat down I had taken at the hands of The Ragdoll Experiment that I would even think about opening Blender again, let alone doing so with the intention of creating animation, something I had, as usual, absolutely no experience with.

Well, if I was going to brave the Blender Beast, I might just as well do as much as possible while I was in there. I couldn’t make an animation without a model. Zombies were on Brick Dead’s list of dream features. I had just seen a tutorial on exporting models from a free model builder called MakeHuman. Maybe, just maybe, I could create a zombie-ish model, use it to create my knocked-down animation and, provided I survived, kill two birds with one textbook.

I didn’t know if I could actually do it, particularly in my distressed state of mind. I did know of one way to find out and, as they say, curiosity cured the cat.

I was like a beautiful dream. MakeHuman is a phenomenally easy program to use and creates absolutely spectacular models. Like the other tools we’ve featured in this series, this is another free, open-source project just waiting for anyone to pick up and play with it. Getting my newly crafted zombie model into Blender required a bit of research, but fared well enough. I lost all the textures in transit as MakeHuman had just gone through a big update and the information I was able to dig up was out of date. No matter. When it came to Blender I expected worse and was content with calling it a draw. I can deal with missing textures later.

After figuring out how to access the animation portion of Blender, I received the shock of a lifetime. You sitting down? Okay, here we go: Blender’s interface for creating animation is straightforward, easy, and behaves in a way that makes perfect sense. Really! I mean, once you get past all that right-click-is-select stuff (It IS still Blender, after all) it just works! You select a point on the timeline, move your model, save its position, and repeat until done. In less that two hours I had my (now unskinned) zombie flying backwards and sprawling out on the ground just waiting to be matched to my getting-up animation in Unity. I exported the animated model from Blender, imported it to Unity, and-

knockbackfail

Woke up from the dream to discover I was still living in “Ragdoll Week”. I watched in horror as my new creation’s body spasmodically convulsed in the air while its butt, and only its butt, flew backwards ten feet.

Alt-F4. Rage quit.

Sometimes you want to go where everybody knows your name. And they're always glad you came – Gary Portnoy, Cheers

The next night found me drinking at the bar. Virtually, of course (Hey, what do you expect from the guy who created the Growing Up Otaku brand?).

Drozana station, a Ferengi run dump of a collapsing space hulk smack-dab in the middle of the Neutral Zone. It had once been the secret hotbed of role-playing in Start Trek Online. Founders rubbed elbows with escaped Orion slaves while deposed princes debated the ethics of the Federation with philosophizing lizard men. It had once been Ren Fest via the Creature Cantina of STO with live performances nightly and twice on weekends. The installation of a premium currency trade-in section killed that scene as the norms and griefers discovered folks nerdier than themselves to pick on. Now it was just another static, oversized MMO map where the only chatter consists of complaints regarding the latest patch. Still, my chair was still at the bar, Cardassian Kanar is still ten credits a belt, and old habits die hard.

I shoulda made a space game. Stupid starships. No animations. No ragdolls. They just spin and blow up. Even I can make things blow up.

Wait… That was it! I was just going to blow them up! What the heck was I thinking anyway? Hit points?! How many times are you expecting someone to hit a moving target with a frigging pinball?!

Helmsman Mou, set a course for the Internet! We need to find bone.

There’s a joke here about getting a bone on the ‘Net, but I’ll leave that part up to you Winking smile

I did indeed find a bone. It was the size of a football field and had so many polygons that it brought my video card to a screeching halt.

Fortunately, at this point Blender and I had managed a truce of sorts. Well, perhaps “acknowledged each other’s right to exist with mutual disgust” would be more appropriate. None the less, I was able to reduce the size and polygon count of the bizarrely proportioned bone model in a reasonable amount of time with a reasonable amount of swearing. Much like the rock-breaking effect on the tombstones, I plugged the rehabilitated bone into a particle system, added a secondary particle system to spew some dust about, and let ‘em both rip while destroying poor skely on impact. The result was… satisfying.

skelyboom

And hard to screenshot.

It wasn’t where I wanted to go, but I was happy with the result. In fact, I might have ended up here later once I had actually playtested skeletons that took multiple hits to put down. It’s tough to say. The results spoke louder, anyway. It was entertaining and satisfying to hit an enemy with a bouncing ball and have them explode.

I had created the ‘basic’ version of my game idea in two weeks. I had spent about nine days wrestling with this single blasted feature that I never got right and had to drop. It was the first time in this project that I set my mind to a task and just couldn’t make it happen. I was beaten, battered, and humbled, but I was still in the game. For good or ill, The Ragdoll Experiment was over.

Or was it?

No comments :

Post a Comment