|
P3-SDK 0.9
P3 Software Development Kit
|
P3 games can optionally enable a Feature Menu to give players access to various features to enhance their playing experience. The Feature Menu is intended to be accessible in the same way by players in any app (when enabled). That is by holding down either flipper button and hitting the start button. Alternatively, an app can bring up the Feature Menu at any time by posting "Evt_ShowFeatureMenu", though the contents are mostly relevant in AttractMode and when launch is pending in HomeMode.
The Feature Menu and many of the features it contains can be enabled/disabled through GameAttributes. App developers can choose to allow operators to control accessibility of many of the features, or they can hide any/all of these GameAttributes by setting the GameAttribute options to Hidden in the SettingsMode (attr.Options |= GameAttributeOptions.Hidden).
The entire Feature Menu can be enabled/disabled by controlling GameAttribute "FeatureMenuEnabled"
When enabled, the Feature Menu is available when data.ball == 0 or when gameState == GameState.LaunchPending. It's an app's responsibility to change the gameState to GameState.BallInPlay when a ball is launched (usually in HomeMode.BallStartCompleteEventHandler()) and back to GameState.LaunchPending at the start of the next ball (usually in HomeMode.StartPlaying()).
Player profiles allow players to effectively log into the game and access profile-specific features, like profile-specific game settings, team games, save/restore game state, etc.
There are a number of GameAttributes that determine how profile-related features and menus work. See the Feature Menu Configuration section for specifics.
Certain GameAttributes can be customized per profile, allowing people to play games with settings tailored to their skill level or desired configuration. To create such a GameAttribute, include the GameAttributeOptions.ProfileOption in the options parameter of the GameAttribute.
Example from P3SASettingsMode:
The example above sets the Option parameter to "PRW", which is a constant defined in the base SettingsMode as follows:
If you want to access player profiles in your game without using the Feature Menu, you can issue the following ModeToMode events:
| Event Name | Parameter Type | Parameter Meaning | Event Description |
|---|---|---|---|
| Evt_ChooseProfile | bool | Active profile upon choice | Bring up the profile selection menu |
| Evt_ActivateProfile | string | Profile name | Activate the specified profile by name |
| Evt_ChangeProfile | string | Profile name | Change the active player to a new profile |
| Evt_DeleteProfile | string | Profile name | Delete the specified profile |
| Evt_EditProfileSettings | string | Profile name | Bring up the operator settings for the specified profile |
| Evt_ResetProfile | string | Profile name | Reset the specified profile as if it were being created for the first time in this app |
| Evt_GetListOfProfileNames | any | N/A | Request the names of available profiles. The results are posted as ModeToMode event "Evt_ListOfProfileNames" with a List of strings (List<string>) |
| Evt_AddProfile | string | Profile name | Create a new profile with the specified name |
If you want to request a new name be entered, the following code will do it:
When enabled, team games allow multiple players (and even groups of players in the same game) to play cooperatively. All players playing under the same profile name will play on the same team. Players on the same team will share the same player data. For example, if players 1 and 3 are on the same team, data.Players[2].GetData("Score", 0L) will return the same value as data.Players[0].GetData("Score", 0L). This allows players to help each other progress through a game and/or team up against another player or team.
Team games are enabled/disabled with GameAttribute: "TeamGamesAllowed"
Saving/Restoring state can allow players to save their state and later start a new game that starts where they previously left off (relative to game progress, not the number of balls they've played). Players can restore state before launching their first ball, and they can save state before plunging subsequent balls.
Saving/Restoring state is enabled/disabled with GameAttribute: "SaveRestoreStateAllowed";
Bluetooth connection options are listed in the Feature Menu if the Global Setting "BluetoothEnabled" is true.
If the "AllowPlayerRemoval" GameAttribute is true and data.ball == 1, then players can be removed from the game. If a player is currently playing, player numbers greater than the current player can be removed by holding the start button for 2s, starting with the last player added. If launch is pending (gameState == GameState.LaunchPending), then even the current player can be removed. When player removal is possible, the Feature Menu will include an option to remove a player.
When the "SoftRestartEnabled" GameAttribute is true, active games can be aborted after the first ball by either holding down the start button for 2s or by selecting the Abort Game option in the Feature Menu.