O'Reilly logo

ActionScript 3.0 Design Patterns by Chandima Cumaranatunge, William Sanders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Symmetric Proxy Pattern

The Symmetric Proxy pattern is as much a discovery as an invention. Heliotis and Schreiner found that they could establish instances of two player objects arranged as peers over the Internet. Each side has both a proxy and a "real" player. Likewise, the referees on each side have the same information. Whatever move a player makes is treated the same by each of the referees. The referee object has no idea where a move comes from—it's clueless, as Heliotis and Schreiner note. All that the referee has to do is to call the players when the game is over and let them know the outcome. The referees are perfectly synchronized because they're reacting to the same state information, without caring whether the information is local or from a proxy; as a result, when the game-over conditions are met, both inform the players in exactly the same way, resetting all variables, and prepare for the next game.

Figure 13-3 shows the object diagram of the Symmetric Proxy Pattern:

Symmetric Proxy object diagram

Figure 13-3. Symmetric Proxy object diagram

Keeping in mind that Figure 13-3 is an object diagram and not a class diagram, we can clearly see that the Symmetric Proxy pattern has each player's proxy in the opposition's camp, so to speak. The referees are treating each side of the Symmetric Proxy as a complete game. The referee simply takes the moves, evaluates them as being from one side or the other, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required