CTR Pia
4.11.3
Game Communication Engine
|
This simple sample demonstrates the use of the random matchmaking features in the nn::pia::session::Session
class for application developers.
This sample uses Internet communication only.
This sample primarily demonstrates the following.
The system transitions to this state upon startup.
Connecting to the Internet and logging in to the game server are handled automatically. When the network connection is finished, the system automatically transitions to the random matchmaking state. When the network connection fails, you automatically transition to the error display state.
In this state, the system waits for the random matchmaking process to start.
Input | Operation |
---|---|
A Button | Starts the random matchmaking process. When the random matchmaking is complete, the system transitions to the communication state. |
B Button | Logs out from the game server, closes the Internet connection, and transitions to the network connection state. |
R Button | Changes the method for determining which session to prioritize for matchmaking if there are multiple candidates for the target session between the following three choices.
|
Up/down on the +Control Pad | Changes the parameter values used when the session selection method is BroadenRange + Priority or ScoreBased . |
Right/left on the +Control Pad | Changes the score calculation setting used when the session selection method is |
The score calculation setting configured on the server when the session selection method is ScoreBased
is as follows.
ScoreSettingIndex | Details for the Calculation Setting |
---|---|
2. Rating | Selects a matchmaking target based on the rating value. Broken into five groups: 1 through 5; for values 0 through 1000, 1001 through 1500, 1501 through 2000, 2001 through 2500, and 2501 through 10000. Session matchmaking occurs within the same group. |
3. Disconnection Rate | Selects a matchmaking target based on the disconnection rate. Broken into four groups: 1, 2, 3, and 10; for values 0% through 1%, 1% through 3%, 3% through 5%, and 5% through 100%. Session matchmaking occurs within the same group. |
4. Violation Rate | Selects a matchmaking target based on the violation rate. Broken into four groups: 1, 2, 3, and 10; for values 0% through 1%, 1% through 3%, 3% through 5%, and 5% through 100%. Session matchmaking occurs within the same group. |
5. Geo Ip | Selects a matchmaking target based on the Internet distance. Session matchmaking occurs when parties are 5000 km or closer. The IP address is overwritten using a debugging API. |
6. Country Code | Performs matchmaking when the country codes match. |
7. Session Duration | Sessions with a longer duration are prioritized for matchmaking. Priority is given to sessions with a duration of at least 15 seconds. |
8. Selection Priority | Sessions with a higher matchmaking priority are prioritized for matchmaking. |
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. The session information and the network information for the local station and the session host are also shown.
If disconnected from the network, the system transitions to the error display state.
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 | Starts the process of leaving the session. After successfully leaving the session, the system transitions to the random matchmaking state. If the system fails to leave the session, it transitions to the error display state. |
Y Button | Updates the matching priority values used for determinations when the session selection method is found with BroadenRange + Priority . |
X Button | Changes the session attribute value specified in the search conditions. Only the session host can do this. Switches between values that are included in the search and values that are excluded. |
R Button | If the session is closed, the station begins the process of accepting participants and waits for other stations to do the same. This process ends after all stations in the session begin the process of accepting participants, at which point new stations can join in. If the session is on the open-invitation state, the station begins the process of closing the session to new participants and waits for other stations to do the same. This process ends after all stations in the session begin the process of closing to participation, at which point new stations cannot join in. |
L Button while holding down right on the +Control Pad | Updates multiple session settings. Matchmaking becomes impossible because various conditions are updated. |
L Button while holding down left on the +Control Pad | Updates application-defined data. |
The system transitions to this state when asynchronous processes fail or when communication cannot be maintained. Shows a description of the error, the details of the error result, and its value converted into a network error code.
Input | Operation |
---|---|
A Button | Performs a reinitialization process and then transitions to the random matchmaking state. If the error requires reconnecting to the network, the system transitions to the network connection state. |