[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
floodo1
Inserter
Inserter
Posts: 21
Joined: Tue Jun 28, 2016 2:33 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by floodo1 »

Choumiko wrote:
Nexela wrote:... I got tired of my farl train getting loaded with random crap in one half and all of the fuel striped out of the loco on the other half when I stopped near a station so I put smart inserters between the loading chests and the trains to only trigger when train at station was greater than 0! problem solved. Can't live without it. ...
That's brilliant.. never thought of that lol
This is one of the main things I use SmartTrains for! I'm amazed that people setup complicated networks to automatically send trains to different stations and such .... I keep it basic and mostly use it to turn my stations off when there is not an active train at the station (like Nexela) or to know how long a train is and therefore where to load fuel :P

marcelgrilo
Inserter
Inserter
Posts: 21
Joined: Tue Jun 21, 2016 9:30 pm
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by marcelgrilo »

Humm, why dont you use the mod portal?

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

marcelgrilo wrote:Humm, why dont you use the mod portal?
I will use it once i feel most of the migration (0.12 to 0.13) and the changes are stable enough. Should be about 1 week

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Nexela »

BTW Choumiko I would really really really love it if the Flying text was able to be turned on and off from ST Settings menu I have to look up the durn console command everytime :)

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

I would prefer to keep this thread alive for balance and feature discussions. I wouldn't want to have to visit two different places for mod discussions and other Factorio talk, to be honest.

Right now I'm not really sure if having a separate discussion forum in the mod portal is such a grand idea. They should have integrated these forums into the mod portal (as the inofficial mod portal already did).
BTW Choumiko I would really really really love it if the Flying text was able to be turned on and off from ST Settings menu I have to look up the durn console command everytime :)
+1 :)
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

siggboy wrote:I would prefer to keep this thread alive for balance and feature discussions. I wouldn't want to have to visit two different places for mod discussions and other Factorio talk, to be honest.

Right now I'm not really sure if having a separate discussion forum in the mod portal is such a grand idea. They should have integrated these forums into the mod portal (as the inofficial mod portal already did).
Yes, me too. I imagine integration would have been fairly simple: Factorio account as forum account. Each time a new Mod get's added create a new Thread (Subforum) even and you're done. But i guess it's too late now.
Nexela wrote:BTW Choumiko I would really really really love it if the Flying text was able to be turned on and off from ST Settings menu I have to look up the durn console command everytime :)
How about a HOTKEY? :mrgreen:
Something like

Code: Select all

{
    type = "custom-input",
    name = "smarttrains_toggle_flying_text",
    key_sequence = "SHIFT + t + o + g + l + e",
    consuming = "none"
  }
Eventually i want to combine all console commands into one basic ui (mostly for servers where commands might be disabled). Especially since i can't decide between camelCase and underscores.. :roll:

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Nexela »

Choumiko wrote:How about a HOTKEY? :mrgreen:
Something like

Code: Select all
{
type = "custom-input",
name = "smarttrains_toggle_flying_text",
key_sequence = "SHIFT + t + o + g + l + e",
consuming = "none"
}
OMG is that a thing! and my vote is camelCase

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Maybe just use the Google style guide for JavaScript:
In general, use functionNamesLikeThis, variableNamesLikeThis, ClassNamesLikeThis, EnumNamesLikeThis, methodNamesLikeThis, CONSTANT_VALUES_LIKE_THIS, foo.namespaceNamesLikeThis.bar, and filenameslikethis.js
I personally would use the Ruby conventions, since that is my favourite language, but many people are used to JavaScript, and LUA is actually quite similar to JavaScript.

Not being decided on the convention you're going to use and then flip-flop between CamelCase and under_scoring is not so great in my opinion.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

Due to issues with trains in early releases of 0.13 I have started play new game (with great and really complex Bobs mod) and now I'm starting develop my smart train scheduler rev. 2 for ore transportation.
Smart train and train system seems to be working fine, but I have discovered one bug in ST - I'm using fixed station mapping, but station ID signal output is not set to mapped station ID, but to the order in train line (when then is one train line for that station, otherwise it outputs nothing). I try to change my setting of lines, schedule, but nothing helped. Output with mapped station ID is great for me, because I do not have to set same ID twice - once in station mapping and once in constant combinator of station logic.

And during the developement I have got one idea of new function for smart trains, which will help me a lot in my system - it's a numbering of trains and outputing that number by station signals. Maybe best would be that I can set ID for each train through GUI, but it's not necessary - even unique number of each train would be great. There can be option in settings, that IDs of trains will increase by 1 for each new train and IDs of deleted trains won't be reused and the other option is assigning deleted trains ID's to new trains (that is best for storing some informations assigned to trains in memory array using train ID as memory address, because it keeps lowest IDs as possible)

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by justarandomgeek »

Choumiko wrote: How about a HOTKEY? :mrgreen:
Something like

Code: Select all

{
    type = "custom-input",
    name = "smarttrains_toggle_flying_text",
    key_sequence = "SHIFT + t + o + g + l + e",
    consuming = "none"
  }
