Game Development Reference
In-Depth Information
pseudocode::AbortDrag(dragStartingPoint);
}
}
This bit of code would exist in your handler for a mouse button up event. The call to
ReleaseCapture() makes sure that mouse events get sent to all their normal
places again. pseudocode::FinishDrag() is a function you
d write yourself. It
should detect if the destination of the drag was legal and perform the right game
state manipulations to make it so. If the drag is illegal, the object has to snap back
to its previous location as if the drag never occurred. This function can be trickier to
write than you
'
t necessarily use game state information to send
the object back to where it came from.
'
d think, since you can
'
Game Editors Are All Powerful
In UltimaVII and UltimaVIII,we created a complicated system to keep track of
object movement, specifically whether or not an object could legally move from
one place to another. It was possible for a game designer to use the all-
powerful game editor to force objects into any location, whether it was legal
or not. If these objects were dragged to another illegal location by the player,
the object had to be forced back into place. Otherwise, the object would exist
in limbo. What we learned was that the drag code could access the game state
at a low enough level to run the abort code.
You can have exactly the same problem with modern games that use modern
physics systems. These days when you place an actor like a candle inside a
table or something, the physics system can
'
t solve for a legal place for the
candle to exist. It
s best course of action is to remove the candle completely from the collision detector,
causing it to fall through the table and plummet downward, perhaps forever. It may just fall to the floor,
but either way the candle won
'
t stay on the table when the physics simulator begins running on the
candle, which usually happens when it is moved. This can make dragging objects with real physics
somewhat painful. The best course of action is to require the world editor to place dynamic objects in
proper positions where they can be moved by the player later. This means the physics system is actually
solving for legal support under the candle when it is placed.
'
Working with a Game Controller
Working on Ion Storm
s Thief: Deadly Shadows game was my first experience with
console development and my first experience with writing code for a gamepad. It
was much more of an eye-opener than I thought it would be. Until I actually had
one of these things in my hot little hands and the code saturating my overcaffeinated
brain, I thought these devices were little more than a collection of buttons and joy-
sticks. Boy, was I wrong!
'
 
 
Search WWH ::




Custom Search