CTR Pia  4.11.3
Game Communication Engine
clone/CloneProtocol Sample Demo

Introduction

This sample demonstrates the use of the CloneProtocol class for PiaClone.

Scope of the Demo

This sample demonstrates the following.

Process Overview and Controls

Mode Selection Screen

Select the communication mode from this screen. Select to perform matchmaking, and then go to the Main screen.

Input

Operation

A Button Run local communication (UDS library) as a host. After you successfully create a session, you transition to the Synchronized Data Selection screen.
B Button

Run local communication (UDS) as a client. Search the UDS network and join what you find, and then transition to the Main screen. If you press the START Button during a search of the UDS network, you cancel the search and return to the Mode Selection screen.

X Button Run in the mode that uses Internet communication. Perform random matchmaking. If there is a session that can be joined, join it as a client. If there are no sessions, create one as the host. Then you transition to the Main screen.
START Exits the program.

Main Screen

Performs communication using CloneProtocol.

Every two lines of the upper screen correspond to a single clone. The first line shows the state of the clone and the second line shows the values of the clone elements registered to the clone. The first character represents the type of clone and is followed by the clone ID. If the next character is an 'R', the clone is registered with CloneProtocol. All other display items depend on the clone type and appear as follows.

  • SendClone

    S 0 R 1000

    The line that begins with 'S' indicates a SendClone. Each digit of the "1000" part indicates whether the station is connected to the ReceiveClone that receives values from the current SendClone, in order from STATION_INDEX_1. (1 indicates connected and 0 indicates not connected.)

  • ReceiveClone

    R 0:0 R 1

    The line that begins with 'R' indicates a ReceiveClone. The numbers after the ID are the ID of the station being connected to. The '1' at the end indicates whether you are connected to the target SendClone.

  • AtomicSharingClone

    A 0 R 1000 Unlocked

    The line that begins with 'A' indicates an AtomicSharingClone. Each digit of the "1000" part indicates whether the station is connected to the AtomicSharingClone that exchanges values with the current AtomicSharingClone, in order from STATION_INDEX_1. The string after that represents the lock status.

  • SequentialSharingClone

    Q 0 R 1000

    The line that begins with 'Q' indicates a SequentialSharingClone. Each digit of the "1000" part indicates whether the station is connected to the SequentialSharingClone that exchanges values with the current SequentialSharingClone, in order from STATION_INDEX_1.

The second line shows the values of each clone element. The first four are UnreliableCloneElement objects, followed by one ReliableCloneElement object, and ending with a ReckoningCloneElement object. These values are not displayed until a value is set or received. The value of ReliableCloneElement in particular does not appear at first because it needs to be explicitly set.

The last line shows the status of CloneProtocol. It includes the state of CloneProtocol, the clock, and the number of packets sent every 0.5 seconds. An 'R' appears after the clock value while the clock is being resynchronized.

Input Operation
Up/down on the +Control Pad Move the pink cursor to change the operation target.
R Button Show the CloneProtocol, the clone element, and the profiling results on the console screen.
L Button Reset profiling.
START Withdraws from the session and returns to the Mode Selection screen.

When the cursor is over a clone, operations affect that clone.

Input Operation
Right on the +Control Pad Toggles the status of registration with CloneProtocol.
Left on the +Control Pad Toggles the lock status (for an AtomicSharingClone object).
A Button Sets a new value in ReliableCloneElement (when in a sendable state).
B Button Raises an event with EventCloneElement (when in a sendable state). The raising and handling of events are output to the console window (except in Release builds).
X Button Sets a new value in ReliableLargeCloneElement (when in a sendable state). Sent and received values are output to the console window (except in Release builds).
Y Button For SendClone: Determine whether all stations have the ReceiveClone that receives data from this SendClone, and write the result to the console. For SequentialSharingClone: Determine whether all stations have the SequentialSharingClone that exchanges data with this SequentialSharingClone, and write the result to the console.

When the cursor is in the State row, the operations are performed on the CloneProtocol.

Input Operation
A Button Starts and stops communication using CloneProtocol.
X Button Resynchronizes the time.
Y Button Outputs the ID and type of the clones that are currently registered with CloneProtocol to the console. Also outputs stations for which CloneProtocol is currently active.

When a session cannot continue because of an error or another reason, you are automatically returned to the Mode Selection screen.