finishing games

Lately it’s hard for me to finish video games, books, or TV shows that aren’t directly related to my job. I’ve owned Prince of Persia PS3 for months now, but until last week I’d been stuck halfway through the game. I checked my saves and the previous save time was in early March.

It’s not because I didn’t enjoy the game — far from it. I’d say this is the first 3D POP that pays true homage to the original two 2D games while still being something new, fun, and beautiful. Yesterday I realized I had enough time to sit down and plow through the last little bit — about two and a half hours of gameplay — and I did. Straight through until the last boss fight, the game is incredible. If it had ended after the last boss fight, as the Prince is walking down that corridor carrying something I won’t spoil while credits scroll to his left, then I would probably have placed the game somewhere high in my all-time best games pantheon.

But that’s not where it ends. Instead, the developers decided that the ending you’d just witnessed wasn’t right, and allow you to undo it. It makes absolutely no sense. The whole game the Prince is an incorrigible vagabond with a sharp tongue, but he does manage to learn and grow as a character over the course of the game’s events. Later on, he even starts looking to Eleka before checking to see if he himself is injured. The hint of romance that’s there in the beginning of the game, when the two protagonists meet for the first time, is well-played and develops believably through to the end. And yet, all of that falls to the sword-stroke of whomever wrote that little epilogue in order to give Ubisoft an easy out for sequel creation.

I mean, I can’t imagine they did what they did for any other reason than, “If you end it how it ends there, we can’t make an exciting sequel!” I know they’re planning on a trilogy of games. But that doesn’t excuse taking 15 or so hours of good writing and very good voice acting and ruining them through one set of bad choices that don’t make sense when looking at the characters.

It just doesn’t make sense that a team that got everything else right in this game could make such a horrific mistake after they’d already won. I may not get the second and third games, I’m so annoyed.

At least my iPhone and DSi aren’t as disappointing. The kinds of games I can fit in are the kinds I can boot up and play through a level or two of on the train. Lately Rolando has become a minor obsession, and I’m looking forward to Rolando 2 when it hits end of June. On the DSi I took the plunge and did a download of Mighty Flip Champs. It’s a really neat game that utilizes the two screens to make an interesting puzzler that’s fun, quick, easy to pick up, and full of great art and fun sprites. Had I know it was a WayForward game before I’d bought it I’d have been less hesitant. These are, after all, the guys who made Shantae, one of the best platformers on any platform and probably my favorite GBC game ever. I wonder when the DS version will hit? They did a tonne of work on the GBA version and it never saw the light of day.

So yeah… Developers, if you’re trying to tell a good story, also try not to jump a shark in the last five minutes. Me, I’ll be exchanging both Street Figher IV and Prince of Persia when I have a chance.

katt's mysterious 3D math lectures: how aim constraints work

More often than one would think, I’ll come across a post on CGTalk or some similar forum where the following question:

“Hi, how do aim constraints work? I’d like to write my own.”

gets the reply:

“Thats stupid. Why would you want to do that? Just use the built-in aim constraint. It’s more efficient.”

I hate that reply. It’s generally true that the internal node or whatever that handles the aim constraint in your software *is*, in fact, much more efficient than rolling your own through scripting or API-level programming, but without knowing *how* the node works internally, without understanding *why* it behaves the way it does, you’ll only ever be able to use that constraint in a limited number of ways.

The examples in this post are going to focus specifically on Maya, but the thought process is the same regardless of your software package. You may not have the same level of control when modifying the aim constraint in your package, however. In that case, knowing how it works so you can build your own and extend upon the behavior that’s there becomes all the more important.

Anyway, on to how aim constraints work. I’ll be using “target” and “constrained” to refer to the two objects connected by the aim constraint.

The first thing that happens when you aim constrain one object to another is that constrained’s position is subtracted from target’s. This gives you a vector in the direction of target that passes through both target and constrained.

Why is this important?

Actually the vector is very important — it’s one of three that are needed to describe the orientation of an object in most 3D packages, due to the fact that matrices are used to hold object transforms. In a 4×4 matrix (where the upper-left corner is referred to as m00, and the bottom right is m33; a two-dimensional array of values), m00 – m02 represents the vector along which the object’s X axis lies. M10 – m12 and m20 – m22 are the Y and Z axes respectively. Each vector must sit at a 90 degree angle to the other two — must be orthogonal — just like their respective axes.