I can't seem to find any documentation on this anywhere... do you have any pointers?

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

justarandomgeek wrote:I can't seem to find any documentation on this anywhere... do you have any pointers?
At the bottom of: https://github.com/Choumiko/SmartTrains ... d/data.lua
That's what i got from Rseding
xmnovotny wrote:I'm using fixed station mapping, but station ID signal output is not set to mapped station ID, but to the order in train line (when then is one train line for that station, otherwise it outputs nothing).
I'll take a look tomorrow. Not sure about the train numbers, can you give an example of what information you need stored per train?

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Nexela »

Yeah hotkeys are the new rage!
My OMG is that a thing was in refrence to this smart alek remark from Choumiko cause I have been peppering him with hotkey requests :P
key_sequence = "SHIFT + t + o + g + l + e",

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Choumiko »

Oh i forgot, seems that kind of hotkey doesn't work :D Either i'm too clumsy to press it correctly or Factorio only handles 1 letter. I guess the second, since i also can't assign SHIFT + P + O in the controls menu.
I could go for a combo: Press SHIFT + t, SHIFT + o, etc within X seconds :mrgreen:

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

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by Nexela »

SHIFT + P + O in the controls menu
Funny you mention this... Pressing Shift + P + O in autotrash pauses logistics, unpauses logistics, pauses trash. I have to keep reminding myself to let off shift in between when pausing both.

xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

Choumiko wrote:
xmnovotny wrote:I'm using fixed station mapping, but station ID signal output is not set to mapped station ID, but to the order in train line (when then is one train line for that station, otherwise it outputs nothing).
I'll take a look tomorrow. Not sure about the train numbers, can you give an example of what information you need stored per train?
In my system, one thing I need, is measuring travel time between unloading station and loading station, because I have multiply loading stations for one ore and I like to prefer nearest one. Now I can measure time only when for train, that leaves unloading station/depot while there is no other train heading to that loading station. This system is working, but better will be if I can measure more trains and calculate an average (on long lines with low traffic I use only one track with crossing "stations", so there can be a difference between travel times of trains).

But another (more important) planned use is for supply system for loading stations - when there will be need for some items in loading station, station will signalize need for supply just before sending train from depot/unloading station, then train will go first to the supply station and then to the loading station. And in supply station I need "save" information which train have to go to which loading station. Yes, I can make this somehow without train IDs, but with train IDs it will be better.

Maybe I will find some another use case, when I will be creating some system for transportation of items between parts of factory (now I don't need that, so I didn't think about it).

Maybe I can try to code that IDs myself and then push it into repository as a pull request if it will be better for you.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

We're just discussing adding "tags" to trains in this thread here: viewtopic.php?f=6&t=28748
Maybe that is interesting for you.

The problem that you are describing is indeed interesting, and it's the reason why I agree that having a way to "tag" trains would be great.

In my train scheduler I solve the issue by never allowing more than 1 train to a supply station (provider station). If you do that then you can send the number of the unload station (requester station) to the supply station; the supply station can then send the train to the correct unload, because it's always the correct train.

In most cases it's not necessary to have more than 1 train going to the same supply station at the same time, but it can be a limitation in certain scenarios, of course.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

siggboy wrote:We're just discussing adding "tags" to trains in this thread here: viewtopic.php?f=6&t=28748
Maybe that is interesting for you.

The problem that you are describing is indeed interesting, and it's the reason why I agree that having a way to "tag" trains would be great.

In my train scheduler I solve the issue by never allowing more than 1 train to a supply station (provider station). If you do that then you can send the number of the unload station (requester station) to the supply station; the supply station can then send the train to the correct unload, because it's always the correct train.

In most cases it's not necessary to have more than 1 train going to the same supply station at the same time, but it can be a limitation in certain scenarios, of course.
Thanks for link to "tags" thread. That is very interesting and better than train ID's. But maybe more difficult and time consuming to implement that.

Idea for allowing only one train heading to the provider station is good, it can simplify the circuit and maybe can be sufficient for quite large transport system (with sufficient supply reserves in loading stations, so some waiting for supply train will not be critical).

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

