CTR Pia
4.11.3
Game Communication Engine
|
This is a more advanced demo of the features of the nn::pia::session::Session
class.
This sample demonstrates the following functions.
nn::pia::session
nn::pia::transport
nn::pia::inet::NexFacade
nn::pia::inet::NexDebugSession
nn::pia::local::LocalFacade
Uses the friend presence feature to determine whether the demo was started from the HOME Menu. When started using friend presence, the local device automatically transitions to the state for selecting the friend's session and attempts to join the session.
To join a session a friend has joined using the friend presence join-in feature, the master ROM must be created with the appropriate settings for the join-in game ID and join-in game mode mask, and the ROM must be started from the HOME Menu.
For information about how to create master ROMs, see the CTR Master ROM Creation and Submission Guidelines.
An Advanced.bsf
file that has the settings, such as the join-in game IDs, is included in the same directory as the source files. This banner specification file is specified in Omakefile
.
When started normally, the system automatically transitions to the matchmaking selection state.
This is the state for selecting Internet communication, local communication, or dummy session.
Input | Operation |
---|---|
A Button | Start communication via local communication (UDS). After you make a selection, the system transitions to the session selection state. |
X Button | Starts Internet communication. After you make a selection, the system transitions to the session creation type selection state. |
B Button | Starts a dummy session. After you make a selection, the system transitions to the dummy session management state. |
This state is used to select the method for creating the session. When using a session system password to keep the information to rejoin the session, the system automatically transitions to the session selection state and attempts to join the session.
Input | Operation |
---|---|
A Button | Joins a session by using random matchmaking. After you make a selection, the system transitions to the communication state. |
B Button | Ends Internet communication and transitions to the matchmaking selection state. |
Y Button | After you make a selection, the system transitions to the session selection state. |
X Button | After you make a selection, the system transitions to the friend session selection state. |
In this state the local device searches the network for sessions and selects a network to connect to as a client.
It is also possible to create a new session. (In this case, the local device becomes the host.)
Input | Operation |
---|---|
Up or Down on the +Control Pad | Selects the session to connect to. |
Left on the +Control Pad | Switches between whether or not to select the connection target session based on the session search results history. |
Right on the +Control Pad | Switches between whether or not to select the connection target session based on the session search results history. Can only be used during Internet communication. |
START Button | Clears the session search results history. |
A Button | Joins the selected session. Transitions to the communication state. |
B Button | When using local communication, ends local communication and transitions to the matchmaking selection state. When using Internet communication, transitions to the session creation type select state. |
Y Button | Searches for sessions on the network. |
X Button | Creates a new session. After you successfully create a session, the demo transitions to the communication state. |
R and X Buttons | Searches for sessions on the network by specifying the principal ID of the owner. |
R and Y Buttons | Searches for sessions on the network by specifying the principal ID of the participant. |
This state uses the friend presence feature to search for joinable sessions that friends are participating in and makes it possible for the local device to select those networks to join as a client.
It is also possible to create a new session. (In this case, the local device becomes the host.)
Input | Operation |
---|---|
Up or Down on the +Control Pad | Selects the PrincipalId of the friend to connect to. |
A Button | Joins the selected friend's session. Transitions to the communication state. |
B Button | Transitions to the session creation type selection state. |
Y Button | Uses the friend presence feature and searches for joinable sessions that friends are participating in. |
X Button | Creates a new session. After you create the session, friend presence is updated to indicate that it can now be joined, and the system transitions to the communication state. |
Communication occurs among the nodes in the session. In this state, each of the nodes communicates in the following way.
A character (rectangle) is assigned to each connected node and displayed to indicate that communication is taking place. A StationId
and player name are displayed to the right of each character.
If you disconnect from the network, the demo transitions to the matchmaking selection state after reinitialization. When unintentionally disconnected from the network, the system transitions to the error display state.
Network information for the local device and the session host appears at the bottom of the lower screen as a debugging feature.
Input | Operation |
---|---|
+Control Pad | Moves the position of the rectangle displayed on the upper screen. When there is no input from the +Control Pad, the rectangle moves to the right to indicate that communication is taking place. |
B Button | Leaves the session. Operating as the host, the local device performs host migration (if host migration is enabled) and leaves the session. If host migration is not enabled, it destroys the session. After leaving, transitions to the session creation type selection state. |
L Button | Makes the session open (accepting participants). If the session is already open, then the session is changed to closed. Enabled for the host only. |
START Button | Generates a session system password (needed to rejoin the session) and records it along with the session ID. If a session system password has already been generated, the password requirement is released and the password is cleared along with the session ID. Enabled for the host only. |
The state for building, destroying, and updating settings for dummy sessions.
Input | Operation |
---|---|
A Button | Creates a dummy session. |
B Button | Transitions to the matchmaking selection state. |
Y Button | Updates dummy session settings. |
X Button | Destroys a dummy session. |
Transition to this state when showing errors that occurred in the sample demo on the screen.
Show the error type on the screen when you cannot communicate because you are in wireless-disabled mode or when communication cannot be maintained. When the AC connection, the friend server or game server login, or the attempt to join a session fails, the error type, the result when the error occurred, and the error code appear on the screen.
Error types are shown in the following list.
Input | Operation |
---|---|
A Button | Leaves this state, and after reinitialization, transitions to the states below. Matchmaking Selection State </td> |