Open Rails

Contribute > Developing Code

Private Changes

Anyone can download the source code for Open Rails and make changes to suit themselves and create a personal version.

Public Changes

If your changes might be useful to others, then we encourage you to submit them for inclusion into the product. We will respond to all submissions and give credit in the project record for submissions that are included.

Click here for detailed advice and instructions for contributing to Open Rails.

Version Control System

The Open Rails project uses Git as the versioning and revision control system for our software. Revisions are kept in a public repository at GitHub.com and can be compared, restored and merged, so that versions are safe and several developers can work independently without (too much) conflict.

From your PC, you can simply view the repository from a web browser. GitHub.com provides the GitHub Desktop program to interface between GitHub.com and your PC (for 64-bit Windows only). Other Windows programs are SourceTree and TortoiseGit and also Visual Studio includes a Git tool. See our step-by-step instructions for starting to work with Git.

The main folders in the repository are:

Compiling the Open Rails Project

To compile and debug the Open Rails source code, ensure you have the following Microsoft products installed:

  • Visual Studio 2022, any edition. The Community Edition is free
    (Note: To save on disk space, all you need is the option Windows > .NET desktop development)

After you have downloaded the code:

  1. Open folder Source
  2. Double click on file ORTS.sln to launch Visual Studio with the Open Rails project
  3. From the Visual Studio menu, select Build > Rebuild Solution
  4. In the status bar (lower left), wait for the message 'Rebuild All succeeded'

The executable files have now been built and placed in the Program folder.

Running the RunActivity.exe Code in Debug Mode

Note: When debugging you will bypass the normal start menu and must specify an activity on the command line.

On the Visual Studio menu,

  1. Select View > Solution Explorer
  2. In the Solution Explorer box (on the right), right click on RunActivity > Properties
  3. Use the Debug tab (on the left) to open the Debug Window.
  4. Into the "Command line arguments", enter the path of the activity that you want to run: e.g. "c:\personal\msts\routes\lps\activities\ls1.act". Use quotes if the path has spaces in it.
  5. Below this, check the checkbox for "Enable native code debugging"
  6. Press F5 to run RunActivity.exe using your activity.
Running the Test Suite

The Open Rails source tree includes a number of unit and integration tests, primarily for portions of the code that deal with data processing. All code changes must pass these tests. Developers are also encouraged to write their own tests for any code that lends itself to testing.

After opening the solution in Visual Studio,

  1. Select Test > Test Explorer
  2. Wait for the tests to populate in the Test Explorer pane
  3. In the top-left corner of this pane, select "Run All Tests," or press Ctrl-R, then A.
Policy for Code Changes

To allow many people to contribute directly to Open Rails successfully, we have a policy in place to keep tabs on where changes come from and which changes are allowed. The policy is set out in the document Contributing.md.

For members of the Development Team, these policies are defined in more detail in Policy for code changes and Policy for blueprints.