Maybe try the version 2 of my train scheduler (I'm currently working on version 3). You can find some inspiration for your own solution there. We have a thread, it's in my signature. There are also other guys who are working on train delivery systems, so you'll find a lot of information from various systems.

Locking the supplier stations (provider) to 1 train at a time has many advantages, so you should definitely try that. The limitation is not as bad as it sounds at first. Simple calculation: if your train requires 1 minute for travel (very far), and it has 4 wagons (8000 ore in 0.13), then the outpost needs to mine more than 8k per minute, otherwise the train limitation has no effect. To mine 8k/minute you need a huge ore field or speed modules -- and you can always make the trains longer (6 wagons is still reasonable for large factories).

So in practice it's fine.
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

xmnovotny
Burner Inserter
Burner Inserter
Posts: 18
Joined: Wed Jun 29, 2016 7:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by xmnovotny »

siggboy wrote:Maybe try the version 2 of my train scheduler (I'm currently working on version 3). You can find some inspiration for your own solution there. We have a thread, it's in my signature. There are also other guys who are working on train delivery systems, so you'll find a lot of information from various systems.

Locking the supplier stations (provider) to 1 train at a time has many advantages, so you should definitely try that. The limitation is not as bad as it sounds at first. Simple calculation: if your train requires 1 minute for travel (very far), and it has 4 wagons (8000 ore in 0.13), then the outpost needs to mine more than 8k per minute, otherwise the train limitation has no effect. To mine 8k/minute you need a huge ore field or speed modules -- and you can always make the trains longer (6 wagons is still reasonable for large factories).

So in practice it's fine.
I have looked at your solution and it is nice and simple. My solution is more complicated.
But I see, that there is an misunderstanding between us, what "supply" station means.
First I quickly describe my system - basically it is similar to yours, but it has more "functions". Like yours, there is a depot, multiply outposts and multiply unloading stations. If there is a demand for ore and some outposts have that ore, an available train is sent to the nearest outpost with this ore (based on time measure from depot to outpost). Against you, I can send more trains to one outpost (I'm using only two waggons) - there is adjustable timer, that provide proper interval between trains sent to one outpost (it is set to a loading time plus some reserve). And also I record number of sent trains at outposts and delivery stations, so I can make calculation with "ore on the way". And another difference is, that I can send train to the outpost directly from unloading station if there is a need for train (otherwise the train is send to the depot).
In a second version of my system, I have implemented "multimaster" bus driving and I do not use round-robin polling of outposts. Now when there is a need for ore at unloading station, there are three steps of "communication":

1. Unloading station (as master) start requesting for ore on a bus
2. The nearest outpost with the ore is selected on the bus
3. Unloading station/depot with waiting train with the lowest ID send train to the outpost (depot stations have higher IDs than unloading stations, so trains from unloading stations are send first).

There is a short timeout in first and second step for handle that there is no ready outpost with ore / free train.

And now I want to create "supply system" for outposts, that will use empty trains, which goes to outpost for ore - for supplying outposts with walls, ammo, repair packs and so on.
My idea is to have one "supply station", which will load train with needed items. If there will be need for items from an outpost, the outpost will signalize this during "offer-demand" matching and in this case, a train will be first send to supply station to load needed items and after that it will go to the outpost. (When train arrives to supply station, there will be a request for needed items from outpost on the bus.)
And another smaller idea is, that a train will not be send to the depot from unloading station unless there is no other trains arriving to that station (for eliminating needless trips).

Edit: There will be also option for having more "train types" (each train type will have own depot station and at each unloading station there will be settings of requested train type) - mainly for simlutaneous handling of cargo and railtanker trains. But it could be used also for different train lenghts for certain ores.

User avatar
siggboy
Filter Inserter
Filter Inserter
Posts: 988
Joined: Tue Mar 29, 2016 11:47 am
Contact:

Re: [MOD 0.12.30+] SmartTrains 0.3.95

Post by siggboy »

This looks very nice. BTW this is the wrong thread for this, but please make a post to the thread that I've started and maybe post a blueprint/demo map of your system there, we would really like to try it.

I don't know if you have looked at the old version of my system (that is documented on the front page), or the newer version (version 2). I have still not updated my documentation for version 2, but it does have two kinds of stations, "requester" and "provider", what you call "unload" and "outpost". The depot will release a train when a requester needs a product and there's a provider that has it in store. The requesters also keep track of incoming resources, so the trains will be efficiently distributed (there will be no "oversupply" of resources). In 0.13 I will also allow the providers to have more than 1 resource type in stock, the inserters will select the correct resource to load when the train arrives.

I do not count trains, I count the resource amounts directly. So when the train leaves the depot to pick up 6000 iron from P and deliver it to R, then R will be notified that it will receive 6000 iron. It will then subtract this 6000 from the amount it requires (because it will soon be incoming). Only if it consumes the iron really quickly it's possible that a second train will be requested (before the first one has arrived with the 6000 iron). This avoids the problem that you have 4 trains with 6000 iron each sent all to the same requester very rapidly (and then it has too much and other requesters can starve).

Your system is very advanced in the train distribution, because you do not require the trains to run through the depot. They can go from an unload to a provider directly, and you even take distance into account. This is very efficient, but I imagine it's difficult to set up in a real game.

I think in my system (and in the systems made by other people who have posted), the bottleneck can be the depot, because the trains always need to go there. In my latest version (also not published), I can have multiple lanes in the depot, so it's possible to release a lot of trains very quickly. They still all have to go there, and it will become a limitation with many trains.

How do you solve the refueling problem, if you cannot guarantee that your trains run through the depot?
Is your railroad worrying you? Doctor T-Junction recommends: Smart, dynamic train deliveries with combinator Magick

Post Reply

Return to “Mods”