Page 1 of 1
Allow wildcards in interrupts
Posted: Sat Oct 26, 2024 11:12 am
by DeadMG
TL;DR
Allow the player to define complete routes in an interrupt rather than one interrupt for each part of it.
What ?
The basic problem with interrupts is one of timing. You can tell the train not to do something if the station is full. The problem is that you can't express something like "the (item) unload station corresponding to the (item) load station you want to go to, is not full". By the time you can ask whether the station is full, it's too late. You have already loaded the cargo that you want to unload but the unload station is full.
I suggest that the player should be able to use wildcard (any) signals in train station names- these are already available as signals but I believe has no special meaning. They would now match the station name. When evaluating the interrupt it would have one fixed value for all conditions/stations. So for example, you would define an interrupt as conditions: (any) load not full, (any) unload not full, cargo empty -> go to (any) load until full cargo, go to (any) unload until empty cargo. This would mean the train can't leave to load items until the unload can accept them.
Why ?
This allows the player to set conditions on the whole proposed route at once. It basically eliminates the need to have tons of trains sitting around in provider stations loading goods they can't unload.
Re: Allow wildcards in interrupts
Posted: Tue Nov 05, 2024 6:42 am
by AileTheAlien
DeadMG wrote: ↑Sat Oct 26, 2024 11:12 amthe train can't leave to load items until the unload can accept them
This right here is what I was trying to make, when I found out that interrupt wildcards only match inventory.
DeadMG wrote: ↑Sat Oct 26, 2024 11:12 amthe player should be able to use wildcard (any) signals in train station names
I think this is the only missing piece? Or rather, a replacement, since I don't think it would make sense to try and match on both. Maybe the UI would need a toggle, to match on inventory or match on train station name? I found a different thread that conceded that some people might want to only match on cargo, but I can't find it anymore.
DeadMG wrote: ↑Sat Oct 26, 2024 11:12 am
TL;DR
Allow the player to define complete routes in an interrupt rather than one interrupt for each part of it.
I think this is phrased poorly, or I'm misunderstanding. You can already define multiple stations for the train to visit in an interrupt.
Re: Allow wildcards in interrupts
Posted: Thu Nov 07, 2024 12:04 am
by AileTheAlien
In
this other thread, it's explained that wildcards are only filled when leaving a station. I also show a proof of concept, that allows you to send trains to wildcard stations and keep the icons in your station names.
(So we don't need to add any new features to solve this problem.) EDIT: It's a hassle to schedule trains without this feature. See my next comment.
Re: Allow wildcards in interrupts
Posted: Fri Nov 08, 2024 5:52 pm
by DeadMG
I'm aware of various circuitry attempts to solve thiis problem, but I don't think they're a real replacement for a native solution, just like how you could previously do circuit solutions for train priorities, but the devs added a native solution anyway.
Re: Allow wildcards in interrupts
Posted: Thu Nov 28, 2024 5:53 pm
by AileTheAlien
DeadMG wrote: ↑Fri Nov 08, 2024 5:52 pm
I'm aware of various circuitry attempts to solve thiis problem, but I don't think they're a real replacement for a native solution
OK, I'm once again trying to implement trains in my game, and
now I really want this feature. (I've been scribbling on notes, and desperately trying to think up solutions before I fall asleep.) Even though it's relatively straightforward to send a specific train to a specific cargo or fluid station after you've got your signals figured out for deciding what trains to send,
this whole situation is a hassle because of how many other steps there are:
- Wire up all train stations to radar, with one color for requests and one color for supply. (For example, red for requests, because red is often used for debts in accounting.) Their signal should be the number of full trains that they have room to request or supply, for that specific item or fluid.
- Add an arithmetic combinator at each supply station, to reduce (or zero?) its train limit if no stations have requests for that thing.
- Add an advanced combinator at your train-yard, that picks the largest request signal. (That is, the thing you need delivered most.)
- Add your signal-interrupt, that's for trains to go to a specific supply-station. (Like this.) Add the request-station after the supply-station in the interrupt. (You don't need to check the train's contents with the item- or fluid-wildcards, since you already know you're going somewhere that has enough supply, and there's enough demand.)
- Add...some kind of clock signal, to only send out one train for that resource at a time. (Since trains will reserve a spot in a station's train-limit, if you accidentally try to send out 10 trains for iron at once and only have room for 3, you'll have 7 no-path trains that are possibly stuck, clogging up your tracks.)
...I think that's it? I still haven't finished building this to test it. I'm about 90% sure it'll work, and 70% sure it'll work but I'll have bugs to fix.
PS
I'm pretty confused right now, as to how the item-wildcard or fluid-wildcard was meant to be useful. Like, we're supposed to want item icons in our request station names, but supply-stations are supposed to all be named without an icon? So gross!
EDIT:
OK, I forgot that train stations can output the number of trains that are on the way (plus a train at the station). So...that goes somewhere into this mess as well.
EDIT 2:
This comment in another thread, links some videos that explain how to do generic trains. It goes through the problems with too many trains fulfilling a request, generics, etc. And it verifies my assessment, that fulfilling requests for stations with icons in their names is a big hassle!