multiple versions active at the same time

martinvk

since 10 Aug 2002
One of the downsides to having multiple versions active at the same time, is that they can't communicate with each other. Specifically, the next available kuid. If I make a new route in one, that kuid might be used for something else in another version. If I want to import that route, how to avoid a conflict? I tried to change the route kuid in the config file but got an error about being unable to commit the change. It's my route! Is there a special way to do this? Don't recall having that issue with my home made objects since I control the kuid number, I just have to make sure to not reuse an existing value.

How do you handle this? Avoid sharing routes across multiple versions?
 
I have two Trainz versions, both running on two different computers. When I create a new route or session on one version on one computer I export it as a .cdp and import it into the other versions and computers. It avoids the problems with kuids that you described and that I also used to experience before using this procedure.
 
But making a CDP doesn't change the kuid value. If a route was 123 in computer A, it would be 123 in computer B. If that kuid was already used by something else, it might not be accepted with an error saying that kuid already exists. Or it might over write, not sure. My problem is the sessions that were associated with route 123. Then in computer B, they might point to another object and not the original route.
 
You need to make sure that when you start all your kuids in all version and computers are in sync. I resolved the problem by displaying all the assets I had created on all my versions and computers and eliminating those that were unnecessary (e.g. temporary sessions, test versions, etc - these were the most common causes of kuid conflicts) then eliminating those assets that existed in only one version and on one computer and that I did not want to transfer to the other versions/computers.

Once all possible conflicts had been resolved then I made the .cdp files of those assets that did not exist in all versions and computers and transferred them across. From that point on it was easy to stay "in sync". If I needed to create a temporary or test version of a route or session on one installation, I deleted it immediately after it had served its purpose.

The secret is to do the clean out first.
 
Sounds like a plan, now for the hard part, actually following it.
Since it it is the automatically created route kuids that are the main issue, is there a way to set a starting value which would be different in each version? My own objects' kuids I can control.
 
I've been burned by this a few times too and inadvertently overwrote a session once with another asset and didn't notice until after I had submitted the asset. GRRR!

After that I sort my content in Content Manager by Kuid in ascending order in what I call my production version. The next asset following the very last will have the next highest kuid, which I enter into the asset I am importing from a previous version manually.

Now I said this before, but I can't find my post on this of course, it would be great if the kuids were tracked by our My Trainz accounts rather than locally. With a tracked kuid index, this would prevent content from being overwritten because Content Manager regardless of any version loaded will check My Trainz account on login and obtain the last highest kuid value.

I know this is one more thing online, but we need some way of tracking multiple datasets easily without the risk of ruining content. The alternative is to have a database manager that oversees all Trainz installs rather than the current one loaded. For those that only have a single database, this wouldn't matter and the the TAD Daemon would work the same, but for those of us with multiple installs, the TAD Daemon would check all databases on startup of any Trainz version and obtain the highest kuid number. This would require some additional coding on N3V's part too to also ensure that when queries and asset installs take place, that only the active database is updated and also within the program its self while we use Surveyor where we don't want to be installing content on the route from the wrong database, or worse, writing to the wrong database when saving.
 
I have an Excel spreadsheet of my content, other than routes and sessions, The number series are by category and numbers are way above that of the next kuid. This hopefully minimises the risk stated in the OP but is no guarantee. You really need to check if those kuid(s) are in use before copying from another installation.

I think we should have the option of nominating the kuid to be used when creating a route or session. That would the simplest approach.
 
Does anyone remember the "goode olde dayz" when different types of assets (e.g. buildings, trees, tracks, signals, locos, etc) each had their own kuid ranges? That feature was dropped some Trainz versions ago.
 
Edit the asset.
Change KUID.
Don’t try to commit it, but instead import it.
Revert the old asset and delete it.

Problem solved.

As a side suggestion:
Change the KUID to a number outside of the auto creation range. So for versions since (at least) TS12, use a number below 100,000.
 
You can run trainzutil and enter "setnextcontentid xxxxx". Whatever you put in the x spot will be your next automatic kuid.

// Erik from Sweden
 
To change a kuid manually:
Open the object in Explorer and copy the object-folder f.e. to the desktop.
Open config.txt and change it's kuid.
Import it.

Now you have a clone with new kuid. Delete the version you don't need in CM.

Take care for objects needing it as dependency....
Have success..
 
Import - thanks for the missing step in my process. That did the trick. Amazing how easy it is to overlook the obvious.
 
You can run trainzutil and enter "setnextcontentid xxxxx". Whatever you put in the x spot will be your next automatic kuid.

// Erik from Sweden

This ^ ^ jogged some brain cells...

Justin Cornell (NorfolkSouthern37) I think put this together to set the ranges of specific assets. I haven't used this since the TS12 days, but I'm sure it still works. To use: Copy the text within the CODE box and paste into a text file, and rename the text file to kuid_range.cmd. Run from a command prompt/Powershell command prompt. Note: for PS you may need to put in ./ to run the batch.

Code:
echo off
cls
ECHO.
ECHO ...............................................
ECHO PRESS 1, 2,3, OR 4 to select your task, or 5 to EXIT.
ECHO ...............................................
ECHO.
ECHO   Set for Loco 10000                 1
ECHO   Set for Rolling Stock 20000     2
ECHO   Set for Interiors 30000           3
ECHO   Set to Default 800000            4
ECHO   EXIT                                     5
ECHO.
SET /P M=Type 1, 2, 3, 4, or 5 then press ENTER:
IF %M%==1 GOTO LOCO
IF %M%==2 GOTO STOCK
IF %M%==3 GOTO INTERIORS
IF %M%==4 GOTO DEFAULT
IF %M%==5 GOTO EOF


:LOCO
trainzutil setnextcontentid 10000
GOTO EOF
:STOCK
trainzutil setnextcontentid 20000
GOTO EOF
:INTERIORS
trainzutil setnextcontentid 30000
GOTO EOF
:DEFAULT
trainzutil setnextcontentid 800000
GOTO EOF
:EOF




Mod 2:
GOTO EOF
:DEFAULT
REM %TRSpath%\trainzutil setnextcontentid 800000
GOTO EOF
:EOF
Set TRSpath=
set M=
%TRSpath%\trainzutil setnextcontentid 2000000


Mod 3:


>NUL %TRSpath%\trainzutil setnextcontentid 100000
FOR /F "delims=: tokens=1-4" %%i in ('%TRSpath%\trainzutil generateKUID') do (
if "%%i"=="<KUID2" set LZKUID="%%i:%%j:%%k:%%l"
 
Back
Top