This first axis we’ve gotten can be plugged into one of the matrix axis spots to align the first axis on your object. So if you’re aiming the positive Y axis at target, the vector would go into m1. If you’re aiming the negative Y axis, you can either flip the vector you’ve gotten from the earlier subtraction or, if you’re smart, save the extra calculation and just subtract target from constrained instead.

Alright, one axis is constrained. How about the other two?

Next up is the pole. It’s just another direction vector, and the pole vector axis is snapped to it in the same manner that the first axis was set to aim at the target object. Pole vectors can be calculated in any number of ways: you could create a second vector through subtraction again, use a world vector (such as <0,0,1> for the world Z axis), or even just plug in the direction vector from another object’s matrix directly. Put the pole vector into the matrix for the axis that’s pole vector constrained and we’re halfway there.

Now, remember I said that the three axes in the matrix need to be at 90 degree angles to each other? I’m betting that if you draw out the two axes you’ve currently got plugged into your matrix, they’re not aligned. This is expected. If you create an aim-constrained object and target in a 3D scene right now and move the target around a bit, you’ll see that the pole vector axis will aim along the pole vector, but it won’t often snap to it. The pole vector is actually only there to get the third, unconstrained axis. If you do a cross product on the aim vector and the pole vector, the third angle you get will be at a 90 degree angle to them both. We’ll call this the “unconstrained” vector. This means that the first and final axes are finished. Afterwards, another cross product is done between the aim vector and the unconstrained vector to make sure the pole vector is orthogonal to the other two. While this makes the pole vector-constrained axis not always point exactly along the pole vector, you do have all three axes accounted for and the system is relatively stable. Pop the vectors into your matrix and voila — constrained aims at target.

As far as I know any aim constraint based on Euler angles works like this in most packages.

Now on to what’s interesting.

Take Maya, for example. For years I’ve been using the river script by Michael Bazhutki. In fact, I’m willing to bet there are few riggers out there who haven’t used it from time to time. However, until recently I hadn’t ever stopped to look at how his script works.

If you’ve never used rivet, it basically takes two edges or four vertices and lofts a nurbs surface between them, with construction history on. Then it snaps a locator to the center of that surface. The locator rotates perfectly with the surface even after joint and blendshape deformations, so it’s great for sticking buttons or other decorations to character meshes.

It turns out that the script’s main trick is using Maya’s aim constraint node in a neat way: he gets the surface normal from the nurbs surface at the position he wants through a pointOnSurfaceInfo node, uses it as the aim vector, then uses the same pointOnSurfaceInfo node to get the nurbs surface’s tangent vector at the same point and plugs that into the constraint’s aim vector slot. Since the constraint doesn’t care what vectors get plugged into it, and since a nurbs surface at any point can be evaluated to get three orthagonal axes (not unlike the X, Y, and Z axes), this works out great. It also keeps working regardless of how the mesh bends since all the construction history is kept, forcing updates down the line as a character deforms.

This is a trick I’ve used in the past few weeks on our current project at work, and it’s something I plan to expand upon in the coming months. It’s also something that’s gotten me thinking: just what else could I do if I, instead of using the constraint commands to constrain objects together, just created nodes in Maya and used the connections in ways the developers hadn’t envisioned?

But the better question is: how would someone even know to pull apart a set of node connections to a constraint if they didn’t know, roughly, how that constraint works?

I hope this helps someone. As soon as I have time, the next topic I want to write about is something I did with vectors over the weekend: replicating the smear effect from the Pigeon Impossible blog in Cinema 4D.

it's official

Yes, you read it folks, right here. Erica Durance is now officially the best Lois Lane in the history of all women who’ve played Lois, and that’s saying something. I’m not ashamed to say I grew up watching Teri Hatcher attempt to woo Dean Cain, or that I had a crush on Margot Kidder when I was eight. (She’s the original Alive-Again Avenger, if you count her return after ol’ Supes spun time backwards.) Sorry ladies — Erica Durance could spank you like stepchildren. Doesn’t hurt that she’s a Calgarian.

