23 March 2010

Collapsible people

Skeletons. BoneNodes. Joint constraints. Rewriting my previous inverse kinematics engine. But really, instead of doing all the hard work I've decided to use a physics engine. I was going to integrate my own IK and animation engine with some physics library after the fact but after some thought I've realised that may be the long way round. If I'm integrating at some point, it may as well be as soon as possible.

Ah, the folly of not thinking far enough ahead. It's ok, though, this should speed me up considerably. All I have to do is make sure that I can layer my own stuff decently on top of the physics engine (for example the skinning system which places a visual of the character on top of a skeleton) and also tie it into the animation system.

Using the animation system will mean I can teach it the basics of how to move and then code in the rest. So walking will mean moving a character's arms in time with it's feet. But if it's holding a gun, it will only move it's arms slightly and keep the gun pointing somewhere. The ideas behind how I want to animate this (or at least procedurally animate this) are very similar to the way the Euphoria engine works. Instead of just having a ragdoll getting tossed around on screen when a character "dies" (generally this happens even if they are just falling), I want the ragdoll to attempt to move. People don't just collapse when they get knocked, they stumble, try to right themselves, or trip and push their arms out to brace for impact or shorten the fall. In short, ragdoll stuff is amateur, old school. Nothing really happens like that in life unless the character is completely dead (as opposed to just slightly dead) when the ragdolling is applied.

On another note, what's with these "idle animations" that people keep making for various games? Pop open whatever game you have lying around and fire it up. If you leave your character standing still, they will general experience some heavy breathing and massive wavy warm effect. Even though they can run nonstop for an infinite distance, they will stand there breathing excessively heavily as if they're about to have a heart attack. But they don't - I checked.

Nobody does that sort of thing when standing still. Have a look at a queue when you're next at the shops, or in a bank or being afflicted by some form of horrifying beaurocracy. People either don't move much at all (besides occasionally looking around), or they move into a new stance and then relax in that without moving much again. I certainly haven't seen people moving their shoulders up and down like crazy. Admittedly this has gotten a bit better over time, but I still see games animated like this occasionally. It just feels so awkward.

20 March 2010

Voicing concerns

Well, I've been thinking about the talky talky system (or, conversation/dialogue system for the grown-ups out there). Huge flowing dialogue trees are fantastic to play through, but insanely long to write. Still, it's something I want to have in the game. Which means I might have to curtail the length of some conversations or at least the number of times you can talk to somebody if it means keeping the number of choices and quality of writing up to scratch (actually, it needs to be much better than scratch).

To really make this sort of thing shine, and in fact the game in general, I've been thinking a lot along the lines of how Warren Spector originally planned to do the first Deus Ex (one of my fave games). His plan was for the whole game to only be played within the confines of a single building and then to make just about anything and everything you wanted to possibly do in that building possible.

It's a goal I've always admired, and while they instead went on to make a game that traveled the world, it still had the feel of so much to do. At the very least, it lived up to the point of that goal. I'm hoping to do something in a similar vein (why is that a common turn of phrase? How often are veins shared that it became common to talk about them in that manner?). This means that I can keep down the number of art assets I'll have to create and turn that towards other components, hopefully speeding up the game creation, or at the very least giving me more time to really refine the game play.

Refining the game play is pretty important in fact. It's very easy for a game that handicaps players to become tiresome or annoying. So I'll have to be very careful about the way I implement the game's mechanics. While I want to showcase the more human aspect of characters in games, I still want this to be fun to play. If something detracts from that, it needs to be fixed and in the worst case, cut from the game.

11 March 2010

Polite banter

Dialogue systems in games (most particularly RPGs) have a long way to go before they could be called immersive or sensible. Often, you just aren't given the option of saying what you really want to say. A few (very few) games have broken through this in different sorts of ways. The most memorable for me, perhaps because it was the most spectacular leap from the standard conversation system, is Facade.

This was a game wherein you typed your responses. Not in the sense of Zork or those old Interactive Fiction games, because it is so much more than that. You could say whatever you wanted. At any time you wanted. For the most part, the game's protagonists react very realistically. In a way it is similar to the whole adventure and role playing game dialogue systems (like Mass Effect, Fallout, Monkey Island). In those games you are given a list of choices or responses. Some games even further this by allowing you to do actions within those responses (like intimidate, draw weapon, run, etc.). However it is normally a very short list of things to say. Facade is like this, except the responses are all hidden away from you. And there are hundreds of possible things to say and responses to those things. It's astounding. It feels like however you react to the game, it is understood by the characters. It makes them feel quite real.

I couldn't begin to do something close to Facade's interaction. It took them around 5 years to create a very short game (to play, that is - although there is a ton of replay value).

Instead, I've decided to do something that I feel has been missing from all these dialogue systems. Tone. Emotion. It's generally implied by what is written in the text, but text is sometimes difficult to read into. A response could be laden with sarcasm, or said lightly, or menacingly. It's difficult to tell just from the text itself. It often takes the user clicking on it to find out how the response is actually said. In Mass Effect, they have paragon(roughly equivalent to good)/neutral/renegade(negative or bad) types of responses.

Here's the sort of conversations you could currently have in Fallout 3 (courtesy of http://www.flickr.com/photos/beaty/3023926779/)

