Development Environment Project Settings

This page lists common development environment customizations when creating Outpost 2 scenario DLLs using Visual Studio. The customizations include changing the 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.

  1. Open your Project in Visual Studio.
  2. In the solution explorer, right click on your project → Properties.
  3. Set Configuration to All Configurations.
  4. Set Platform to All Platforms.
  5. Click Configuration Properties → General → Target Name. Update the name as you see fit. (The Target Name should not include the file extension).

Copying Scenario DLL using a Post Build Event

To simplify testing 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.

A vanilla copy of the current Outpost 2 release is kept in the repository at Outpost2SVN\GameDownload\Outpost2\Trunk. It is recommended to target this copy of Outpost 2 for testing. If placing the scenario on the SVN, the post build event's output path should be similar to ..\..\..\..\GameDownload\Outpost2\trunk\. This allows post build events to work on other computers where the repository is downloaded without changing the destination of post build event copies.

Example Post Build copy commands:

  • copy /Y “$(TargetPath)” “..\..\..\..\GameDownload\Outpost2\trunk\$(TargetFilename)”
  • copy /Y “$(ProjectDir)Ashes.map” “..\..\..\..\GameDownload\Outpost2\trunk\Ashes.map”
  • copy /Y “$(ProjectDir)multitekNoLavaWalls.txt” “..\..\..\..\GameDownload\Outpost2\trunk\multitekNoLavaWalls.txt”

Setting Post Build Event Instructions

  1. In the Solution Explorer, right click on the project you wish to include a post build event and click on properties.
  2. Set Configuration to All Configurations.
  3. Set Platform to All Platforms.
  4. Click Configuration Properties → Build Events → Post-Build Event.
  5. Set the Command Line to perform a copy event.
  6. Repeat for each file you want copied to the new directory.

Note: Before committing a new project to the repository, turn the post build events into remarks by prefixing them with the rem keyword. This prevents the post build events from executing unless the user downloading your source code explicitly wants them.

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.

Note: Paths passed as arguments into the copy command cannot contain spaces unless the path is enclosed in parenthesis. For example “C:/Outpost 2” is valid while C:/Outpost 2 is not valid.

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

An alternative option to referencing Outpost2.exe within the solution is to set Outpost2.exe as the startup executable for the scenario DLL. To do this, set Outpost 2 as the external executable under the DLL project's debug settings.

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

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

- Go Back to Outpost 2 Software Development Kit (SDK)
- Go Back to Outpost 2 Main page
- Go Back to Wiki Home Page

  • op2_sdk/projectsettings.txt
  • Last modified: 2016/11/03 17:40
  • by vagabond