All this week I’ve been burning the candle at both ends trying to get out the latest version of tradigiTOOLS. I hear that Maya 2009 support is going to make an appearance. (I can neither confirm nor deny those rumors.) I will say this: nothing makes me miss gcc like programming for Windows. I hate Visual Studio. I think I’d be okay with it if it stuck to just being an IDE / code editor for writing software — as an editor it excels. The code prediction is nice and it mostly stays out of my way; if I could find an ActionScript 3 language syntax highlighter, I might even consider doing more Flash development on my Vista 64 box. (Although, FlashDevelop is sexy enough on its own.) But man, if this whole “solution” versus “project” thing doesn’t cause issues. I had to rebuild all the project files the old programmer left for me, for a number of reasons, and for whatever reason VC thinks that opening a project file means it should open a solution that lives on a drive that doesn’t exist. Stranger still, there’s no mention of this .sln file inside the .vcproj file. Madness. Give me makefiles or give me death!

I actually tried a bunch of different methods for doing cross-platform compilation, but none of them satisfy me. CMake is woefully lacking in how it handles building Mac Universal Binaries. Regular makefiles don’t really have the syntactical sugar needed to easily process the files in the directory structure that was set up. I suppose I’m going to be looking at Scons next, but in the end on the Mac side of things I broke down and just wrote out a full makefile by hand, then used it as a template to make all five builds of tradigiTOOLS on Mac. (Which is actually more than five, since 8.5 and 2008 have PPC and Intel versions that require special handling.) I think once all this is finished and the new version of tradigiTOOLs is out of beta, I’m going to write a post on how to build Maya plugins from the command line on both Windows and Mac. You’d think it’s one of those things that would have extensive documentation online, and yet, all anyone ever says is “use the IDE.” It’s like Children of the Corn.

Now I have to ask you (yes, you) a very important question: have you played Braid? I’ve been following indie game development more and more lately, mostly because it seems that only solitary coders in their garages are able to produce anything genuinely surprising. I suppose that’s sprinkled with a bit of nostalgia as well. Braid is an excellent example of both game design and workflow. Every puzzle is different, even the ones that at first look the same. There are five worlds (marked Two through Six, with something at the top of some tower I haven’t yet reached — I’m only halfway through world six). There’s a really interesting, minimalist story going on the background. Every world has a different element of time manipulation, starting with just rewinding (a la that Prince of Persia game, or Blinx the Time Cat) and moving to other stuff that’s cool enough for me not to spoil. Bottom line: it’s $15, it starts up quick, and you can play it for only five minutes a day if you really want to. Oh, and it works with the 360 controller for Windows. Just don’t install it when your system locale is set to Japanese.

If I survive tomorrow, a new suit is my reward on Saturday. I should also finish off: Dimos rocks my world. You know, in a manly way.

Wait, that sounded bad.

random updates

The WordPress app on my iPhone seems to be well and truly dead ever since I upgraded it– it just sits in an endless loop, attempting to contact my blog. Apparently this is a known issue. As much as I move around, this has made it harder again for me to keep posting. Luckily the Evernote app was also recently upgraded, and now has the ability to create and save new text notes right in the phone. (This filled my need for a syncable text editor that is free and doesn’t suck, a need that should not have been so hard to fill.) So for now it appears that mobile blogging will have a few steps added to the process. At least it’s still doable. I need something to do on my commute in between episodes of the Stanford iPhone programming podcast.

It’s been two weeks for me at March Entertainment now, and I’m having a great time. It’s nice to actually be able to animate, to apply what I’ve spent the last year and a bit learning at Animation Mentor. Things aren’t quite settled there yet– we had hardware upgrades done on Friday– so next week is when things will likely hop into full gear. We did get to see the latest cut of the movie this week, so everyone has a better idea of how our work fits into the whole.

Outside of work I’ve actually managed to sleep, a bit. I keep having wickedly strange dreams, some of which have guest-starred people I haven’t thought about or talked to in years. The one about the truck-sized turkey still takes the cake, but there’ve been others that came close. I think that as much as I say I don’t get stressed, I’m only able to dream when work gets out of my subconscious’ way. I guess that means I’m feeling pretty relaxed right now.

