This blog has moved. Visit Groundswell Games for the latest. Remember to update your bookmarks and RSS feeds.
Showing posts with label animation. Show all posts
Showing posts with label animation. Show all posts

Tuesday, July 29, 2008

Unity 2.1!

Ok, this news is pretty stale at this point, but it's worth posting anyway. Unity Technologies released Unity 2.1 on Friday. This update was a long time coming (about nine months I think), but it's a doosy. The message around this update is that it finally makes Unity MMO-enabled. How? Well...

  • Endless streaming terrains. Yes, that's right, Unity now supports as large a world as you want to create. You can build multiple terrain tiles and stream them in to create truly massive worlds. Anyone following TGNM the last month or so knows I've been working toward a home-grown version of the same thing. I had a feeling the Unity folks would throw something like this, but I couldn't be happier. Ok, I could be happier: I haven't figured out how to make these nifty new features work yet. The documentation is noticeably lacking so far.
  • More realistic terrain lighting. Terrains in Unity 2.0 would only work with directional lights and lightmaps, which severely limited things. You couldn't, for example, light a road with torches in any realistic way. Terrains also now work with projectors, which means better shadow effects (for poor indie owners like me--terrains support real-time shadows for pro licenses) and the possibility for projected spell effects or selectors.
  • Procedural control over characters and animation. Unity always had a really flexible animation scripting system, but now it's possible to create even more advanced effects like on-the-fly creation of skinned meshes. This stuff is pretty advanced, but it seems to open the door for really flexible MMO-style character creation. You can also sync scripted events with animations, making it easy to spawn things like footprints, footfall sounds, impact effects, etc.
  • Streaming assets. This feature, alas, is reserved for pro licenses, but you can now pack up any group of assets in Unity into a bundle and stream it in as the player approaches.
All in all it's a pretty amazing release. There are still plenty of things huge things that would be required to build an MMO with Unity, like all the back-end databases and server configurations, but this is a major step.

Sure, I suppose I could feel annoyed that I spent so much time doing things the hard way with terrain, but who am I kidding? I always do things the hard way.

Tuesday, September 4, 2007

Fun with blended animation

In this post I'm going to dig into a particular topic a little bit: animation. First, a little setup.

When I switched to Unity from Torque, I also decided to change the nature of my battle system. I had been working toward a time-based battle system in Torque, which meant that each character or enemy in the battle had a timer that would reset after each move and then refill over a period of time. When the timer filled, that character/enemy would enter its desired move into a queue that would execute one move at a time.

One big advantage of this system is that it's easier to input moves for multiple characters (since only one character/enemy is doing anything at any given time). Unfortunately, it's also a bit dated (think Final Fantasy VII) and works best with a separate battle screen.

So, in Unity I'm working on a more "real-time" system like World of Warcraft or Final Fantasy XII where enemies are visible all the time, have an aggro range, etc. This type of system is much more realistic and helps maintain the illusion of the game world, which is something I want to do as much as possible.

So what about animations?
Time-based systems make animations a little easier to handle, since each animation occurs in sequence and involves the entire skeleton. A basic move might go something like this.

  1. "Idle" animation playing before the move.
  2. Play a "run" animation and move toward the target.
  3. Once the character reaches the target, transition to an action animation (like swinging a sword).
  4. Play a "run back" animation and move back to the starting location.
  5. Transition back to the "idle" animation.
A real-time battle system isn't quite so neat. At any time, your characters can be running in any direction while attacking, being attacked, casting a spell, etc. So your animation setup needs to be pretty flexible. This kind of thing is usually handled through the concept of animation blending. Here's Unity's discussion of the subject. To use blended animations, it's often a good idea to create separate upper and lower body animations that are combined at runtime. So your animation setup might look something like this:
  • Full body
    • Standing
    • Walking
    • Running
    • Strafing
    • Walking/running backwards
  • Upper body only
    • Swinging weapon
    • Spell casting
    • Blocking an attack
    • Taking damage
With a blended animation system, you can give the upper body animations control over the affected joints in the skeleton when necessary, without interrupting whatever is happening in the lower body. This way you swing a weapon while standing, running, or whatever. Also, with a layering system like Unity's you can blend multiple upper body animations at once. This means you can run, swing a weapon, and take damage all at the same time.

Learning to animate
Animation is a very complex subject and an art in itself. I don't claim to be very good at it, but there are a lot of good basic tutorials out there. I'm particularly fond of this one, which explains the process of animating a run cycle.