op2_sdk:projectsettings

Development Environment Project Settings

This page lists some common development environment customizations for Visual Studio when creating Outpost 2 scenario DLLs. Including, changing target file name, copying files to a new directory on post build, referencing Outpost 2 from Visual Studio, and debugging. You should have Visual Studio running and compiling basic scenario DLLs before proceeding.

Within the Outpost Universe repository, the Outpost 2 API uses the IDE Microsoft Visual Studio. These instructions are for Visual Studio, but the general principles should apply to other IDEs such as Code::Blocks. The following screenshots are taken from Microsoft Visual Studio 2015, however they should be very similar to other versions of Visual Studio.

Visual Studio defaults to naming an executable or DLL produced from a project as the project's name. For example, the project OP2Script.vcxproj would produce the DLL OP2Script.dll. Outpost 2 enforces specific scenario naming conventions like reserved first filename characters, and seven characters or less (not including the extension) filenames. To prevent having to rename the file for testing every build and allow flexibility in naming your project, you can set the target name property of the project to specify a new output name for your dll.

  • Open your Project in Visual Studio.
  • In the solution explorer, right click on your project → Properties.
  • Click Configuration Properties → General → Target Name. Update the name as you see fit.

Copying Scenario DLL using a Post Build Event

In order to simplify testing of a scenario DLL, consider setting a post build event to copy required files directly into the Outpost 2 root install directory. Post build events are executed every time the project is re-compiled.

Visual Studio uses macros in pre and post build events to simplify commands. For example $(TargetName) represents the target filename minus its extension. A list of macros can be found here: https://msdn.microsoft.com/en-us/library/c02as0cs.aspx.

  • In the Solution Explorer, right click on the project you wish to include a post build event and click on properties.
  • Click Configuration Properties → Build Events → Post-Build Event.
  • Set the Command Line to perform a copy event.
  • Repeat for each file you want copied to the new directory.

Note: In the copy command, the /Y instructs the copy command to overwrite existing files. Place the original file first and the location you want the file copied to second.

Executable files can be referenced from within Visual Studio. This allows running Outpost 2 from within Visual Studio when testing a mission DLL.

To add the Outpost 2 executable as an existing project to your Visual Studio Solution.

  • File → Add → Existing Project → Select Outpost2.exe (from wherever it is installed on your machine).
  • You should now see Outpost 2 as a second project in your solution explorer.
  • Set Outpost 2 as the StartUp Project by right clicking on it in the solution explorer.
  • Build your project and press Start Debugging (or hit F5). Outpost 2 should load normally.

Since we do not have access to the Outpost 2 source code or program debug database (PDB file), we cannot step through the Outpost 2 executable code or compare the stack trace with source code. However, we can still debug custom scenario DLLs.

In order to debug your DLL, follow the required steps from previous sections to ensure a copy of all required files (mission DLL, MAP file, tech tree file, etc) are contained in the Outpost 2 root directory. Then ensure your Visual Studio project is linked to Outpost 2.

  • Recompile your project if needed.
  • Set a break point where you want to examine the code or perform whatever other debugging action.
  • Press Start Debugging (or hit F5). Outpost 2 should load normally. Once Outpost 2 accesses your DLL, Visual Studio should pause the program at the break point and let you examine the stack trace.

Note: The Visual Studio must have access to your scenario's PDB (Program Debug Database) file for debugging. The PDB file is rebuilt every time you recompile a scenario. Visual Studio will automatically find the PDB file in your project directories and copying the PDB to the Outpost 2 directory is not required.


- Go Back to Outpost 2 Mapmaking
- Go Back to Outpost 2 Main page
- Go Back to Wiki Home Page

  • op2_sdk/projectsettings.1456587777.txt.gz
  • Last modified: 2016/02/27 15:42
  • by vagabond