Oh, I wanted to mention the latest album by The Dears, Missiles. There’s a song on it, Crisis 1&2, that I heard on the CBC Radio 3 podcast. Soon after it finished I rewound and played the song over again about a dozen times. It’s been a while since I was hit that hard by a single piece of music. I highly recommend you head out and find it. The rest of the CD isn’t bad, but that one song is transcendant.

Hmm… One more thing. Anybody know of a good, easy-to-understand tutorial on Direct X shader programming? I have a feeling I’m going to need it soon.

catching up

Lots of things going on, but I didn’t want to talk about some of it until the details were more concrete.

The first big news is that I’ll be starting a new job with March Entertainment this Monday, as a CG Animator. Apparently there’s some difference between “CG Animator” and “Character Animator” that I was unaware of, where CG Animators deal with more parts of the pipeline, so I’m expecting to have as much fun on the projects coming up as I did at Rover. Bonus points: I get to work with Dimos again. Nothing like doing a project with people you already meld with. Anyway I’m animating on the first project, which excites me a lot.

Ever since Ollie finished I’ve basically been on an enforced vacation. I say enforced because I generally don’t do the relaxing thing — traditionally I use downtime to learn or catch up on personal projects. But instead of doing that this time around, I’ve been doing absolutely nothing. For a few days I sat on the couch and caught up on DVR’d TV shows, especially Heroes and Chuck. I bought and played through most of Prince of Persia on PS3, which surprised me — unlike the last three, the fighting is great and doesn’t detract from the game at all. In fact, I’d say the balance is perfect. Story’s not bad either. I’ve also been going through Final Fantasy XII. I never had a chance to finish it after I bought it a year or two ago and it’s been waiting on me all this time. It’s also quite good. It’s the first FF I’ve enjoyed this much since FF7, and that’s saying something. The voice acting is superb, the plot is great, the writing / translation is well above the normal level, and even for a PS2 game the graphics are extremely well done.

Not that I haven’t been studying up on things. I’ve been doing some rig tests in Maya, working out some issues in Blender, and learning waaaay more than anyone should about using cloth sims as rigid body generators in Cinema 4D than anyone should.

I’ve also been framing through the Bolt Blu-Ray, as I have time. In the disc extras they mention how they simplified the paint on the backgrounds to keep the focus of each shot prominent, like the old 2D cartoons used to do. You don’t notice it unless you look for it, but it’s everywhere throughout the movie. Certain things are rendered in high quality. Others are so simplified that when you pause the movie you can barely tell what they are. Paint strokes are visible everywhere. If you’re an animation geek and are interested in seeing this, check out the distant skyscrapers in the city. Also check out the scene where Buttons is looking for something to bash Bolt over the head with, when they’re both in the moving truck after leaving NYC. That particular scene really shows what’s going on. It’s amazing I watched through the movie and never noticed it, not once.

What else… A lot of Papervision playing. I’ve had a look at all the 3D engines for Flash and out of all of them I like the way Papervision renders triangles the best. A lot of the other engines have issues with gaps between triangles and quads, and none seem to have any serious benefits over PV3D. There are a few limitations that I’m still trying to get over, especially with the limit on the number of triangles. It’s a bit like the DS, which can’t draw more than 2000 triangles per frame. (Or faces; I’m not sure which.) Even on my dual-core laptop the number of triangles you can use is pretty limited. Note that I don’t say limiting — a ceiling on the number of triangles you can use just means you have to be creative in your use of them. There’re also other things to speed up how the system works — anything I do in PV3D will used baked lighting, for example. I also plan on being very aggressive on keeping poly counts down. I’ve also been reading up on BSP tree creation (finally understand how portals work).

That is, if I use PV3D.

I’ve had enough time to think about games I want to make, and what I would need to know in order to get them made. I know that everything has to be done in stages, and that to make the game I really want to make, I have to build a better foundation. I need to build something small and simple to see the extent of what something small and simple takes, in order to use it as a lens to look at a larger project. Kind of like how doing a short film is like a microcosm for a feature, or even a TV show.

