Multimorphic has released the latest version of the P3 SDK.  You can download it now on the support page.

I want to highlight a few things about this version:

  • Support for 2022 machines with the new motorized wall and scoop assembly
  • Support for WAMONH module
  • Fixes some bugs with namespace and audio in the sample app.
  • LED simulator in the editor

 

Here is the complete change log

0.8:
- Added Sample Module Driver VS project
- Added Simple Diagnostics Unity project to help create and simulate module features in diagnostics
- Reworked module driver documentation based on above additions
- Refactored SDK zip file
- Enabled new framework replay feature (Added example setting overrides in P3SASettingsMode.cs, but didn't add local handling of an achieved replay)
- Added LED simulation support (select Display8 in Unity)
- Fixed a playlist bug in P3SAAudio.cs
- Added Multimorphic prefixes to some logging messages to avoid a compiler error after renaming the project to a non-Multimorphic company
- Removed odd numbered trough entries from the default sim states dictionary
- Changed high score entry buttons so 'start' is exit/back and 'launch' is select.
- Commented out instantiation of inlane/outlane transition prefabs in LanesManager, as those prefabs aren't part of the SDK
- Enable BumpersMode by default
- Changed HomeMode's drain event handler to call EndOfBall, which posts Evt_BallEnded, instead of directly calling End(), which is intended to be called only when the mode is stopped.  This allows the programmer to do other things as a result of EndOfBall but before stopping HomeMode.
- Added BaseGameMode option to show end of ball bonus even if tilt is active
- Added Chase Ball enable to optionally disable chase balls from ball search (useful in tournaments)

Let's walk through how to upgrade an existing app to the new version, and look at the new LED simulator

 

Upgrading an existing App.

The process is super simple and just requires copying a few files.

  • Copy the P3_SDK_V0.8\P3SampleApp\Assets\Plugins folder into your existing app
    • In practice this is only changing NetProcMachine.dll, P3.dll and P3App.dll, but it is easier to just copy the entire things
  • Copy P3_SDK_V0.8\.multimorphic to your .multimorphic directory in your HOME

That is it. We are done. If your app was working before it should be working still and be updated to the new SDK.

 

Using the new LED simulator in an existing app

Documentation on how to use the simulation can be found in P3_SDK_V0.8/Documentation/html/_physical_features.html#LEDSimulations

As the instructions state. All you might need is to add the P3SampleApp/Assets/Resources/Prefabs/GUI/LEDSimulator.prefab into your project. Let's see what happens with Arena.

And it just worked. Awesome.

You can get a long way debugging things simply by using a generous amount of logging statements and the Unity inspector. However, it is often faster and easier to just use a debugger. I was hesitant to bother setting it up, but now I wish I had done it earlier. Here is a quick guide on how to set it up, and a simple example of using it in P3SA.

Prerequisites

We need to install the Unity Debugger extension from the extension marketplace in vscode. Press CTRL+SHIFT+X and search for "Debugger for Unity". You will see 2 versions, a deprecated version from Unity, and a fork of that version by deitry. My understanding is that some compatibility changes were needed and the official extension did not support them. So install the deitry version.

Now we want to enable debugging for our project. Open the project in vscode. Click the Debug panel, and select "create a launch.json file" If you do this with a cs file open, it seems to look for c# extensions and doesn't find Unity as an option. But if you do it from another file, like the extension info page it works. Select "Unity Debugger".

We are now ready to debug something.

  • Load up Assets/Scripts/Modes/GameModes/MovingTargetMode.cs and add a breakpoint at line 30.

  • press F5 to start the debugger.
  • In Unity, run the program
  • Start a game with "s"
  • Click the rotating box with the mouse to hit target. Your program should stop on our breakpoint.

You can now do things like

  • Inspect variables
  • Add new variables to the watch list
  • Inspect the call stack
  • Step through line by line using the controls the red arrow is pointing to.

This is not intended to teach you everything you need to know about using the debugger, but hopefully it helps get you started.