Page 3 of 3

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 8:51 am
by Prymal
Nice mockups. Perhaps a slightly different arrowhead for chain and rail signals would help as well. Possibly an arrow similar to the fast-forward style, where it has a second set of rear points behind the first? That might help players realize that trains will wait behind that signal until they can get to the next normal style arrow.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 9:49 am
by ickputzdirwech
[ick] Merged with two additional older posts about the same suggestion.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 1:43 pm
by Irrehaare
Ok, after like 12 hundred hours in Factorio I've created an account to post here, after finding the thread in reddit.

I like the idea and I seem to not be the only one. Could someone more experienced in modding suggest how difficult would that be to make?
A) arrows?
B) would dashed lines after chain signals be possible? Or no, because there can simultaneously be chain and normal signal leading into the same segment?

Would such project be a good one to start the adventure with Factorio modding?

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 5:44 pm
by Impatient
Irrehaare wrote: Sat Sep 11, 2021 1:43 pm
Forget about it. The modding API is not made for this. Track sections might not be accessible at all through the API.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 8:31 pm
by Silari
Impatient wrote: Sat Sep 11, 2021 5:44 pm
Irrehaare wrote: Sat Sep 11, 2021 1:43 pm
Forget about it. The modding API is not made for this. Track sections might not be accessible at all through the API.
There are some calls to work with them, like https://lua-api.factorio.com/latest/Lua ... egment_end


You can't change the overlay with the modding API, but you maybe could find all rail/chain signals and use LuaRendering to draw the appropriate arrow between the signal and the rail it is connected to.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 9:00 pm
by mrvn
Silari wrote: Sat Sep 11, 2021 8:31 pm
Impatient wrote: Sat Sep 11, 2021 5:44 pm
Irrehaare wrote: Sat Sep 11, 2021 1:43 pm
Forget about it. The modding API is not made for this. Track sections might not be accessible at all through the API.
There are some calls to work with them, like https://lua-api.factorio.com/latest/Lua ... egment_end


You can't change the overlay with the modding API, but you maybe could find all rail/chain signals and use LuaRendering to draw the appropriate arrow between the signal and the rail it is connected to.
That would be a total performance kill. Never find all unless it's a migration.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 10:07 pm
by dabalciunas
Ok devs, please help us with this one... a mod is definitely not the solution here.

The following reddit thread shows how much this feature is missing in Factorio:

https://www.reddit.com/r/factorio/comme ... _of_train/

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 10:29 pm
by mrbaggins
Impatient wrote: Sat Sep 11, 2021 5:44 pm
Irrehaare wrote: Sat Sep 11, 2021 1:43 pm
Forget about it. The modding API is not made for this. Track sections might not be accessible at all through the API.
This doesn't require accessing track sections, for a quick mod that gives just the arrows.

Find any signals, use a look up table to work out the offset for an arrow, draw an arrow pointing the right direction at that offset. Matching colours requires knowing the block colours (probably impossible currently) but is only nice, not necessary.

Performance requires finding signals in the chunks near the player, and only while holding signals.

Ideally devs simply change the display of the -------||----------- block display to be ---------->|----------- instead.

Re: improve train block overlay: add directions

Posted: Sat Sep 11, 2021 11:31 pm
by Impatient
Really, I don't think any of those solutions would cut it. Do you know that for the arrows to draw, you would need to analyse the whole track network? You could have a track, with one signal on one side of the map and the 2nd, which makes it a two-way section, on the other side of the map. IMO - although it is possible to make such an algo in lua - it is very unrealistic.

But I don't want this to turn into a trench fight here. Just stating my opinion.

Re: improve train block overlay: add directions

Posted: Sun Sep 12, 2021 4:48 am
by Prymal
The direction of a track is determined at each signal, there is no need to look any further than the other side of the track segment to determine if that piece of track is single- or bi-directional. The reality is that tracks are not directional, that limitation is imposed by the signals themselves, and evaluated at each signal independently. Therefore, a path may be broken by a missing signal far down the line, wherein the track becomes impassible in a particular direction, but that doesn't affect the nearby signaling. This would not become a problem anywhere except long unbroken sections of entirely chain signals, which would be the only way a train would wait a long ways off from a path break due to a signaling error. Even in such a case, finding the break should be easy enough, if one investigates the route ahead of the stopped train. I've included a rudimentary diagram to help illustrate, in case my explanation was confusing. Note that the center junction only has one signal, and thus left to right traffic will halt, while right to left traffic will be permitted. The missing signal has no effect on travel through either of the outer junctions.

.....S.....S..........S
==><==|<====><==
.....S.................S

Re: improve train block overlay: add directions

Posted: Sun Sep 12, 2021 10:32 am
by mrvn
A few thoughts:

- To draw the arrows for blocks you only need to walk along the rails until you find the next signal, not the whole map. And signals are usually not that far apart compared to the map size.
- You could catch signals and rails being build and calculate blocks in lua (in the background, doing a bit of work every tick). Displaying it then is basically a table lookup. Advantage of this would be that you could give global alerts for broken blocks.
- I'm not sure all broken blocks are broken. Maybe some rail networks have intentionally broken blocks for some signaling / combinator magic? But I guess a mod could simply have an option not to give a global alert on broken blocks.

I think it would be really nice to have this in the game engine directly, including detecting broken blocks. Seems like a lot of work for a mod to do for something the game engine already does internally, just not display it. The path finding should be able to generate broken block alerts as a side effect of a train trying to path through it. So it shouldn't even add lag. The downside of using the path finder would be that you only get an alert when a train actually tries to path through there. But given the amount of path finding done I'm not worried a broken block would be missed long.

Re: improve train block overlay: add directions

Posted: Sun Sep 12, 2021 10:14 pm
by Irrehaare
I've had a busy weekend at work and had no idea what discussion have I sparked. Though you people have surely answered my question: it is not a good idea to learn modding with that. That's disappointing, a I'd be very happy to have this feature.

OT: if you want to learn about modding ...

Posted: Sun Sep 12, 2021 11:34 pm
by mrvn
removed because OT

Re: improve train block overlay: add directions

Posted: Tue Sep 14, 2021 10:28 am
by ssilk
@Irrehaare, mrvn: Please discuss this in another thread or via PM, this one is about the directions of block overlay.
(which is indeed a good idea)

Re: improve train block overlay: add directions

Posted: Fri Sep 17, 2021 11:55 am
by dabalciunas
Yeah... I would really, really enjoy this feature!

Re: improve train block overlay: add directions

Posted: Sat Dec 04, 2021 12:52 pm
by ickputzdirwech
[ick] Merged with yet again another even older thread about showing directions when placing signals.

Re: improve train block overlay: add directions

Posted: Thu Nov 09, 2023 1:58 pm
by sparr
Implemented in 2.0?

Re: improve train block overlay: add directions

Posted: Thu Nov 09, 2023 3:24 pm
by Koub
[Koub] Indeed, nice catch, moved to "Implemented for 2.0"