Path Cost Multiplier on Rail entities

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Path Cost Multiplier on Rail entities

Post by justarandomgeek »

Adding a path cost multiplier to the rail entities would allow mods to make more(/less?) expsensive rails for pathing purposes. This would allow trivially building a mainline with express/local lanes and periodic ramps on/off the express lanes, for example, simply by using higher path cost rails on the local lanes.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Path Cost Multiplier on Rail entities

Post by Nexela »

Allowing the pathfind_penalty to be set on rail prototypes (signals, stations, rails themselves) Would be pretty awesome. (don't forget to make it readable on luaPrototypes)

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by bobingabout »

I had an interesting experience driving a train in my game recently. I needed to AFK so drive my train just past the light of a junction and stopped... to have an automatic train drive right up to that signal and stop... even though there was another path going around the lane I stopped in.

This basically tells me that player driven trains didn't have a high enough penalty set.

edit: and I just realised that this isn't what the topic is about. oh well, I'll leave this here anyway.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by Choumiko »

Since i imagine it being fairly costly to do for rails (don't know much about the pathfinder internals) how about having the penalty for trainstops being adjustable via a mod (maybe even only as a prototype and not necessarily changable runtime) Right now the pathfinder has to check for trainstops on the path anyway. Then someone could make a "trainstop" that looks like some sort of sign besides the track.

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by justarandomgeek »

Choumiko wrote:Since i imagine it being fairly costly to do for rails (don't know much about the pathfinder internals) how about having the penalty for trainstops being adjustable via a mod (maybe even only as a prototype and not necessarily changable runtime) Right now the pathfinder has to check for trainstops on the path anyway. Then someone could make a "trainstop" that looks like some sort of sign besides the track.
Comments from Rseding on IRC suggested it would be fairly trivial, but needed a proper request ;)

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by Choumiko »

Ok then :D Guess i should go back to hanging around on irc

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by ratchetfreak »

justarandomgeek wrote: Comments from Rseding on IRC suggested it would be fairly trivial, but needed a proper request ;)
The only issue is that too many penalties on the track could make the search very expensive as every penalty that needs to be crossed forces the path finder to expand more paths until it searches beyond the penalty

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: Path Cost Multiplier on Rail entities

Post by justarandomgeek »

ratchetfreak wrote:The only issue is that too many penalties on the track could make the search very expensive as every penalty that needs to be crossed forces the path finder to expand more paths until it searches beyond the penalty
So use small modifiers? You shouldn't need much to make a local/express distinction, for example, just a few points of penalty so that the express is consistently "shorter" for long haul trips.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Path Cost Multiplier on Rail entities

Post by Rseding91 »

bobingabout wrote:I had an interesting experience driving a train in my game recently. I needed to AFK so drive my train just past the light of a junction and stopped... to have an automatic train drive right up to that signal and stop... even though there was another path going around the lane I stopped in.

This basically tells me that player driven trains didn't have a high enough penalty set.

edit: and I just realised that this isn't what the topic is about. oh well, I'll leave this here anyway.
Most likely the train determined it's path long before you stopped the train along the area it wanted to drive.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding interface requests”