Every so often when I’m really bored or full of insomnia I’ll hit up The Video Game Name Generator and write down some of the best ones, like Go Go Basketball Gladiator or Nuclear Transvestite Experience. I write down the ones I love for possible future games (or domain names). One in particular would be good for a short game. We’ll see how that goes. Either way, I’ll probably end up using Unity. 2.5 just hit, and I could make web versions of the game just as easily with it as I could do something up in Flash.

Oh, and I rewrote the first chapter in my book. I don’t talk about the book on here hardly at all, but it’s something that’s always going in the background despite everything else I’m doing.

Heh… I guess I didn’t do “nothing” per se, but I do feel a hell of a lot more relaxed. Oh, and did I mention that I did a quick redesign of my main site?

pure unadulterated actionscript geekery

Man oh man. One link clicked led to another, and suddenly I’m obsessed with PaperVision3D.

It all started with this link (which you’ve already seen if you follow me on Twitter): the The Eco Zoo. If you haven’t seen it, please clicky! It’s fantastic.

PaperVision’s been used for a number of neat projects, but the Eco Zoo is a work of art. So I started searching for stuff on the train in the morning (thank you, iPhone) and turned up a bunch of great links:

For those who didn’t know, you can either use the open source Flex SDK or, if you’re a student, you can get a free copy of Flex Builder 3 by sending them proof of enrollment. I did it; I got a serial in about an hour later, although YMMV.

Not that I have time to sit down and actually play with any of this… But it’s fun to learn about. Oh, and I like PaperVision3D because the API is very well thought out and very Flash AS3-like; if you don’t like it there are other options. There’s a nice comparsion on the four major 3D engines for Flash here (warning: it’s in French). Lots of talk about speed of object creation, memory requirements, and so on. It’s always good to be informed of options before starting a project.

stuff and things

I’ve seen a bit of complaining about Dollhouse. I think people are expecting Joss to play by regular Joss rules, while Joss is going in a new direction. I’m totally enjoying the show. It’s not Firefly or Buffy, and I think that’s a good thing. While Joss’ fans have always been rabid, myself included, I think Dollhouse is more accessible to the general public. Also, the second episode opened a lot of plot doors. I’m excited I see where this show goes, and that’s not something I can often say.

I’m back on Twitter with a bit more consistency now, thanks to Tweetdeck. If you haven’t tried it you should– it’s the only client I’ve tried so far that does everything I want. I’m not into paying for Twitterific since most free AIR-based clients have similar or better features, but even free clients had me looking around for something better. Just wish AIR could publish iPhone apps.

This week I move from a “finished” storyboard into layout on my short film at Animation Mentor. This is currently frightening because I don’t have one of my characters modeled and neither ares fully rigged. 🙂 I have a feeling it’s going to be a long weekend, and for me lately that’s saying something.

I did buy that book on doing short films in Blender, so I’ve been reading it as time allows for info specific to Blender and managing data flow. The first shock I had was that “library data” (Blender’s name for references / XRefs) is not editable. You can easily set up library data for animation, but there are different ways of doing so and which way you use depends on the asset. I like the system, though– it means that unlike Maya, nothing I do in my animation scene files can corrupt what I’ve set up in my library assets. Shibby!

Okay. Today my list says: write emails (check!), blog (check!), research that thing Cory Doctorow uses for backups with Git, prototype some face rig ideas, and do some Python scripting research. I need to think through some workflow issues and whether or not scripting solutions will save me time in the long run. (Surprisingly, for the rigs it will not.) Speaking of which, if you’re not a usual follower of Jason Schleifer’s Justin Barrett’s blog (Jason, Justin, you can understand why I was confused), I highly recommend his articles on Lambda functions. Maya UI coders, take note!

Tags:

exciting developments

Been too busy at work to thing about anything other than fur and rendering, buy a lot’s happened in the past few days in 3D and with school.

For starters, the story for my short film has totally changed. ^_^ It’s become a merger between the story of the grandmother and the cockroach, and the original Ramswoole maide story. I’ll post more about it when I have a finished leica reel, which should be some time next week.

