[MOD 0.12.30] Automatic Belt Planner (old version archive)

Topics and discussion about specific mods
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.28] Automatic Belt Planner

Post by prg »

Qon wrote:Would be an improvement. But not exactly what I would like. I imagined something more like how the v0.13 rail laying is shown to work in the one of the FFF's.
GIF in the bottom of the post: http://www.factorio.com/blog/post/fff-114
The path that will be used is shown in green just like a blueprint, and updates automatically when you move the mouse to new tiles when you are choosing where to place the end marker. No confirmation dialogue would be necessary then.
Having a live preview of the path would certainly be great, but that won't be possible for now I'm afraid. There is no on_mouse_moved event and no way of querying which tile the cursor is currently over I'm aware of so that this could be done in on_tick. Also it would most probably be way too slow to be usable with the current Lua implementation for any kind of reasonably useful path lengths anyway.
Qon wrote:Instead of choosing which belt is placed with the confirmation dialogue you would then have the option in a toolbar at the top of your screen like many other similar tools.
Examples: Filtered deconstruction planner: viewtopic.php?f=97&t=19548&
If you are going to place a lot of belts one ofter another with this tool you don't want to press ok after every single belt segment construction.
Yeah I wanted to simply re-use the "Belt planner running" box in that corner as a "The belt planner has found you a path!" notification thing so it wouldn't interrupt gameplay when it popped up. You'd still need to click an accept button or there could be no preview.
Qon wrote:Another idea: The lowest underground belt avoidance level still prefers belts over underground belts. Maybe add a level that uses underground belts for all straight paths where the underground distance is >0. Sometimes I prefer to use normal belts only for trivially short straight paths (<=2) because I don't get moved around by the belts as much then. Also I've heard that underground belts are better for performance reasons so megafactory builders would also prefer a "normal belt avoidance"-level.
That sounds useful. Now the configuration dialog is starting to get cluttered, hmm...
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.4.0

Post by prg »

Okay, this took a while, but I think v0.5.0 should improve usability regarding these issues as much as currently possible.

No more "oh no, not like *that*" moments anymore thanks to the new preview with undo feature that lets you decide if you like a path or not before placing ghosts.

Only a single belt planner item that shouldn't have trouble any longer finding its way back to its proper quickbar position.

Less clicks required to manually build a path in multiple steps with the continuous build mode. You still need to accept the suggested path by clicking a button in the GUI or there could not be a preview. After that you can place the next end marker right away to continue building from the previous end position.

Also, since there's an attachment limit of 10/post and I want to keep the old versions in the first post around, I'm going to use this post as an image dump.
image dump
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

Minor bug fix release. Just hope I didn't break five other things with this. Wish I had a proper test suite when doing these kinds of changes.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
Afforess
Filter Inserter
Filter Inserter
Posts: 422
Joined: Tue May 05, 2015 6:07 pm
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by Afforess »

prg wrote:Minor bug fix release. Just hope I didn't break five other things with this. Wish I had a proper test suite when doing these kinds of changes.
I've used luacheck and lua busted with some success in testing factorio code. It involves a fair amount of mock objects though, which is annoying. See the Factorio Standard Library project if you are curious.
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

Afforess wrote:I've used luacheck and lua busted with some success in testing factorio code. It involves a fair amount of mock objects though, which is annoying. See the Factorio Standard Library project if you are curious.
Huh, thanks, that's interesting. But creating all those objects for a reasonably sized fake factory in a known-problematic configuration in a text editor does sound like quite a bit of work indeed...
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: [MOD 0.12.28] Automatic Belt Planner

Post by Zeblote »

Good. That standardised topic is ugly and useless.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: [MOD 0.12.28] Automatic Belt Planner

Post by Qon »

Zeblote wrote:
Good. That standardised topic is ugly and useless.
In your opinion. Some would disagree.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
GameCharmer
Inserter
Inserter
Posts: 38
Joined: Tue Oct 20, 2015 2:34 pm
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by GameCharmer »

