Game Development Reference
In-Depth Information
to the controller and have the animation system queue off the distance you actually
moved. You ' ll still get some feet sliding, but you ' ll also have some freedom to move
exactly how you want. The choice is yours.
I could probably write a whole chapter just on character movement. It
'
s a big subject,
and it
'
s not one to be tackled lightly. One bit of advice, if you are just starting out:
Don
t worry about hovering feet above
stairs and ramps, at least at first. Some games solve this problem, but they also tend
to have huge budgets. The important bit is to make your game fun first. You can
spend any amount of money on cool ankle blending on your main character, but
no one will give a damn if your game isn
'
t worry about sliding feet, and certainly don
'
'
t fun to start with.
The Movement Gym
As part of this tuning process, you should create a special map level in your game that looks like an
obstacle course. Create every kind of environment and object your character can navigate: stairs,
ladders, slopes, ledges, doorways, and windows of every width, a forest of trees or columns,
crawlspaces, and anything else you can think of. Every time you make a change to any code or data,
including the shape of
the character hull,
run through the obstacle course and make sure that
everything still works. You
ll be surprised how easy it is to tweak something and completely break your
entire character movement system.
'
Special Objects: Stairs, Doorways, and Trees
Some objects need special collision hulls because they interact with characters or
objects in ways that don ' t necessarily have a direct correlation to their visible shape.
Good examples of these objects are stairs, doorways, and trees.
Stairs are tough because you really want two completely different collision shapes,
depending on the dynamic object interacting with them. Most objects like crates
and barrels would use a pretty similar, although simplified, version of the visible
geometry. When they fall or roll down stairs, they
'
ll react to the edges and corners
'
and bounce around exactly as you
d expect. Characters, on the other hand, are usu-
ally a different story.
When you watch a character ascend or descend a staircase, the head doesn
t follow a
sharp square wave. Instead, it bobs smoothly with each step, but not too much. This
bobbing is even less when the character is moving quickly, such as running. If you
put a naive solution in your character/physics model, your character would probably
follow the exact shape of the stairway, causing a very unnatural and jerky movement.
The easiest solution to this problem is to make two collision hulls for stairs
'
one for
characters and one for every other kind of object. The collision hull for characters
 
 
Search WWH ::




Custom Search