A solution might be to call for the loading of all ATLS Controllers if I can find them via GetGameObjectByID() or it may be possible to set ATLS to work through a Library where info can be stored. The latter being a kinder option!
As Pierre indicates, the library approach is a good option. The main thing that I would add is to point out that most scenarios don't actually require you to keep objects loaded once you've performed any initial setup. A route with 1000 signals might only have 50 in active use. Certainly, those 50 might be spread out over the entire route, depending on the location of the various Trains, but that's still a massive saving.
I can envisage such a library working like this:
* It is created in Surveyor.
* Upon creation (NOT just any initialisation), it begins (asynchronously) searching for specific object types.
* If necessary, it requests that the objects are loaded so that it can query information from them. This should only be performed where strictly necessary, because it will be time-consuming. You should expect that your ability to stream in objects will be rate-limited. In many cases, knowing that the objects exist may be enough, and you can postpone the detailed queries until a later time.
* Once you're done querying the objects, you store the GameObjectIDs where necessary, and release any references to the objects themselves. It's important to note that holding a reference to an object will NOT prevent it from being unloaded while your code is sleeping, so this is more for your protection than to optimise streaming.
* You use the async search APIs to monitor for changes, and update your stored data as necessary.
* You save and load your data in the library properties, rather than recreating it on each load.
* If you need to monitor existing object types, you use Sniff() via the GameObjectID rather than trying to use object references which may or may not exist, and may or may not remain valid.
* If you need to monitor custom object types, you might consider having them place library calls directly rather than passing messages, but either approach may be reasonable.
The 2[SUP]nd[/SUP] issue is the way I play Trainz. I don’t just have one train I am watching to follow a pre planned scenario. I write my own AI for a route so lots of trains drive on their own. Thus I might be (say) driving a train in one area of the route and I would expect maybe another 100 trains elsewhere on the route to still be running, controlled by that AI. These trains may be hitting Triggers that again may not be there and trying to talk to items on the route that also are not there. So when I jump 50k to another part of the route, instead of things having run happily while I’ve been away, they are now going to be in a mess. Is that assumption correct or will script still run and trains still be plotted in remote areas, just without graphics?
Trains will still run wherever necessary, and the simulation will stream in any required data to make this happen. There are various triggers for streaming; this is build specific, but for example:
* We stream in the data immediately surrounding each Train.
* If a TrackSearch is performed and terminates due to reaching unstreamed data, streaming is triggered. This means that future TrackSearches will eventually receive the required data. In the case of Signals, the system is smart enough to re-evaluate the Signal logic when this occurs.
One thing that the streaming system does NOT know about is random objects placed around the route which might attempt to influence things far away. For example, if you create a tree scenery asset with a script which causes all Trains to stop moving when it is initialised, it is undefined at what point that will occur. In short, don't do that. Any logic which needs to be globally active should be in a Library or Rule instead.
chris