PDK Samples Overview


Contents
Related Links

The Prepar3D SDK comes with several samples that show the functionality of the PDK API. The samples provided are grouped by high level capabilities or use cases. SimObjects developed using the SimObject API portion of the PDK are referred to as ISimObjects.


For more information on developing using the PDK, please refer to the PDK API Overview. For additional information ISimObject development, please refer to the SimObject API Overview.


General PDK Samples

Each of the following samples are located in the (PDK General Samples) directory in the Prepar3D SDK:

Sample Description
CameraSystemPDK Demonstrates how to access and control cameras using the PDK. Refer to the Camera Sample Overview for more information on this sample.
CigiComponentControl Demonstrates how to control CIGI components using the PDK when Prepar3D is an active CIGI host.
CigiCustomPacket Demonstrates how to configure custom CIGI packets.
CustomIcons Demonstrates how the PDK can be used to create and render custom icons sets.
CustomLights Demonstrates how to create and draw lights using the PDK. Refer to the Custom Lights Sample documentation for more details on this sample.
CustomPDKObjects Demonstrates how to use the PDK to draw various shapes at specific locations.
DataHarvester Demonstrates how the PDK can be used to request data on an object and output this to a file. In this case data for the user object is outputted to a CSV file.
DXGauge Demonstrates how the PDK can be used to render a cursor into a gauge using a texture or effect.
EyeTracking Example API to interface with eye tracking devices, and interacting with VR using eye tracking data. Can be used in conjunction with the eye tracking panel and HMD emulator to simulate eye tracking with no hardware.
GazeDataCapture Demonstrates how the PDK can be used to listen for Virutal Reality Service Messages and render a sphere at the Eye Location.
HMDSample Demonstrates how the PDK can be used to create a Helmet Mounted Display (HMD) overlay. Scaleform is used in this sample for drawing the overlay.
LinuxSimulationIntegration Demonstrates how the PDK can be used to interface between a vehicle hosted on an Linux simulation system. Refer to the Linux Simulation Integration Sample documentation for more information.
MousePicking Demonstrates how to use the PDK to hook up custom 3D picking within a window. Refer to the Picking Sample documentation for more information on this sample.
MyEngine Demonstrates how the PDK can be used to create and override specific vehicle components. In this case the throttle control for an aircraft engine.
MySubsystem Demonstrates how the PDK can be used to introduce a real-time subsystem into the simulation.
OpenGLTexture Demonstrates how the PDK can be used to render an OpenGL texture to a panel.
RadarAltimeter Demonstrates how the PDK can be used to create a Radar Altimeter.
RadarPanelCallbackSample Demonstrates how the PDK can be used to create a radar panel. The gauge is written in XML. Refer to the Radar Panel Callback documentation for more information.
SetSimRates Demonstrates how to update the sim rate of simulation objects. This can be used on both native SimObjects and ISimObjects created using the SimObject API.
TargetingPodSample Demonstrates how the PDK can be used to create an embedded targeting pod in an aircraft. The gauge overlay is written in Scaleform. Refer to the Targeting Pod Overview documentation for more details on this sample.
Tracker Demonstrates how to drive an ISimObject's position using an external real-time data source from the internet.
WorldObject Demonstrates how to create, place, and move an object in the world.


ISimObject PDK Samples

Each of the following samples are located in the (PDK ISimObject Samples) directory in the Prepar3D SDK:

Sample Description
Countermeasure Sample flare countermeasure which can redirect guided missiles. See Weapon Systems Overview for more information on configuring weapons within Prepar3D.
Missile Sample missile with guidance system. See Weapon Systems Overview for more information on configuring weapons within Prepar3D.
SimpleAirplane Basic airplane implementation. Fully functional with major systems implemented including variants with weapons and countermeasures. Can be built upon to create complex aircraft.
SimpleCar Basic ground vehicle implementation. Fully functional with major systems implemented including AI waypoint following. Can be built upon to create complex ground vehicles.
SimpleHelicopter Basic helicopter implementation.
WheeledTank More advanced ground vehicle implementation of an M1128. Fully functional with major systems implemented including variants with cannons and machine guns. Can be built upon to create complex ground vehicles.


Running the PDK API Samples

The following steps show how to compile and run the PDK API samples. Each of the samples follow the same process. You must have Visual Studio 2017 to compile the provided samples.

  1. Choose the sample you wish to run and open the SDK Samples.sln located in the SDK directory.

  2. In Visual Studio, select the Solution Configuration (Debug/Release) you desire to compile against.

  3. From the menu bar, select Build -> Build Solution. You should receive a notification that the build succeeded.

  4. The built sample's folder can be found in:
    Output\*Solution Platform*\*Solution Configuration*
  5. Copy the built sample's folder directly to:
    %USERPROFILE%\Documents\Prepar3D v4 Add-ons
    . For more information, the Distributing Add-On Packages article has details on the add-on package installation process.

  6. Start Prepar3D. You should be prompted to enable the add-on. Select Yes.

  7. Similar to standard SimObjects, your ISimObject should be selectable from the Select Vehicle screen and the controls should respond to the values set in the Control Mapping XML (DefaultControlMap.XML) file.

    NOTE: If the sample does not appear in the Select Vehicle screen ensure the friendly category name is added to the User Objects list found in the [Main] section of the Prepar3D.cfg. See Understanding the PDK API Samples below for more information.

Understanding the PDK API Samples

Each of the samples follow the same basic source and file structure. They can be executed on their own to learn the PDK API and ISimObject systems or they can be used as templates to create new PDK and ISimObject implementations.


All sample code is well documented and it is strongly recommended that the code of each sample be directly analyzed to learn more. For example, the SimpleCar sample is a very basic implementation of a ground vehicle. The following are steps to use the SimpleCar as a template and to understand the source and file structure of the samples.


The SimpleCar sample can be found at:

SDK\PDK ISimObject Samples\SimpleCar


Using a SimObject API Sample as a Template

After reviewing Understanding the PDK API Samples you are ready to create your own ISimObject. It is very common to use one of the samples as a template to create your own ISimObject. It is recommended that you choose the closest sample to the product you are developing. This section covers using SimpleCar as the starting project, but all other samples follow similar steps when using them as templated starting points. The following changes should be made to SimpleCar:
SDK\PDK ISimObject Samples\SimpleCar