Railway and Rail Segment controls
Posted: Sat Jun 10, 2017 11:47 pm
Factorio trains are one of the best parts of the game (IMHO). Let modders contribute more! It would be awesome to expose more of the pathing algorithm used by trains.
Specifically, I would love to be able to:
-Combine two rail dead ends together logically (IE, for pathing algorithms) (including which path to take and when to slow down). The actual movement of the train between the two dead ends would be handled by the modder OR automatically taken care of via teleportation.
-Manipulate the weight of a piece of rail (or rail segment) for the purpose of pathing algorithms (including which path to take and when to slow down).
-Get a list of every rail segment on a layer(?)
- An api for rail segments might look like:
- A list of pointers to the straight rail and curved rail entities included in the segment.
- A list of pointers to the rail signals marking the beginning(s) and end(s) of the segment (Perhaps two lists: one for start, one for end)
- A list of pointers to bordering rail segments
- The total weight of the segment (not including modifiers from red signals etc...)
-An api for straight/curved rail might look like:
- A pointer to the rail before
- A pointer to the rail after
- A list of pointers to rails that cross this piece of rail
- The train stop attached to this piece of rail
- List of rail signals attached to this piece of rail
- length
- Pathfinding weight multiplier
It would be especially awesome if all of this could be done in such a way as to be independent of the layer(?) that the entities are on.
The general end goal I'm personally trying to reach is creating an underground tunnel mod, similar to an underground belt but for trains. Potential would also include being able to create preferred lanes of traffic for trains (by reducing/increasing the pathing weight of rail/rail segments). It would also allow for trains to traverse across multiple layers, in case anyone wanted to make a mod involving underground mines and wanted to allow trains to go up and down to different levels of a mine. I'm sure there's other good use cases of such interfaces.
Specifically, I would love to be able to:
-Combine two rail dead ends together logically (IE, for pathing algorithms) (including which path to take and when to slow down). The actual movement of the train between the two dead ends would be handled by the modder OR automatically taken care of via teleportation.
-Manipulate the weight of a piece of rail (or rail segment) for the purpose of pathing algorithms (including which path to take and when to slow down).
-Get a list of every rail segment on a layer(?)
- An api for rail segments might look like:
- A list of pointers to the straight rail and curved rail entities included in the segment.
- A list of pointers to the rail signals marking the beginning(s) and end(s) of the segment (Perhaps two lists: one for start, one for end)
- A list of pointers to bordering rail segments
- The total weight of the segment (not including modifiers from red signals etc...)
-An api for straight/curved rail might look like:
- A pointer to the rail before
- A pointer to the rail after
- A list of pointers to rails that cross this piece of rail
- The train stop attached to this piece of rail
- List of rail signals attached to this piece of rail
- length
- Pathfinding weight multiplier
It would be especially awesome if all of this could be done in such a way as to be independent of the layer(?) that the entities are on.
The general end goal I'm personally trying to reach is creating an underground tunnel mod, similar to an underground belt but for trains. Potential would also include being able to create preferred lanes of traffic for trains (by reducing/increasing the pathing weight of rail/rail segments). It would also allow for trains to traverse across multiple layers, in case anyone wanted to make a mod involving underground mines and wanted to allow trains to go up and down to different levels of a mine. I'm sure there's other good use cases of such interfaces.