I took up the idea of player coupling in AI shunting. The following is a preliminary report more than a finished tutorial.
What worked was an AI train arriving and shunting without player intervention at the front end while a station pilot shunted at the rear end, with the user jumping in for the coupling. At the end, the player coupled the train engine with the wagons it had picked up to the train the station pilot prepared and it left.
What did not work was another train passing through after the first train left. AI just got nuts there and I have not pinned down why exactly.
Summary of the findings:
- You can have complex AI shunting if you do almost all the coupling.
- You do it in a free roam scenario where AI does everything, but pauses for the coupling.
- Taking over more of the shunting duties spontaneously can be a mixed bag of experiences.
- The only thing to avoid is picking wagons from the end of a train while its engine is still coupled to the train.
- Changing to train spotting mode (with all active trains being AI) is done by placing a dummy engine nearby.
The details:
- AI can couple to stock at its initial location unless there was a player intervention on the train end concerned.
- If you couple a wagon to an engine (in player mode), then make it go on as AI (which is ok), and the next thing is coupling a different wagon in its original position to the wagon you coupled to the engine, the engine will crash into that wagon if in AI mode as the wagon you coupled first is invisible to it.
- It is no problem to have AI pick up several wagons at their initial location without player intervention.
- This leads to the rule: Once coupled by player, always coupled by player.
- There are two exceptions to the rule: What you couple to one end does not influence the other end at all. And AI coupling may work again after you detached all you coupled to the engine so it the consist has its initial length again. But I have not tested that yet.
- As a scenario author, place a stop-at instruction where the player takes over.
- If you don't want do turn the scenario into an arcade game, add a stop-at instruction with a generous waiting period near the place where the next coupling by the player is due.
- If you want to show an alert to the player telling him what to do, you need to double up the stop-at instruction. First, you stop at that marker for 1 second, then you show the instruction using trigger event, third comes the mandatory stop-at instruction with a decent duration. Even if you postulate that the player has to click on the engine within 10 seconds, it is a good idea to let the duration of the second stop-at instruction reflect the estimated duration of the coupling act performed by the player. This keeps the expectations of the AI in sync with the player action, to a degree.
- As a player, you may want to wait until the engine is stopped there, or take it over as it approaches.
- It is possible to take over the AI train approaching the place of coupling, before it stops at the marker for the stop-at instruction. However, beware of the initial position of the handles, which can be surprising.
- The instruction shown by the trigger event will pop into your face while you approach the wagon to be coupled. Luckily it is semitransparent.
- After you coupled to a train, start the movement that follows and do not hand over control to the AI before the train left the marker where you took over.
- You can unlink the camera using key 8 to stay where you want.
- If you click on another train too early, AI may fall out of a time hole and resume action where you took over, driving back to where you coupled. Or it stops dead in its track.
- Whenever I left a train outside the marker where I took over (and running away from it), I always found AI duly proceeding to the next item on the order list.
- Taking over more than just the coupling and restarting can lead to mixed results. In my experience, the AI signaller changed the switches for the AI driver more willingly than for the player. Handing over the train to AI when the path does not get set right made the AI driver return to the stop-at instruction where you took over before, but at least I was able to send it away then, and after that, it resume service as it should.
- Remember that the AI wants fixed actions taking place. The more player intervention, the greater the chances that one or the other AI driver just walks away in frustration.
- If you couple to any consist that includes an engine, that engine becomes a wagon, or non-powered engine.
- This is not a problem if you want the joined train to leave to its destination in this configuration, e.g., you couple a banker to the train and they continue their trip.
- If you couple a station pilot to the rear end of a train, uncouple the train engine first.
- Move it a few metres forward to give the player some leeway. If the wagons get pushed against the train engine due to rough coupling by the shunter, the scenario is spoilt.
- The train engine must be coupled back to the train by the player after the station pilot left.
- Fetching water might be a prototypical excuse for the uncoupling. Uncoupling from a long train helped the driver stop precisely at the water crane and before the time of air brakes in freight trains, it was not a big deal.
- Inventing some shunting duties at the front end is another option.
- To change to watching only, you need a dummy engine nearby.
- This engine has a driver icon, but no destination, and no orders.
- You are free to move it about if you like, but be sure that it does not interfere with any moves.
- Since flying is cheap, I prefer this engine to be stapled somewhere nearby, never driving it.
- If you are sure you cannot find a spot in your station where you can staple that engine, create an engine that looks like a wagon, by adapting the copy of an engine's .bin files to the shape of a wagon, removing controllers and particle emitters. However, details on this is would fill an essay of its own.
- The scenario ends when the train which is the current player train reaches its destination.
- Just be sure to get out before.
- It is a good idea to give all trains (except for the dummy train) a final destination that takes them a bit away from the scene of action. When you leave them, you should not need to worry about it any more. I.e., it should not be a problem if AI just sends them home.
- Avoid crossing paths where the player is involved as much as possible.
- Paths of AI trains crossing each other are not an issue.
- Simply wait for the AI train to arrive and the AI station pilot to draw near.
- An AI train that passes through the station after all the shunting is done and the first train left and the station pilot has withdrawn may be a candidate for trouble. AI is as intelligent as always. Don't expect wonders. Deviations in the timing can shock that last AI train and the scenario may well end with a sour note.
- That said, did try it. What happened was surprising. The station pilot operating on the end where that next train would approach started to behave totally nuts. To irregular to make it worth a description. As soon as I took the driver icon from that next train, everything was fine again. And I refer to stupid things happening in minute 2 of the scenario when the departure time of the disturbing next train was in minute 6. So there was absolutely no reason to apply.
So that other train needs more research. I did double up outer home and advanced starter there so the moves of the station pilot were isolated by two block signals in either direction from the waiting AI. The next train had lowest priority, of course. And I moved trains after the changes and reloaded route and all that.
But the layout was quite dense, so I need to explore the effect of space on AI panicking. Some people swear by splitting and rewelding track between signals although I never saw a difference myself. Anyway, I will not give AI more hiding place than the usual distance between inner and outer home and maybe start it a block away. Because if that next train does not show up soon after the first left, no one wants to wait for it anyway.
Notwithstanding this last issue, I guess that a lot of fun can be had with this method for those who prefer to watch a scene unfold, and those who want to run the station pilot.
In the later case, getting the issue with that next train fixed would be great since yon then can shunt one train after the other, even if they arrive on the same track. On double track, you can always have the second train arrive in the opposite direction, if you don't touch that path while shunting the first train. But this, too, might be difficult to achieve in many layouts.