MortenTobiasNielsen / Factorio-TAS-Generator

This is an attempt to create a helper tool for Tool Assisted Speedruns in Factorio. A guide of how to use the tool can be found here: https://www.youtube.com/watch?v=V9tuNoDqc0E&t
MIT License
13 stars 4 forks source link

Split steps.lua #348

Open theis999 opened 1 year ago

theis999 commented 1 year ago

Split the generated steps into multiple files

This has 2 advantages: Performance: It could make generation of the step files faster, if we only need to generate the last fraction of the steps. Debugger: At least in my setup, the Factorio mod debugger has trouble with Lua files in excess of 10k lines.

This idea is fairly simple, though implementation could still be a bit tricky.

I am imaginen having 1 steps.lua file, this file then have references to several files with the actual steps. We would split these lesser steps files with about 5k steps in each. The Lua generator, would have to keep a state of which files have to be updated.

MortenTobiasNielsen commented 1 year ago

I am not entirely sold on the idea of introducing this type of complexity unless there is a very tangible benefit to doing it. Have you investigated what causes the debugger to have problems when the file is larger than 10k steps - does it need to keep track of all the steps?

theis999 commented 1 year ago

I have received confirmation that it is in fact a bug in the debugger, that it can't handle large files.

I think there is still value in a faster script generation step. Whether it is enough value for the trouble, perhaps not.

MortenTobiasNielsen commented 1 year ago

Have the generation time degregated? When I last generated the script for my run it was so fast it almost didn't make sense to show the progress bar.

CasparPetch commented 1 year ago

FWIW, my script with ~30k tasks takes about 2 seconds to generate. Because it is not clear when the generation is finished this sometimes means I launch from the save point before generation is finished and so I get the "old" version of the script playing instead of new, which is confusing as it's not clear if the change I made had no effect or if the change didn't happen at all.

MortenTobiasNielsen commented 1 year ago

Aren't there being shown a progress bar when you generate the script?

I don't remember it as taking anywhere near that amount for my run which was more than 30k if I remember correctly. This could be due to hardware, but the tool isn't multi-threaded so it shouldn't be possible for it to be crazy much faster on high- vs low-end gear.

CasparPetch commented 1 year ago

Yes I have the progress bar which appears in a new window that is underneath the main window, so I don't get to see it. Maybe the progress bar should be integrated into the main window?

MortenTobiasNielsen commented 1 year ago

Why have you dragged the progress bar where you cannot see it? 😅

It would be pretty neat if the progress bar was integrated in the main window. I am though not aware if the framework supports it.

CasparPetch commented 1 year ago

I use the same screen for everything so it naturally goes behind all other windows. Infact, sometimes it messes with my alt-tab when it quickly appears and disappears

MortenTobiasNielsen commented 1 year ago

I see, that way "goes underneath". 🙂

theis999 commented 1 year ago

Keep in mind that Zaspar usually streams his development, which steals significant resources too.

It should be possible to integrate the progress bar on the main window, using basically the same elements. Though that should probably be raised as it's own issue.

MortenTobiasNielsen commented 1 year ago

Ahh Yeah, that could cause performance issues of there isn't a thread available. I would though guess the vast majority of the load from streaming would be taken by the GPU, but none the less it could be the reason.

Agreed.