Sunday, May 17, 2009

Designing for 60Hz

So, rendering at 60Hz. For a fighting game. Now, if you do this stuff for a living, this may or may not sound easy or difficult to do (how's that for non-committal?). The truth is, certainly with my bias in mind, this stuff is difficult. I mean, as they say, if it was easy everyone would be doing it.

Okay, the rule with rendering is... know your scenario. If your game designers, artists and creative leads actually know what they're doing, a big part of their job is to define the box the game will need to fit into. If they can't define limitations and stick to them they are not doing their jobs. Simple. One nice thing of having a requirement by our genre to run at 60Hz means that, unlike I guess quite a few of my equivalents on other teams, I can actually push back quite a bit and call people out on their demands (ie, bullshit).

For example, density - how much crap do I need to deal with? Where can the camera go? How close does it get to stuff? Do I need to worry about LOD? How much in the scene is dynamic, or expected to be? Is this dynamic behaviour predictable? How much translucency is in the scene? What kind of effects are needed? And so on...

Anyhoo, like I said, the big deal here is to know the limits of what you need to deal with, because there is only so much time in which to do everything you need (and/or want) to do. This gives you basic requirements you need to work within so you can figure out what features you can support. And sadly, you quickly find out that at 60Hz... it ain't a whole lot.

For example, all sorts of things one would automatically take for granted need to be called into question. Do I do a Z-prepass? Is it worth the CPU overhead, the fillrate burn, the geometry processing... can I fake it out? Can I hand-sort the frame to avoid the Z-prepass work?

How do I light the scene? How complex does lighting need to be? Do I need to light everything? Just the characters? Are my characters normal mapped? If not, can I get away with vert lighting? Or maybe just texture projection? Can I get away with mixing and matching lighting quality? Can I defer lighting? Can I afford all the resolving that goes along with it to build the G-buffer? At the very least it's an extra pass that has a pretty high ROP cost...

And, oh boy, shadows. Shadows are a disaster. Pretty much there's no great solution that isn't stupidly expensive. Either your shadowmaps are too small, badly projected, undersampled, not cleanly enough PCF'd. Whatever. And that's for just basic passable shadows. Texture bandwidth disasters, is what shadows are. And god forbid you need to render multiple shadows. But more on that another time.

Consider something like SSAO. Expensive, hard to do really well so its artifacts aren't distracting. Let's say you do the work at a lower resolution, compromise quality a little, and you're able to get the cost down to... say, 3 ms. In a 30Hz game that's a significant amount of time, but hardly a deal breaker. In a 60Hz game... well, that's about a fifth of the frame (rounding up, obviously). That's a pretty big deal for something that's often pretty subtle, though obviously impactful. So unfortunately while it's really the subtle stuff that makes the scene look more realistic, it's generally the subtle stuff that ends up getting tossed out the window in favor of flashier and more obvious stuff.

Then there's one last really stupid problem - platform bias. For example, move too much of the rendering work from the RSX to SPU on PS3 and you could actually cause more problems than you solve. If you live in a world where all your artists test on 360 and pretty much "the chumps" on the port team are the only people who ever see PS3 running you can probably happily go nuts pushing work to SPU. If you live on a team that tries to be more disapplined about platform support (some of our artists currently only test on PS3, some only on 360, leads test on both) that can somewhat backfire. So you basically have to design solutions to problems that take both platforms' weaknesses into account from the start, rather than treat it as a porting problem afterwards. Certainly less fun, but much safer than the alternative. For example, an SPU-only solution to SSAO to get that 3 ms back probably doesn't really make sense unless the 360 is so far ahead performance-wise that you've got time to burn.

That's enough for tonight. I really wish I could talk about the specific stuff I'm playing with now, as it's pretty darn cool... but hey, I'll bounce more vagaries and continue to hint at things. :) Some more details another time.

Saturday, May 9, 2009

Oooh, a little more please.

Ah well. So as is typical, I don't think I'm allowed to talk about specifics of what I'm doing just yet, but needless to say, I am working on the next MK game. Can't talk about details, as I don't want to spoil whatever eventual PR we're doing.

That said, I can talk in loose vagaries. So, for example, I can say that tech for the game is progressing nicely. The really good thing about working on this game so far is that we're currently at that nice cruising point where you don't have to worry about getting basics working. I mean, there always is the option of scrapping and reworking existing systems... but it's not the same thing as having to build them up that first time. We have the benefit of having shipped a game forcing us to have built a whole series of tech to get that product done.

So... technically we could probably rest on our laurels. I mean, we shipped a fighting game already on this generation of hardware. It's a reasonable guess to assume the next MK is some kind of fighting game, so we probably have enough tech that if all we wanted to do was a content update, we probably could. But, really, where's the fun in that?

Well go figure, we're improving various systems. Upgrading some, rewriting others, adding some new ones where we didn't worry about certain kinds of features previously. After all, game development is really an arms race and we have to assume that in two years people will simply expect more. Me, I'm overhauling various parts of the rendering backend. Truth is, a lot of the talk I gave at GDC will no longer represent how things are done in our fighting engine by the time I'm done. But hey, that's the price of progress.

As time goes on, I hope/plan to post some insights and ideas related to what I do, which is primarily rendering work. So, stay tuned, as there's certainly more to come.

And so we begin?

Well, here we go. Time to maybe start a blog, post the occasional idea, maybe even get a little bit of feedback. So... first post!

So, this post will deal with something I should have dealt with 2 months ago - posting my GDC presentation from this March to the web somewhere that people can find it. So, here goes:

Hitting 60Hz in Unreal Engine

So, there we go. Two things done at once. First, established a blog - second, figured out how to embed a Powerpoint presentation inside said blog! Only problem is, I have absolutely no idea how to go about getting the linked video to work. Oh well, the pair of screenshots will have to do.

This should be a pretty close to final version of the presentation. It should match the presentation I gave other than maybe a couple minor corrections in wording, and the credit for Nate turning into a "thanks" in the final version.

I did get some comments afterwards about how it would have been nice to show more video/images showing a lot of this stuff in action. I'll see if I can scrounge stuff up at some point (although, the game's been on sale since early November 2008, so you can always just buy a copy. Heh).