Compact route - what does it do exactly.

RJArtim

67 yrs old Trainz Veteran
When you compact a route what exactly happens? Does it clean up your config.txt of assets not used? I notice a lot of assets that I removed from the route along with test trains. I looked in the Wiki and it wanted me to start the topic. I searched the forum for compact and came up with nil.
 
I believe that the "compact route" option is provided for emergency use. I do recall seeing something posted from N3V quite a while back and I remember them using the terms "emergency only" and "large routes only". Consequently, I have never gone anywhere near it.
 
Yeah. It breaks existing sessions so use with caution from what I remember Tony saying.

The breaks existing sessions is the part I don't like and I never tried to see what exactly it does.
 
When you go to use it you are warned about losing all the sessions. But it doesn't really say what it is going to do.
 
When you go to use it you are warned about losing all the sessions. But it doesn't really say what it is going to do.

Just like that lever in a jet fighter cockpit that just says "Eject" - it also does not explain what it is going to do, or the Big Red Button at the NORAD Command Centre buried deep under Cheyenne Mountain.
 
It's like when you were young your mum said 'don't touch that, it's hot'
But you want to know what hot is :)





big-red-button.gif
 
I tried it on a renamed copy of a route. It definitely broke the sessions.

I don't know what "compact route" does, but I imagined that it was going through the route's track splines and building a new internal model of the route. I would guess that it might renumber the splines, but I haven't tested for that result. Again, this is all guesswork on my part.
 
Apparently there were creators who were building enormous routes, some I believe were 100s of MB in size. This created problems that the Compact Route option would "solve" but not without side effects. A bit like using stomach banding to solve an obesity problem.
 
I don't know beans about Trainz' internal coding. That's a sad situation since I'm a little better at fussing with code than I am at building routes.

But we've all noticed that if you build a route creating tracks, then deleting mistakes and re-creating replacement tracks -- the numbers on the junctions and track markers which have been deleted are not reused. So the internal lists of junctions and markers must end up with many blank entries. Or maybe the internal list keeps the deleted numbers, but marks them as deleted.

Yesterday I built a small test route on a baseboard. Then deleted and replaced most of the low numbered track junctions. The route included a track marker at opposite ends. Then I created a session that instructed the train to go back and forth between the two markers. I ran the session once to make certain I didn't do anything dumb that kept it from working.

Then I used the compact route on it. The junctions and the track markers were indeed renumbered. I expected it to start renumbering at the first track that I laid and work to the last piece, but it didn't. I'm not remembering which track piece was the last to be laid, so I'm not certain why compact route started renumbering where it did. I suppose the track pieces themselves were also renumbered, but I've never tried to figure out the number of a piece of track. So I don't know what it did there.

With different numbered track markers, the session didn't work at all.

It also produced this error code:

DriverCharacter : File drivercharacter.gs, Line 497, ER_NullReference
function $void@DriverCharacter::ScheduleThread(), line 493
DriverSetupRule : DriverSetupRule> 1 errors during driver creation. Trains may be missing drivers and/or commands. (file interface.gs)
function $void@Interface::Exception(string), line -1
function $void@DriverSetupRule::CreateDrivers(), line 798
DriverCharacter : DriverCharacter.CreateSchedule> null driverTrain (file gs.gs)
function $void@GameObject::Exception(string), line -1
function $void@DriverCharacter::CreateSchedule(), line 320
function $void@DriverCharacter::DriverCustomCommand(CustomCommand), line 474
function $bool@DriveToTrackmarkScheduleCommand::UpdateExecute(DriverCharacter), line 136
function $bool@DriveToTrackmarkScheduleCommand::BeginExecute(DriverCharacter), line 114

I don't know if this is Lua or Java code. I haven't worked with either, but I've heard that earlier versions of Trainz used both.

So ... I still didn't answer any of the questions raised in this topic. Compact Route definitely seems to read through each of the splines in the route to remove all the deleted splines so that the internal tables or lists of splines are more compact. But I don't know what else it might be cleaning up.
 
Bump

Have we come any closer to knowing exactly, or even approximately, what happens under the hood when the Compact Route menu option is selected?

I recently had a ghost consist that appeared after a CTD. Was able to exorcise it using the Delete Missing Assets option. Would Compact have done the same or made matters worse? The route alone takes up 186 MB on disk but makes a 35 MB CDP file. would Compact make it smaller?
 
My advice would be "try it and see" - but always have backup copies (plural) before attempting anything.
 
Back
Top