Give us some choice, please !

Today, on a strictly technical level, I pretty much do what I want with Trainz. Within the limits I can perceive, of course. But, I must say, I see the moment coming when things'll get boring. Yes, boring. And the problem's name is monotony. Nothing is more disappointing than a goal achieved. We say to ourselves "Ah well, that was only that?".

And a few weeks ago I came across an old book from Kalmbach, titled "Model Railroading with John Allen - The story of the fabulous HO scale Gorre & Daphetid Railroad". There we are told that every Friday John Allen gathered at his house some friends who had come to drive according to very strict and prototypical rules the trains of the fantastic layout on which he had worked for twenty years (authentic) and to drink coffee. He was a reasonable man. Realizing that coffee would not be enough to keep up the company's enthusiasm (some bourbon might have helped, though...) he had imagined the peddlers, freight trains whose starting and ending points were randomly chosen and changed from one session to the next. And these trains had to use constantly changing routes, avoiding scheduled trains and other peddlers.

Which made me think about some bourbon (not more than a few glasses, thank you) and the possible use of randomness in Trainz.

Can we have some randomness in Trainz? Why, of course ! We can define session variables and give them random values. We can show or hide layers. We can make rules conditional, dependent on one another (indentation) and organize them into lists. Emulating John Allen's peddlers doesn't seem possible, but we should still be able to do a number of fun things, don't you think so?

And then, to make this programming, because it's nothing else, a bit more elegant and more manageable, perhaps some expert could develop a rule that programmatically launches one session or another according to the values of a random variable? Which means that several sessions can work simultaneously, but it seems to me that it's already possible...
I think what you want to achieve is possible. The driver schedules will have to be complete, and some driver rule is needed to call this up and give the drivers instructions. This will be similar to the Schedule Library and the Copy Commands from associated driver command.

When this driver-rule and command is implemented, the AI drivers will then they will perform whatever tasks, meaning schedule we've given them as they do normally except for this where they will be random schedules.

The reason for adding the special schedule command is because we don't want all drivers to do random things because they may be on some other side of the route and we don't want them to be assigned some task forcing the AI to drive across the route to the other side. Imagine a driver that normally pulls a freight on one end of the route that's coupled to a train that's sitting on the mainline, gets pulled away to do some switching. Leaving the consist behind is no option either because that would live a string of freight cars blocking the mainline.

As far as programming goes, I'm no programmer and this all sounds fully plausible and possible in my head!

Have no fear of route building becoming boring and stale because a route is never finished. Like a model railroad, there's always something to fiddle with. I've been working on my own huge route since January 2004 and it's still a WIP, and always will be. There are old parts that are currently being renovated and replaced and there are some newer parts that are being worked on. With a route this size, it's easy to switch tasks and do something else. When I'm tired of working on one area, I'll visit another or even drive the session I setup for the route that covers a good portion of the "finished parts" of the route. Trainz is more like hunting for the Yeti because we never completely finish a route. Even those that are released for sale or are on the DLS could still be modified in some way to finish them off to our taste, or perhaps be merged if it's a DLS or third-party pay-ware route, or maybe even tweaked in some way to make the route our own.

I only create AI sessions and make extensive use of randomness in them. There are a number of ways to add randomness to a session including Enhanced Interlocking Towers, "Wait For Random" driver command, and portals.

Most portals allow you to set up a list of different consists and their commands and they give you the option of selecting to either produce trains in the order that you have entered them or to select one randomly from the list. There are also a couple of rules that enable you to place a trackmark anywhere on the route and use that as a portal. There are two of these rules that I know of called "Un-portal" and "Un-portal 2".

"Un-portal" produces trains like any other portal with the consist moving while "Un-portal 2" places a stationary train on the route wherever you want it. Just make sure that there is enough space for the whole train to be placed as if the train is too long for the available space it won't appear. I use Un-portal 2 to place trains or items of rolling stock in yards and sidings, Any consist being placed has to have a loco attached to it so if you just want the rolling stock on the siding the first commands in such consists are decouple the loco and then delete it, This leaves a consist of wagons or coaches on the siding that can be used by any other train or just left there as eye candy. If you want the siding left empty sometimes just make one of the consists one loco and make the first command delete.

I use "Enhanced Interlocking Towers" and the associated rules and driver commands to get trains through the route and into and out of yards and stations. Using these a train can randomly select a vacant siding in a yard or platform in a station.

All these things can produce quite a bit of randomness on a route either on their own or in combination. However by using variables and the Schedule Library you can create much more randomness. I generate a random number between 1 and 20 (gives 5% increments) and use this number to decide which schedule should be copied into the consist schedule. Getting the mix correct is down to trial and error.

I hope that this has given you food for thought.


Many thanks to you both.

John, you're absolutely right : the sheer size of a large and above all extendable route can keep us busy for ever and ever. And your remarks about the Schedule Library are extremely useful and have already got me thinking. After all, I can use randomness in a large route, right?
Brian, I had do idea that Interlocking Towers could be so useful in such a way. And with the Schedule Library you have re-created John Allen's peddlers, no more, no less.

Best regards,