I was finally able to get the Wipix no-flip leg working in Blender and that makes me happy. I still need to finish the rig and get Briar weighted, but I’m feeling a lot better about my decision to go with Blender for this short. Every time I have time to sit down and work in it, things just flow along.

As far as 3D news goes, Modo 4’s first set of preview vids are up at Luxology. Normally I watch Modo with only a passing interest, but there’s one video where a few thousand instances of a Rhino are spun around in the preview renderer, with full radiosity / GI going and volumetric lighting. It’s not unlike the speed of FPrime, although the instancing is something the old LW couldn’t do without third-party plugins (and I don’t think FPrime worked with them).

But that brings me to the second big CG thing of the week: Lightwave Core was announced and Newtek is already accepting pre-orders. There was a serious snafu with how the reveal went, but what was shown has me pretty excited– essentially an underlying architecture not unlike that of Houdini / Maya, but with Lightwave workflows and a fully-open C++ / Python SDK. It’s also using the Collads format as its regular scene format, which means it’s already a step ahead of all other packages with regards to interoperability. They said they’ve made a few extensions to the format, so just how compatible the LW Core files will be with other Collada-reading apps remains to be seen, but it’s a step in the right direction (IE: away from the horribly flawed and closed-source FBX).

There were a lot of buzzwords bandied around, and you can see the full tech FAQ on the new Core site. If you preorder (they call it purhasing a HardCore membership; man was that a bad name choice) you get access to the betas, with an apparent release date of the first build sometime in Q1. I’m remaining cautiously optimistic. If they deliver, they’ll be in a good place to pick up disgruntled users of Maya and XSI.

Okay, I’m actually hitting “post” this time; I have about three drafts on my iPhone that are now irrelevant. ^_^

Tags: ,

little victories

We continue to push on at work. I reasoned out a few things about Maya’s internal workings this week (in particular, how references interact with each other), and I feel like, for the first time in all the years since I started using the program, that I might finally be getting used to it. That thought scared me.

On the Ramswoole front, I got an initial approval from my Mentor on using custom rigs and models. I need to have a test done using Briar (the main character) within the next week or two, though, and probably one with the Rock Titan done soon after. I have a working model of Briar already that’s unrigged, but I think I can have all but her face rigged up this week. Also need to change some of the model’s topology and fix her proportions but I think thats only an evening or two’s worth of work. Luckily because of how Blender uses rigs and applies them to meshes, I should be able to swap out my old model for the updated one I plan on creating when I get the new designs from my friend.

I also need to slightly redesign my current Wipix leg, reverse-foot IK setup for a character with animal legs.

The next challenge is the Rock Titan. I’ve been working on the design and I think he’s going to be modular now, with different rocks for different parts of his body. It’ll cut down on skinning time and I’ll also be able to have a bit more fun with his reveal.

cinema 4d scripting, part 2

Three posts in three days! I don’t actually have as much time as It appears I do; the iPhone WordPress app is very useful.

I’m finally at a good place with my rigging library of COFFEE functions that now when I code out a set or rig steps, things are behaving as I expect. I’ve recreated the “Wipix Leg” in code (if you’re not familiar with it, it’s a method for making a stable IK solution without the 90 degree pole vector flip trick in used in Maya), and I’m now at a point where I have to do some rig redesigning. In other words, I’m no longer fighting the code misbehaving– now I’m back to working on conceptual stuff.

I do plan on releasing some of what I’ve learned either for free here or on a DVD at some point down the line, with my function library.

One thing I found out that really put a thorn in my side is that my constraint code was made useless by changes to the Constraint tag in R11. By cleaning up how the tag works, Maxon has rendered the tag completely useless when working from COFFEE. I’m not sure whether Py4D will be able to do what’s needed; I won’t be able to begin porting my rig to Python until the whole thing is finished. However, because you can get selected objects as arrays through Py4D (and not through COFFEE) maybe there will be better constraint code workarounds in my future.

Also nice to discover was that the Wipix Leg works just fine in Blender. Stable leg IK was the one thing for which I didn’t have a setup I liked in Blender, but that problem is now sorted. Still thinking I’ll be using Blender for my short film because of it’s speed of use. I can build that leg from scratch in Blender in twenty minutes; it takes significantly longer in both C4D and Maya.

Tags: , ,