The Witcher has similar limitations. In fact, the Witcher, which prides itself on the greyness of it's moral choices often has binary responses to something that could easily have a myriad of ways to respond to. Even worse, in some games, certain responses have the exact same meaning or reaction from NPCs (non player characters, i.e. anyone who isn't you). What a cheap cop-out. If a choice is the same as another, just remove it. Don't pretend we have a choice. Unfortunately the world doesn't quite work in just those sorts of responses. There's a huge swirling mass of grey, a spectrum of grey choice.
Just look at all that grey. So much choice. Do you see? So much grey is available, I even had to limit my screenshot of morality to grey codes #A3A3A3 through #383838.

 I want to be able to have a veritable list of choices. That's for starters. I'm going to try think of as many useful responses as possible to a given situation, question, sentence, whatever. That's not really anything new, however. What I want to do is explicitly include tone within each response. A phrase can easily go multiple ways. So the way it would be to have a basic version of responses listed. You pick one and then apply a tone to it. 

For example:
Phrase: Where is the control room?
Applied tone: inquisitive Do you know where the control room is?
Applied tone: angry Where the hell is the control room?
Applied tone: Concise or stern Control room?
Applied tone: irritated Look, just tell me where the control room is.

Phrase: I have a gun.
Applied tone: nervous I...um... I have a gun, yeah, um...ha
Applied tone: serious I have a gun, I know what I'm doing.
Applied tone: threatening Watch yourself or I might have to shoot you.

I will probably have to limit the number of tones that can be applied to one. But it might be interesting to have an amount of tone that can be applied. It would be interesting to see the difference between a slight amount of anger (similar to the irritated response above) vs a lot of anger (like the angry response). This should be a fluid or fuzzy amount. Too much anger and you freak somebody out. Depending on their personality, they could cower away from you, shout back, lash out at you, run away, whatever.

Of course, this isn't really all that revolutionary. In fact it's just a nifty way of hiding a whole lot of choices away. Instead of reading through a list of 40 possible dialogue options, you get 5. Then you just apply tone to those. Using this approach makes it easier to quickly pick the option you're looking for. The tones you can apply are pre-set per response. I'll be trying to include as many tones that make sense.

As a single written sentence can have so many meanings, this gives a clear indication to the player what the response actually means. No more picking an option meant to berate an NPC and having them smile blithely as though it were praise. You can specifically state if what you are saying is sarcastic or serious.

It would be interesting to have volume (whisper, shout, normal) attached to this, but would become unwieldy and silly and too often ignored. I think volume can be implied by certain tones. So getting really angry at somebody could mean shouting, which would attract attention to you from further away. I won't bother with this, though - it's superfluous for this game.

The dialogue tree could look something like this. The black blocks with white arrows in just return you to the previous (top) list.

Completely off track rambling to follow:

A long while back I was discussing how to have a really procedural dialogue system. The start of that was based on symbols. Symbols meant different things to different creatures. Food could mean "tree" or "rabbit, voles, and insects". The game was about interacting with tribes of creatures in any way you felt. I'm sad we haven't continued with that game because there was so much to it that would be awesomely fun to play. The story was equally procedural, based in a sense, on the insanity of the main character rationalising what you did.

You could, for example walk through a desert for ages, dying of thirst, while the narration said things like: "But he knew what he was looking for was just over the next rise", "His tiredness is nothing to the import of the journey" and so on. If you just ran up and killed an innocent villager, the game would say something like, "He saw the gleam in the villager's eyes. Acting swiftly to deter the murderous wretch, he stabbed out with his rapier". Everything in the game's view was correct. The path you chose was the exact path you needed to choose. It would even possibly go so far as to show why you were right. Perhaps the villager would have hidden weapons on them, caked in blood and around the corner you would see bodies of all their previous victims.

You could unite tribes or convince them to wage wars on each other depending on how much you'd manipulate them into trusting you. You could, for example, make them trust you by helping them defeat an enemy that you'd encouraged to attack them. And all of it would be rationalised.

The magic system worked much like visual programming language, and in fact the first prototype of this my friend did is part of what inspired my own customized visual language for the level editor.

I'd still be keen to do something like this one day.

09 March 2010

Icky animation

It's been a while since I updated. I've been rebuilding the inverse kinematics system for animation I mentioned a while back. Although it's a system hog, in the end it's way too useful to abandon. Normal animation (frame by frame, pre-made) would be very time consuming to do for every entity in the game.

So, like those big 3D games, I'm building a skeletal system that's mostly shared across all entities. This means I only animate that skeleton once and that animation can be shared across a number of characters (as long as they have 2 legs, arms, and a head). Using this system, I'd still have to hand animate that skeleton but it'd be much easier with inverse kinematics - moving the foot would move the thigh and shin accordingly whereas without IK, I would have manually reposition and re-angle the thigh and shin each frame. So i only really need to focus on moving the foot about. Of course, there do need to be a few constraints here. A leg shouldn't bend backwards for example, so I'm making angle limits on the bones of the skeleton.

It's all very boring to explain so I'll stop there, and post a ragdoll/animation demo later on. If my horrifically vague and inaccurate explanation of what IK fails, have a look at this video. The only part of that robot's arm that is moved is the bit attached to the wheel. The rest of the arm works out how to position itself from there.

UPDATE: Instead of manually doing the animation, I'll be taking a procedural approach. So animation will be worked out on the fly. As a rough analogy, I won't show it how to walk, instead I will explain the concept of walking to the computer and it'll work out how to place its feet and move.