Transport

From Scalable Game Design wiki
Jump to: navigation, search

CTPtransport.gif

Description:The transport pattern occurs when one agent carries another agent.

Real World Examples:

"A boat transports people as it sails across the waters."

"A conveyor belt transports components in a factory. Suppose one agent needs to carry another agent as it moves."

PseudoCode:

IF An agent is on top of me, THEN I Transport that agent

AgentSheets Code: In AgentSheets the "transport" action can be used in place of the "move" action to make an agent tranport anything agent that happens to be on top of it

TransportRules.png

Transport is an essential pattern. Before moving right, say, the transporting agent should send a “move right” message to the transported agent on top of it (if there is one). The transported agent moves right when it receives that message. An example would be the logs in Frogger. Say, there is a log floating on top of water. On top of the log is a frog. The log moves to the right but should transport anything on top of it. The log, before it moves to the right checks if there is a frog on top of it. If so, the log moves to right and then makes the frog to the right as well. The log needs to move before the frog to preserve the order of the stack. If the frog moves before the log it would be covered by the log.


Log transports Frog UML diagram

TransportUMLpattern.jpg


Games/Simulations that use this pattern