Request on Rail Tracks

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Request on Rail Tracks

Post by TheSAguy »

Would be great to have the following features added to Rail Tracks.

Variable to determine train speed. So you could have different types of track for fast or slow freight. Or cheap track, but slow speeds and expensive track, but high speeds.
Variable to determine cargo wagon load max. So you could have different tracks support different size cargo wagons.
Variable: conduct power (Y/N). Have rail track conduct power. Could have electric trains and power for outposts.

UPDATE 6/19/17:
Could we please get an "Acceleration" or "Top Speed" multiplier added to rail?

Thanks.
Last edited by TheSAguy on Mon Jan 08, 2018 7:14 pm, edited 3 times in total.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Request on Rail Tracks

Post by TheSAguy »

Bump.

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

Re: Request on Rail Tracks

Post by bobingabout »

So... bullet point list.
  • Rail speed limits
  • Powered rail options
  • Vehicle type limitation
    • Could be achieved in reverse, by using a track type limitation array on the vehicle, rather than a single entry
They all seem like very good options, I mean, currently a locomotive is capable of being set to Electric powered, but there's no way to get the power to the vehicle.

The other 2 seem like a very small, yet powerful change (Trains already have a speed limit of the slowest locomotive/wagon in the train)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Request on Rail Tracks

Post by TheSAguy »

Request for .15 please.
Thanks.

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

Re: Request on Rail Tracks

Post by Rseding91 »

What you're asking for are gigantic changes to the rail system at its core. Not something that can be done quickly and would most likely introduce a large amount of bugs.
  • Making trains use information about the rails they're driving on means they need to keep re-scanning them (eating CPU time).
  • Making rails carry some electric network information adds a ton of overhead in storing, saving, and loading that data for every single rail that exists regardless of them actually using that ability.
  • Restricting what trains can go on what rails is also not simple as you'd then need to make sure rails didn't mix types or if they did you'd then need to go back to scanning the rails as the train moves to see if it can "go" on the next rail or not. Changing path finding to avoid rails they can't drive on making that take longer as well.
All of that accounted for I don't see the benefit of adding these things that would virtually never be utilized.
If you want to get ahold of me I'm almost always on Discord.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Request on Rail Tracks

Post by aubergine18 »

Electric trains could be charged at stations, rather than by rail; I imagine that would simplify matters as it avoids them having to check power network during travel. I always wish the train station could be used for refuelling/charging trains.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Request on Rail Tracks

Post by steinio »

aubergine18 wrote:Electric trains could be charged at stations, rather than by rail; I imagine that would simplify matters as it avoids them having to check power network during travel. I always wish the train station could be used for refuelling/charging trains.
Well the train station already looks like it will be capable of charging the loco.
But how would you Kickstart the train on empty accu between stations.
Could only be an emergency coal storage or something.

Greetings steinio
Image

Transport Belt Repair Man

View unread Posts

TheSAguy
Smart Inserter
Smart Inserter
Posts: 1449
Joined: Mon Jan 13, 2014 6:17 pm
Contact:

Re: Request on Rail Tracks

Post by TheSAguy »

Could we please get an "Acceleration" or "Top Speed" multiplier added to rail?

We now have these two on fuel types:
"fuel_acceleration_multiplier" & "fuel_top_speed_multiplier"

If we could get something similar added to the rail entity we could create different types of rail. Cheap low speed rail, or expensive High speed rail.
And any of the previous mentioned attributes listed in this thread.

Thanks.

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Request on Rail Tracks

Post by d3x0r »

Rseding91 wrote:What you're asking for are gigantic changes to the rail system at its core. Not something that can be done quickly and would most likely introduce a large amount of bugs.
  • Making trains use information about the rails they're driving on means they need to keep re-scanning them (eating CPU time).
  • Making rails carry some electric network information adds a ton of overhead in storing, saving, and loading that data for every single rail that exists regardless of them actually using that ability.
  • Restricting what trains can go on what rails is also not simple as you'd then need to make sure rails didn't mix types or if they did you'd then need to go back to scanning the rails as the train moves to see if it can "go" on the next rail or not. Changing path finding to avoid rails they can't drive on making that take longer as well.
All of that accounted for I don't see the benefit of adding these things that would virtually never be utilized.
I don't buy that it's a GITAGNTIC change or that it requires any scanning; don't trains have to know what sort of rail they are on (and whether there is a next one even?) Since they have to be able to turn/update their animation and to stop abruptly at end of the line? Or when encountering broken tracks?

Re: 'mixing types of tracks' again, it has to know if there's a next rail to go to or not already.

Oh now it makes some more sense there are two settings for fuel; only one is shown in the tooltips in game.

Code: Select all

  -- solid-fuel
    fuel_acceleration_multiplier = 1.2,
    fuel_top_speed_multiplier = 1.05,
Also considered trying to adjust the current entity stats; though this information might only exist in the prototype...

