[MOD 0.15] SmartTrains 2.0.5

Topics and discussion about specific mods
tetryon
Fast Inserter
Fast Inserter
Posts: 190
Joined: Wed Nov 04, 2015 2:49 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by tetryon »

Choumiko wrote:
tetryon wrote:SmartTrains_0.3.73 is eating a considerable amount of CPU.

I'm on a modded server, and the UPS has formerly been 59-60, and is currently at 25. Hitting f5 reveals this mod is at 5-9 (whatever the units are) which is far higher than all other mods put together.

Are there any known performance hitches?
How many trains are you using (Smart Trains should show you in it's settings), a lot of trainlines with signal condition as a rule? These are the major things i can think of right now.
Can you check the "Interval for signal" setting? Increasing this number should reduce FPS drops if you have lots of trains with the signal rule set. Just make sure that the signal stays on long enough for the trains to still recognize it.

I had a reply written out, then accidentally hit f5 on my browser window so I lost it all ;p
Quick recap:

17 trains, 43 stations (not many are smart). Public MP server, and I don't use this mod, but others may have. Increasing the interval does improve the speed, but does not resolve the issue. Even if I set it at 20, the SmartTrains is still using 0.7-1.1, which is a little high. UPS is still under 50.

I wouldn't know what to set it to for trains to still recognize it.. sorry!

Ringkeeper
Fast Inserter
Fast Inserter
Posts: 141
Joined: Wed Feb 03, 2016 7:16 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by Ringkeeper »

smarter trains is nice, even i am not a fan of the automated goto-schedule.

But i like schedules. I would like to have f.e. 3 trains going from a->b->c->d->mainstation . Done this in vanilla and they sooner or later end up behind each other, because one had to wait somewhere etc. So a automated timed schedule would be nice.
After one round the train checks the average time needed for the round trip, sends the information to the other trains somehow and when they arrive at the mainstation they wait X seconds if they are too close and leave then.
So, one trip takes 10min , every 3.20 min a train should leave from the mainstation.

Hope i described the problem in an understandable way ^^ I guess that wouldn't be easy to implement and yes, idea stolen from opentdd timetable seperation :D

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

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by Choumiko »

tetryon wrote:17 trains, 43 stations (not many are smart). Public MP server, and I don't use this mod, but others may have. Increasing the interval does improve the speed, but does not resolve the issue. Even if I set it at 20, the SmartTrains is still using 0.7-1.1, which is a little high. UPS is still under 50.

I wouldn't know what to set it to for trains to still recognize it.. sorry!
I found some possible spots for optimisations (in places where i wouldn't have looked :D), will try to do something on the weekend. Don't expect 60/60 though, as pure vanilla update time on the server was already pretty close to the maximum for 1 tick (at least when i was online)
Ringkeeper wrote:But i like schedules. I would like to have f.e. 3 trains going from a->b->c->d->mainstation . Done this in vanilla and they sooner or later end up behind each other, because one had to wait somewhere etc. So a automated timed schedule would be nice.
After one round the train checks the average time needed for the round trip, sends the information to the other trains somehow and when they arrive at the mainstation they wait X seconds if they are too close and leave then.
So, one trip takes 10min , every 3.20 min a train should leave from the mainstation.

Hope i described the problem in an understandable way ^^ I guess that wouldn't be easy to implement and yes, idea stolen from opentdd timetable seperation :D
I was actually thinking about collecting some statistics, avg. round trip time, time between stations. I doubt that i'll add something like automated separation though,sorry.

Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by Supercheese »

Automated separation of trains is something even dedicated transportation games like OpenTTD have a hard time implementing!

User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by MalcolmCooks »

Can someone clarify how to properly set autodepart conditions? Note I'm talking about conditions to leave the station early if there is no change in the cargo, not leave when full/empty.

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

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by Choumiko »

MalcolmCooks wrote:Can someone clarify how to properly set autodepart conditions? Note I'm talking about conditions to leave the station early if there is no change in the cargo, not leave when full/empty.
Right now you can only set them per train or line, not per individual station. They are more or less a leftover from before empty/full. Maybe that was confusing you?
The only way you can influence the behaviour is via ST-Settings "Interval for checks", "First check after" and "Min flow rate" (for Rail Tanker mod) options. They also influence the checks for full/empty.

User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by MalcolmCooks »

Choumiko wrote:
MalcolmCooks wrote:Can someone clarify how to properly set autodepart conditions? Note I'm talking about conditions to leave the station early if there is no change in the cargo, not leave when full/empty.
Right now you can only set them per train or line, not per individual station. They are more or less a leftover from before empty/full. Maybe that was confusing you?
The only way you can influence the behaviour is via ST-Settings "Interval for checks", "First check after" and "Min flow rate" (for Rail Tanker mod) options. They also influence the checks for full/empty.
I see, I was confused about the flow rate. I didn't realise it was only for the rail tanker , doy :lol:

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

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by Choumiko »

MalcolmCooks wrote:I see, I was confused about the flow rate. I didn't realise it was only for the rail tanker , doy :lol:
For items no change is simple, but when a railtanker is nearly full or empty (99.999999%) it still changes by a tiny amount giving a flow rate of 0.0000whatever/s, hence the setting :D

I think i meant to make Autodepart on a per station basis, just never got around to it. I need 0.13 now as SmartTrains is going to need a rewrite then anyways and i don't wanna do it twice :roll: :)

User avatar
MalcolmCooks
Filter Inserter
Filter Inserter
Posts: 253
Joined: Mon Apr 06, 2015 8:32 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by MalcolmCooks »

Also: If I want to set up a system where train stations can request a load of coal, and then the train is sent from a holding station to the requesting station... what happens if there is more than one request at the same time? How do I prevent the signals from summing together and sending the train to the wrong station? Well
lets say I have each station have a different request signal, so they don't get mixed up on the wires going in. Then decider combinators can look at the signals coming in, and output the appropriate number to the station signal. meanwhile another combinater looks at EVERY request signal coming in, and if that is greater than 1, (which means more than one station is sending a request), it adds a very large number to the station signal, to make it invalid, which will instead send the train to each requester station in turn as according to the schedule.
okay I've solved my own problem but I will still post this in case anybody else might be looking for this solution

NearlyDutch
Inserter
Inserter
Posts: 47
Joined: Tue Oct 20, 2015 12:56 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.73

Post by NearlyDutch »

So I was making my train network a little bit smarter with the introduction of smart train stops, but I get the following error, whenever a train uses a smart train stop:

Code: Select all

Error in SmartTrains:
__SmartTrains__/Train.lua:240:conversion of data to type "j" failed
This only happens with smart train stops, normal ones have no problem. I wanted to make my trains go to ore outpost after ore outpost until they are full and then goto the unloading station. That's why I was reworking my train network with smart train stops, but whenever I place one, a train arrives at one or departs from one, this error is printed.

P.S.: Already tried hard resetting with the remote interface.

MainTango
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Tue Oct 27, 2015 12:22 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by MainTango »

As soon as I load a save game after updating SmartTrains to 0.3.75, I take a serious performance hit. My game runs like in slow motion. When I go back to 0.3.73, everything runs fine again.
Running Factorio 0.12.26 with Bob's mods and a couple of other mods.
Please tell me if I can provide additional info to help you troubleshoot.

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

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

That is a bit of a surprise, as i did some changes that should increase performance (at least a tiny bit)
I just tested 0.3.73 vs 0.3.75 on a save with 21 Trains, 56 stations, ~7 lines with a mix of wait forever, full/empty, signal rules. 0.3.73 showed about 9.5 (milliseconds?) in the time_used_percent debug info, whereas 0.3.75 showed "only" 7.5

How many trains, stations, lines do you have? A lot of SmartTrain stops and lines with the signal condition? What's the setting for "Interval for signal"? Increasing it should help if you have many SmartTrain stops.
Can you use /c remote.call("st", "saveGlob") in the console? This will create a file named debugGlob.lua in script-output/st and upload it here?

Depending on how many lines you have, try using /c remote.call("st", "hardReset", true) This will delete all trainlines and should reset SmartTrains in a state like it was used for the first time. If you're still lagging: updating to 0.3.75 isn't really necessary unless you need the new signal.

MainTango
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Tue Oct 27, 2015 12:22 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by MainTango »

I only have couple of train lines, most of which are currently inactive. All active trains only use the depart when full/empty-conditions. At the moment, none of the smart train stops are wired up to the circuit network.
Here are the contents of the file:

http://pastebin.com/vjXpEGGX

Edit: Runs somewhat smoothly for now. It's my 2nd attempt at 0.3.75. Serious case of demonstration effect right here. Maybe you'll still find something in the log.

Edit #2: The hardReset-command did indeed improve my performance after all. I just gotta redo the train lines. Good that I only have a handful of them.

clampi
Inserter
Inserter
Posts: 35
Joined: Tue Mar 08, 2016 11:28 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by clampi »

I also have a performance hit after upgrading to 0.3.75. Downgrading to 0.3.74, hardReset-ing and re-adding the routes solved the performance issue. I've opened an issue on github with more info attached.

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

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

clampi wrote:I also have a performance hit after upgrading to 0.3.75. Downgrading to 0.3.74, hardReset-ing and re-adding the routes solved the performance issue. I've opened an issue on github with more info attached.
I've seen it, thanks for the report :) I think i know what's causing it, but i don't know why, because the changes from 3.73/3.74 to 3.75 didn't change the part where i think the problem is.. :roll:
I'll try to find time to improve some things over the weekend. If you have smart Trainstops in your save, you'll have to rebuild them, because the hardReset from 0.3.74 doesn't automatically readd them.

smarmy
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Mar 20, 2016 4:19 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by smarmy »

Sounds like you might have a handle on it, but just to confirm a performance issue... 0.3.74 has me at 60 FPS/UPS steady. 0.3.75 drops me to 30/40 with no other game/mod changes, occasionally jumping to 60/60 depending on the train state, but I can't quite discern a pattern.

Creat
Inserter
Inserter
Posts: 41
Joined: Sun Jun 22, 2014 4:35 pm
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Creat »

Just wanted to add to the performance reports (even though you seem to be on it).

I have a relatively small factory that has 4 lines with smart trains (obviously). As long as the trains aren't assigned to lines, everything runs just fine, assigning them to lines murders the update-rate already (drops to about 40, sometimes getting even lower though).
Here a screenshot of the debug info, showing SmarTrains as the culprit. If you need the save, just ask (has a couple of mods active though). Alternatively, if I can perform some sort of profiling on the script (is that possible?) I'd be happy to.

I did try to "hard reset" SmartTrains, which obviously works as it removes any lines. As soon as the lines are re-added, it's back to a slow crawl though.

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

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

Creat wrote:I have a relatively small factory that has 4 lines with smart trains (obviously). As long as the trains aren't assigned to lines, everything runs just fine, assigning them to lines murders the update-rate already (drops to about 40, sometimes getting even lower though).
Here a screenshot of the debug info, showing SmarTrains as the culprit. If you need the save, just ask (has a couple of mods active though). Alternatively, if I can perform some sort of profiling on the script (is that possible?) I'd be happy to.
I'd like a save, as the ones i tried take the same time, whether it's version 3.73, 3.74 or 3.75

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

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by Choumiko »

Updated to SmartTrains 0.3.76
  • change default update interval for signal to 12
  • cache calls to game.item_prototypes
  • only search exact signal value if necessary
The changes decreased update time from ~20ms (0.3.75) to ~3ms (~0.5ms even if setting interval to 12) on my testsave
The new update interval only applies for new games, you'll have to change it ingame for existing saves.

Ignore my previous post (unless the new version still drops performance), looks like my previous testsave was borked :D

MainTango
Long Handed Inserter
Long Handed Inserter
Posts: 55
Joined: Tue Oct 27, 2015 12:22 am
Contact:

Re: [MOD 0.12.12+] SmartTrains 0.3.75

Post by MainTango »

Choumiko wrote: The new update interval only applies for new games, you'll have to change it ingame for existing saves.
How do I do that? Sorry, I'm not code-savvy. Could you drop the necessary console command here plz? :)
Is it the previously mentioned /c remote.call("st", "hardReset", true)?

Post Reply

Return to “Mods”