Game Development Reference
In-Depth Information
HandleAbility (ABILITY_STRUCT ability)
{
PurgeEffect(ability.purge);
if (ability.attackDelay > 0)
StartAttackDelayTimer(ability.attackDelay);
if (ability.immunityDuration == TRUE)
// should be checking ability.displayImmunityDuration!
DisplayAbilityDuration(ability.immunityDuration);
}
Timing
Timing defects have to do with the management of shared and real-time resources.
Some processes may require time to start or finish, such as saving game information
to a hard disk. Operations that depend on that data shouldn't be prevented until com-
pletion of the dependent process. A user-friendly way of handling this is to present a
transition such as an animated cut scene or a “splash�? screen with a progress bar that
shows the player that the information is being saved. Once the save operation is com-
plete, the game resumes.
Other timing-sensitive game operations include preloading audio and graphics so
that they are immediately available when the game needs them. Many of these func-
tions are now handled in the gaming hardware, but the software still may need to wait
for some kind of notification, such as a flag that gets set, an event that gets sent to an
event handler, or a routine that gets called once the data is ready for use.
Note
As an example of an audio event notification scheme, Microsoft DirectMusic provides an
AddNotificationType routine, which programmers can set up to notify their game when the music
has started, stopped, been removed from the queue, looped, or ended. SetNotificationHandle is
used to assign an event handle (created by the CreateEvent function), which is used when the
game calls WaitForSingleObject with the notification handle, and then calls GetNotificationPMsg
to retrieve the notification event.
User inputs can also require special timing considerations. Double-clicks or repeated
presses of a button may cause special actions in the game. There could be mechanisms
in the game platform operating system to handle this or the game team may put its
own into the code.
In MMORPG and multiplayer mobile games, information is flying around between
players and the game server(s). This information has to be reconciled and handled in the
proper order or the game behavior will be incorrect. Sometimes the game software tries
 
Search WWH ::




Custom Search