Code: Select all

    max_speed = 1.2,
    max_power = "600kW",
    reversing_power_modifier = 0.6,
    braking_force = 10,
    friction_force = 0.50,
But then could just change the item stats based on what sort of rail it was put on in the first place and ignore the 'current' track.

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Request on Rail Tracks

Post by d3x0r »

Even more evidence of not 'gigantic changes' (since 0.12.35 at least...)

script.on_event(defines.events.on_train_created, function(event) ... )

http://lua-api.factorio.com/0.15.30/LuaTrain.html
front_rail :: LuaEntity [R] The rail at the front end of the train, possibly nil.
back_rail :: LuaEntity [R] The rail at the back end of the train, possibly nil.
speed :: double [RW] Current speed.

( and get prior to get current train is on )
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity

Mods already have everything about a train's location; so certainly the game must.

script.on_event(defines.events.on_tick, function(event) ... )
-- something like for all trains, get rail they are on, update train speed.

so this can all be done outside of having extra attributes on the rail.

-----
So it could all be done in a mod; based on what other mods are loaded and their various types of tracks. And while I shouldn't be slacking so much, this is a mod I'm going to write :)

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2631
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Request on Rail Tracks

Post by steinio »

d3x0r wrote:Even more evidence of not 'gigantic changes' (since 0.12.35 at least...)

script.on_event(defines.events.on_train_created, function(event) ... )

http://lua-api.factorio.com/0.15.30/LuaTrain.html
front_rail :: LuaEntity [R] The rail at the front end of the train, possibly nil.
back_rail :: LuaEntity [R] The rail at the back end of the train, possibly nil.
speed :: double [RW] Current speed.

( and get prior to get current train is on )
get_connected_rail{rail_direction=…, rail_connection_direction=…} → LuaEntity

Mods already have everything about a train's location; so certainly the game must.

script.on_event(defines.events.on_tick, function(event) ... )
-- something like for all trains, get rail they are on, update train speed.

so this can all be done outside of having extra attributes on the rail.

-----
So it could all be done in a mod; based on what other mods are loaded and their various types of tracks. And while I shouldn't be slacking so much, this is a mod I'm going to write :)
Have fun with your on_tick FPS killer.
Image

Transport Belt Repair Man

View unread Posts

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Request on Rail Tracks

Post by d3x0r »

steinio wrote: Have fun with your on_tick FPS killer.
Thanx for the encouragement :)

How many trains should I use for load testing? This thread has 50 and it looks pretty big. I've wathced some other streamers and I doubt they have 50 trains...
viewtopic.php?t=9019&p=72388

think I should double that... going to optimize and only pay attention to trains that are moving.

62 trains (got tired of putting them on tracks, still have another 48 tracks to fill really)
0.62ms update... the trains themselves are 0.38-0.42ms
move the type they are actually on to the end of the list to make sure it takes longest time to search.
---
that seemed kind of slow, so added some optimization...
0.30-0.34ms for trains that are highly speed limited (don't change rail segments very often)
0.46-0.48ms for trains that are normal speed and uncapped...
Only tracking front rail the train is on.

so much work for one little expression

Code: Select all

 train.speed = speed - (( speed-tt.max ) * 0.1); 

User avatar
pezzawinkle
Fast Inserter
Fast Inserter
Posts: 113
Joined: Thu Jan 12, 2017 1:28 am
Contact:

Re: Request on Rail Tracks

Post by pezzawinkle »

i would have thought the easiest way to implement this would be to use a modded signal "speed signals" set on the side of tracks, with an on changed (to red/yellow), as opposed to different tracks
as a train passes a signal, its max speed can be changed (wireless signal?)... etc
im not sure it could be done, but that would at least limit calculations and entity counts for the same task.

d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: Request on Rail Tracks

Post by d3x0r »

pezzawinkle wrote:i would have thought the easiest way to implement this would be to use a modded signal "speed signals" set on the side of tracks, with an on changed (to red/yellow), as opposed to different tracks
as a train passes a signal, its max speed can be changed (wireless signal?)... etc
im not sure it could be done, but that would at least limit calculations and entity counts for the same task.
That wouldn't attach the speed quality to tracks. There is a train speed limit signal based mod already, if you just want to make slow areas( https://mods.factorio.com/mods/icedevml/TrainSpeedLimit ). This was more about... I want to make really cheap tracks, couple iron rods, and some wood, some normal(mid grade) tracks that are steel and wood, and high speed tracks that are concrete and steel. Once I had all of that, I realized that the wood/steel tracks that go over water should be slightly more limited in speed than on solid ground. Trans already know exactly the track they start on and end of, ( if for no other reason than to update the animation/rotation), so it is a very minor addition to get that track, and based on the type of it apply a speed scalar.

it's less than 1ms for 150 trains in LUA, but it would be so much less work in C++ code; plus the c++ code could know if the train was accelerating, maintaining speed, or slowing down when approaching a stop... it's about 70% of the job in lua to make a educated guess on this state.

Post Reply

Return to “Modding interface requests”