Tuesday, May 22, 2007

Splinter Cell's dynamic environments

Welcome to part four in our massive Splinter Cell: Conviction week, where the Ubisoft Montreal developers talk us through a different section of the game each day. Just in case you missed them, you can go back to the beginning and read part one here.

In part four we speak to associate producer Daniel Roy about how Sam Fisher will interact with the environment. And it sounds impressive. So we all know you're Sam Fisher, a fugitive hunted by the cops. At one point in the game you'll have to access a data server hidden in the middle of a park in Washington. "Walking towards your objective, you quickly join a small group of people moving alongside a war memorial, in order to avoid the attention of a cop strolling nearby," Roy explains. "Reaching an open area, you decide you need a quick distraction to progress further. You walk up to a protestor lecturing a small audience, and quickly snatch her laptop and throw it on the ground. The crowd is shocked by this, and call for the cops. The cop begins to walk towards the onlookers, but you avoid his gaze and briskly walk along before he can figure out who's responsible for the commotion."

This is the kind of interaction with the crowd Ubisoft has been trumpeting in the awesome-looking Assassin's Creed. "Having reached the building, you stand in front of a security guard. The guard notices you, and you know he's starting to put two and two together," continues Roy. "Very soon now he will identify you as that fugitive that's been all over the news. You turn around and walk towards the back of the building. He follows you to question you. As soon as you're out of sight of the crowd, you take him by surprise and knock him unconscious by throwing him violently into a dumpster. You quickly make your way inside the building and hack the data server, but now the cops have congregated outside."

There's a hot dog vendor is within sight and Fisher takes out a silenced pistol and fires, creating chaos and mayhem in the park. Joining the rampaging crowd, Sam runs out of the park, unnoticed by the cops who see you as just another panicked bystander fleeing for his life. Designers have been striving for this kind of dynamic environment for years, but what else is the fifth Splinter Cell doing that we haven't seen before?

"First of all, everything in Conviction - and I mean everything - is dynamic and bound to be pushed over, thrown or broken. This isn't just a dozen objects in the environment; it's everything, from the staplers on a desk, to the desks themselves. The dynamic environment is Sam's primary weapon. He can throw chairs in his enemy's face, throw them into a desk, block a doorway with a bookcase, flip a table to create cover. We want players to look at all the tidy environment of, say, a newspaper office, and think, 'I can use this desk as cover in a tight situation, and then this printer as a deadly weapon.'"

The AI itself will also use the dynamic environment to full advantage Roy tells us. "We not only improved the AI to account for the dynamic environment, we actually rebuilt their AI around it. Enter a firefight with them, and you'll see them improvise cover by flipping over tables, for instance. It's quite a rush to think you've got an enemy AI pinned down, only to see him rush behind a desk and flip it over, shooting you back from the safety of an improvised cover."

And how will all this super cool new tech change the experience? "In previous Splinter Cells, Sam was equipped by Third Echelon, and could rely on his gear in all situations," said Roy. "Now that he's a fugitive, he only has his immediate environment as a weapon. And Sam being Sam, you can expect him to be deadly with any weapon you put in his hands. He can use it to distract and confuse his enemies, for instance, by exploding a propane tank in order to create confusion with the cops; or he can use the environment as a weapon in hand-to-hand combat.

"Sam can throw his enemies on desks, tables, containers, etc., or slam their heads against nearby walls, or throw computer monitors, printers and chairs at them, or momentarily confound them by sweeping the contents of a desk at their face. Basically, we want the player to enter a rich environment filled with all sorts of elements, and feel they have an entire arsenal at their disposal."

Our exclusive screens of the game show various sequences that Roy was only to happy to explain to us. "Having a character pick up a chair in traditional videogames isn't too hard. But if you want your environment to be dynamic, you need that chair to be able to fall randomly - any way whatsoever. Suddenly, you can't just play a predetermined animation anymore. You need actual artificial intelligence in order for the character to determine where he's gonna put his hands to pick up the chair, and then do it.

"That's why every game you've seen so far using physics - even Half-Life 2 - shied away from showing you the character actually picking up the object with his hands. We used the chair as it is a very complicated object, with lots of physical constraints (in picking it, but also by moving it to be able to hold it properly). Once we managed to deal with the chair, almost every other object seemed easy to deal with."

The crack team of Montreal coders has blended procedural (or code-driven) animation with motion capture in order to create an animation system that will be able to figure out how to pick up a chair in any position. "Whenever you're going to pick up that chair, Sam is going to approach the object in a slightly different manner, and place his hands just at the right spots to pick up the chair in a believable way."

But what about objects with round surfaces? "Through figuring out how to pick up a chair, we created a general system that would allow picking up any object, whether it's a TV, a box, a metal plate, etc. We assign points to the object that represent likely places where Sam will want to put his hands - we call these 'handles'. Then, when the player decides to pick up this object, the animation system figures out which handles are most optimal for picking up that object, and through a process called inverse kinematics (IK), we create code-driven animations that will generate realistic movements for Sam's hands as he moves them to the handles.

"For a round table, the principle is the same. We put handles on the side of the table, and when Sam approaches the table to pick it up, we play a realistic animation for Sam to bend forward and pick up the table, while at the same time the code drives animations with the goal of placing Sam's hands in the right places. Use realistic motion capture animation elements in the blend, and you've got a system where an object can be picked up at any time, regardless of how it fell."

All in Montreal has combined rag doll physics with Sam's animations to create a more realistic punch and throw reaction. "Rag-doll physics is great when you want to have a character, shall we say, violently interact with the physics in the environment. Imagine that Sam picks up an enemy and wants to throw him in the environment; the grab, and the throw itself, will be driven by mo-cap or key-frame animations, for maximum drama and impact. Then, as soon as the enemy is in the air, we use rag-doll to control how he will interact with the environment.

"This leads to very spectacular moments when, for instance, Sam throws an armed guard into a stuffed bookcase. The throw itself is very cinematic, using non-rag-doll animation physics; but the impact is not scripted in any way, and the way the guard will hit his head, or the way the bookcase and all its contents will fall on him, is completely driven by physics. As you can imagine, there's a lot of fun to be had throwing people into things in Conviction," Roy concludes (Extracted from ComputerAndVideoGames.com).

No comments: