Samples

SimObject API

Contents
Related Links

Overview

The Prepar3D SDK comes with several samples that show the functionality of the ISimObject API. Each sample shows a different platform, capability, or use case. SimObjects developed using the SimObject API are referred to as ISimObjects.


For more information on developing using the SimObject API, please see SimObject API Getting Started.


ISimObject Samples

Each of the following samples are located in the installed directory of the Prepar3D SDK (Simulation Objects\ISimObject\Samples):

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. Can be built upon to create complex ground vehicles.
SimpleHelicopter Basic helicopter implementation.
Subsystem Sample radar altimeter implementation. Shows how stand-alone subsystems can register properties that can be used by gauges, animations, and scenarios.
Tracker Sample that demonstrates how to drive an ISimObject's position using an external real-time data source from the internet.
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 SimObject API Samples

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

  1. Choose the sample you wish to run and open its Solution (.sln) located in its specific folder.

  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 SimObject API Samples below for more information.

Understanding the SimObject API Samples

Each of the samples follow the same basic source and file structure. They can be executed on their own to learn the SimObject API system or they can be used as templates to create new 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\Simulation Objects\ISimObject\Samples\SimpleCar


Using a SimObject API Sample as a Template

After reviewing Understanding the SimObject 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\Simulation Objects\ISimObject\Samples\SimpleCar