Page 1 of 1

Train Schedule Condition on Signal Matching Train ID

Posted: Fri Jul 05, 2024 4:12 pm
by AkBKukU
TL;DR
Add a train schedule condition for a signal matching the train's ID.
What?
I was re-reading the train schedule FFFs while working on a complicated train stop concept in 1.1 and had an idea. It would be powerful to be able to have train interrupts trigger when a signal matches their Train ID. It would technically be possible to do this manually from what has been shown so far by hard coding the Train ID as a constant after reading it, but that wouldn't be practical at scale and would break groups.

With radars now passing signals across a surface it would be trivial to have every depot connected to a surface wide train signal network giving access to every idle train through circuit signals. It would be possible to call specific trains to stops, like personal transport trains. Another use would be the ability to increment a counter to go through every train ID (depots could update min/max known IDs by reading them) to call every train to a stop one by one, I've done this during fuel changes in a much worse way before.
Why?
Here's an expanded example on the personal transport train idea in particular since it seems like that might be the primary means of transportation between islands on Fulgora initially. In multiplayer you could have a group of transport trains where each player has a dedicated train. In 1.1 each train needs to have the ID hard coded as part of their schedule. At outposts each player could have a dedicated stop for their train with the train ID signal sent when they want to access it. Here's a practical demonstration of this: https://youtu.be/9uf73ktEDvA

Adding the train ID condition to trigger an interrupt would allow both the red and blue trains in this example share a schedule in a group. So all transport trains could be manged together, but still accessed independently.

I'll admit this likely has limited applications and I'm getting ahead of the 2.0 update. But I figured it might be easier to get something like this added before release rather than after.

Re: Train Schedule Condition on Signal Matching Train ID

Posted: Tue Jul 09, 2024 3:50 pm
by robot256
My initial reaction is that I dislike anything that depends in train ID. Train IDs change whenever the wagons in it change, or one gets destroyed, or it goes through a SE space elevator or other surface teleportation, etc.

In your example, why is it important that the personal trains have the same schedule but be assigned to particular people? Do the players need to remember the ID number of "their" train? If the trains are different they should have different schedules; if they are the same then it shouldn't matter who gets what train.

I have a different suggestion for "calling" a personal train. Set the train limit of every stop to zero, and let the player set it to 1 briefly to request a train. The personal trains would go to a depot where they wait for a spot to open up at an outpost. If you really want each player to get a specific train, and you don't mind the chance for a collision if players request on the same tick, then you could transmit the "depart depot" signal to your player's train at the same time you change the outpost train limit to 1. Each train would either need a schedule specifying a different signal to receive or a specific depot spot wired up for that player.

Re: Train Schedule Condition on Signal Matching Train ID

Posted: Wed Jul 10, 2024 9:03 pm
by AkBKukU
robot256 wrote: Tue Jul 09, 2024 3:50 pm My initial reaction is that I dislike anything that depends in train ID. Train IDs change whenever the wagons in it change, or one gets destroyed, or it goes through a SE space elevator or other surface teleportation, etc.
I did not realize the IDs were so fragile, that would make it more difficult to use. I assumed it was at least somewhat stable since you can read it with the train stops. That may not be a problem in all cases though.
robot256 wrote: Tue Jul 09, 2024 3:50 pm In your example, why is it important that the personal trains have the same schedule but be assigned to particular people? Do the players need to remember the ID number of "their" train? If the trains are different they should have different schedules; if they are the same then it shouldn't matter who gets what train.

I have a different suggestion for "calling" a personal train. Set the train limit of every stop to zero, and let the player set it to 1 briefly to request a train. The personal trains would go to a depot where they wait for a spot to open up at an outpost. If you really want each player to get a specific train, and you don't mind the chance for a collision if players request on the same tick, then you could transmit the "depart depot" signal to your player's train at the same time you change the outpost train limit to 1. Each train would either need a schedule specifying a different signal to receive or a specific depot spot wired up for that player.
Using storage in the train for more building materials would be one. And on Fulgora specifically with the demonstrated scrap mechanics I could see your character inventory getting cluttered easily.

Your question about the IDs and suggestion are covered in my example video where I showed the trains departing based on a unique signal. The train stops do share a name and when the player walks through a gate the stop's train limit is increased and the train paths to them. This could be done now in 1.1 as I showed in the video. But as you mentioned, each train would be unique and not share schedules.

As for why they should have shared schedules, I've done large rail bases and managing train schedules is always a pain point. Having that be as simplified as possible helps. Additionally, when you play multiplayer sometimes it can be helpful to have one person control the train "API" and that is a lot easier to do when all the trains can be kept in sync with schedules. It's obviously possible without, but once schedules are in the vanilla game I can't imagine not having every train in one.

The thing that spurred on my suggestion here was unrelated to player trains. I was attempting to design a multi-resource train stop and getting trains to only come to it when needed seems like it might be impossible in 1.1. When mulling over 2.0 though, the idea of being able to call specific trains by interrupt felt like a solution to me by realizing I could have the depot manage tracking what trains are waiting with materials using circuits by ID. Then if a multi-stop needed something the depot could signal that the resource is available to the stop so it can enable the stop, and send the ID of the train to it to trigger the multi-stop interrupt for it only. There may be other ways to do this with interrupts and signals that we can figure out after release, but the idea of also being able to signal a specific train did feel helpful.

Re: Train Schedule Condition on Signal Matching Train ID

Posted: Wed Jul 10, 2024 9:10 pm
by robot256
It would actually be trivial to do with a combinator blueprint. Each train waits for a "green" signal to be received (in an interrupt or otherwise), and each depot stop sends its "T" train ID to a separate decider combinator on e.g. individual green wires. All the combinators also receive the "R" signal from a common red wire, and output "green" to the stop on a short red wire if "T == R".

Train IDs are used extensively by mods, and we use events to track when they change. That Train IDs are available via the circuit network allows for some interesting functions but it does rely on the train never changing. Usually I only use the train ID signal to tell whether any train is there or not (since it is present even if the train is empty)