Graphics Reference
In-Depth Information
3 Player Structure
A player can take just about any form—humans, aliens, animals, vehicles; designing a struc-
ture that can deal with all of them is a challenge in itself. The way that players store data, the
data they need to store, the various types of movement codes and their control systems make
for hundreds of different possible combinations. Dealing with a player structure in a modular
way requires a little careful consideration not just for how to deal with all these different sce-
narios but also for how our components will need to communicate with each other and com-
municate with the rest of the game—for example, player objects often need to communicate
with the game controller, the game controller often needs to communicate with players (to
relay game states, etc.), and players may also need to interact with the environment and other
objects within it.
he overall player structure for this topic may be broken down into several main
components, as shown in Figure 3.1.
1. Game-specific player controller . This is a script to deal with game-specific player
actions. For example, some games may require a vehicle that requires weapons,
whereas some games may not. The game-specific control script will “add on”
the specific extra functionality and tie together the main components to work
together or communicate with other game-specific elements.
2. Movement controller . The movement controller takes the job of moving the player
around and defines the type of player we are using. For example, a vehicle-based
player would have a vehicle-based movement control script that would drive the
Search WWH ::




Custom Search