Just gave this a shot and it works great! Would it be possible to add custom belts in the future? I'm still learning LUA, but there should be a way to iterate belts and potentially build an array of speeds / underground lengths. I'll help where I can. :D
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

GameCharmer wrote:Just gave this a shot and it works great!
Glad to hear that!
GameCharmer wrote:Would it be possible to add custom belts in the future? I'm still learning LUA, but there should be a way to iterate belts and potentially build an array of speeds / underground lengths. I'll help where I can. :D
This should be possible somehow, yes. But I don't see an easy way of getting at the max_distance of the underground belt prototype from control.lua, so would need to create a fake technology or some kludge like that per belt type which could be read at runtime (or maybe make a modding interface request.)

Also there doesn't seem to be any connection between above- and underground belt types so it could be automatically figured out which types to place together. The base game just appends "-to-ground" for the underground types, but mods could name them whatever they wanted. So just looking for that string at the end won't be enough, some mod might decide to add something like "-mk2" to the name and this approach would already break. To make it work generically, the user would need to select above- and underground belt types separately. This would already need to happen before path finding starts, since the path finder would need to know how long it can make the underground sections.

So yeah, this seems possible, just a bit awkward to implement right now.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
GameCharmer
Inserter
Inserter
Posts: 38
Joined: Tue Oct 20, 2015 2:34 pm
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by GameCharmer »

prg wrote: This should be possible somehow, yes. But I don't see an easy way of getting at the max_distance of the underground belt prototype from control.lua, so would need to create a fake technology or some kludge like that per belt type which could be read at runtime (or maybe make a modding interface request.)

Also there doesn't seem to be any connection between above- and underground belt types so it could be automatically figured out which types to place together. The base game just appends "-to-ground" for the underground types, but mods could name them whatever they wanted. So just looking for that string at the end won't be enough, some mod might decide to add something like "-mk2" to the name and this approach would already break. To make it work generically, the user would need to select above- and underground belt types separately. This would already need to happen before path finding starts, since the path finder would need to know how long it can make the underground sections.

So yeah, this seems possible, just a bit awkward to implement right now.
Just thinking out loud, since I don't know much about LUA, nor how the control script operates, but I may have an idea. What if you could use a data-fixes / final-fixes script to read the belts and attach an array of name/length as a new property to the belt placement item? When using it, would it be possible to read that extra property to generate the display? It's a very hacky way of doing it and I have no idea if it's even possible. I'm a PHP programmer and do something similar to this to get around a rigid form construction class. :P
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

GameCharmer wrote:Just thinking out loud, since I don't know much about LUA, nor how the control script operates, but I may have an idea. What if you could use a data-fixes / final-fixes script to read the belts and attach an array of name/length as a new property to the belt placement item? When using it, would it be possible to read that extra property to generate the display? It's a very hacky way of doing it and I have no idea if it's even possible. I'm a PHP programmer and do something similar to this to get around a rigid form construction class. :P
If it was possible to read random prototype attributes from control.lua I could just read max_distance directly. But only values made available through LuaEntityPrototype/LuaItemPrototype can be accessed at runtime, user-defined attributes from the data loading stage are simply lost. Hence the even more hacky idea with the fake technology, this way user-defined strings and integers could be passed to control.lua via the effects array of LuaTechnology.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
triggerman602
Inserter
Inserter
Posts: 22
Joined: Sat Nov 07, 2015 9:18 pm
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by triggerman602 »

I don't know if this has come up yet but the pathfinder really needs to avoid belt ends to avoid items spilling onto the new belt.
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

triggerman602 wrote:I don't know if this has come up yet but the pathfinder really needs to avoid belt ends to avoid items spilling onto the new belt.
No, this hasn't been mentioned yet, but it would be a useful addition. Now how to implement this without totally ruining performance with four find_entities_filtered calls per open set element... (won't happen soon, am a bit busy at the moment)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [MOD 0.12.30] Automatic Belt Planner v0.5.1

Post by prg »

New version got its own thread since I've hit the attachment limit again.
image dump
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!
Post Reply

Return to “Mods”