Differential File

Rail3dWiki — Differential File

Differential Files


A differential file captures the difference between two versions of a Rail3D layout.


How it works:

To generate a differential file, you open a layout, specify the layout file to compare it with, and the name of the output difference file. The program then compares every node and link in the file and outputs to the output file the difference between the two layouts. Later, you can take the difference file (or “patch file” if you like) and apply it to one layout to “upgrade” that layout to the new versions.

Conceptually, the differential file contains instructions like:

  • Delete link between 2345.53/2344.54 and 45467/34355
  • Add Node at 53545/3424
  • Create link from 334553/34342 to 343535/32255
  • Set link between 2345.53/2344.54 and 45467/34355 to track type “Concrete”
  • Delete Stop at 35666/36225
  • Create Signal, type “uk3” at 44255/25256

Why would you want to do this?

Suppose two people are working together on a layout. They start with a common base version of the layout: File0. Now they each go and work on different bits of the layout. After a while they want to combine their changes. At this point we have two different files:

    FileA = File0 + A’s_Changes
    FileB = File0 + B’s_Changes

So, each of them saves a differential file to extract the changes made: ‘A’ generates a differential file for the differences between his working file (FileA) and the base file (File0) and produces difference file DiffA

    DiffA = FileA – File0       

Likewise, B can produce DiffB = FileB – File0

They can now swap the diff files and use the “Merge difference file” function to combine these files to get FileC – the combined layout with all the changes in it. There’s actually three ways you can combine the files to get the final combined file:

FileC = FileA + DiffB       // ie add B’s changes to A’s working file
FileC = FileB + DiffA // add A’s changes to B’s working file 
FileC = File0 + DiffB + DiffB  // start from the base and add both sets of changes

Implementation Limitations

At present the difference file will handle nodes and links, signals, stops and reverses. Terrain changes, scenery (other than linear scenery) and features other than those listed above are ignored. (I will add this asap)



  • Does the differential file feature include deleting nodes and links?

Yes, track removed is captured and will be removed when you merge the difference file

  • What happens if you merge the same file twice?

Nothing, it will just apply the settings in the difference file twice with no harm done.

  • Can you have more than two difference files at a time?

Yes, you can have as many difference files as you like – the only thing that matters is the order in which they are applied as the changes are applied in the order the files are applied.


Sample Merge

Creating a sample differential file

Screen clipping taken: 04/10/2012 07:46

  • Save updated file (as Merge V0.1)
  • Generate difference file:
  • File / Save Differential File
  • Set reference file to original base (V0.0)
  • Name differential file “00–01″ - ie from 0.0 to 0.1

Screen clipping taken: 04/10/2012 07:48

  • Click “Save”

Merging a differential file

  • Open the base (v0.0) file
  • Select File / Merge Differential File
  • Select the differential file from above (“00–01″)

Screen clipping taken: 04/10/2012 07:51

  • Click “Load”

The difference file is loaded and the layout updated with the changes.

MRG 28/06/2013 07:46:03