BeltRouter


This mod allows you to route belts and pipes automatically: 1. Put the starting belt and ending belt on ground first, 2. then select the starting belt with ctrl+right-click and 3. select a ending belt with ctrl+left-click. 4. Boom, belt ghosts are created!

Utilities
3 years ago
1.0 - 1.1
28.3K

i Minimal turns preferred

4 years ago

Would be nice if the mod introduced the least amount of turns (also counting how the starting and ending belts bend after path planning) whenever this doesn't lead to longer paths. Taking the shortest path is nice, but if it leads to a squiggly mess when I'm expecting a simple L bend then I just have to remove the path by BR and introduce some intermediate nodes to route it myself.

In this picture: https://mods-data.factorio.com/assets/3109ccc5eff01140eb8973549eeddc2301256ca7.png

It should go down and then left. This would mean the start and end belt directions will be respected so you get predictable and more beautiful results. It would make multi-belt bus L bends reasonable to build with this mod.

Without looking at the source: I think it could be done with a simple 0.00001 distance penalty to bends, low enough that it would never in practise choose a longer path to avoid bends but it would prefer simple paths with straight lines.

4 years ago

Good idea! Fixed. check the new version:D
Thanks a lot

4 years ago

That's fast! Thanks!

4 years ago

NP :D

4 years ago

I'm not noticing any difference with BR 1.1.0 though :/
I still get 3 bends when 1 bend would give the same distance.

4 years ago

Hmm can you try adjust the greedy level in the mod settings to close to 1? Maybe like 1.0001? Since the currently implementation gives the algorithm a leeway of choosing the not so optimized path so that it can fasten searching speed. By adjusting greediness to 1 or 1.0001, you can ensure fewest turnings.

4 years ago

I actually also tried it with 1 but that didn't help either.

4 years ago

Do you have a picture of the situation it doesn't work? I tested on my side and it worked: https://imgur.com/a/kV4n898

4 years ago

I added some additional tuning in 1.1.1 version. Do you want to check if that is fixed?

4 years ago

I'll check and post pictures if there's still issues when I get back home tomorrow. :)

4 years ago
(updated 4 years ago)

It works a bit better now. But it still seems to prefer bent paths in some situations.

The empty belt is a test of the mod:
minimal underneathies (the selected underneathie was built after BR to show that path could be taken with same number of underneathies and less regular belts) (this path was generated with greed 1 and 1.1)
maximal underneathies

Minimal underneathies allowed took another path than the maximal underneathies mode! Not sure why that would happen. But only one of the modes seems to really care about minimising turns here. But it might just be because the underneathies with longer gaps are prioritised and that's the reason for more straight paths. But any maximal underneathie mode can trivially be modified to a minimal one by just replacing underneathies with regular belts wherever there's no obstacles to go beneath, so they could use the same path finder and then just transform between them, if you want simpler code.

Also for some reason "only necessary underneathies" seems to want to maximise regular belts by making gaps as small as possible. Not sure why that is.

4 years ago

Minimal underneathies allowed took another path than the maximal underneathies mode! Not sure why that would happen.

Do you mean like this? https://mods.factorio.com/mod/BeltRouter/discussion/5f90cee84c050ef7ba1b5532
If so, it is solved now. Previously due to failure in recognizing entity ghost belt.

Also for some reason "only necessary underneathies" seems to want to maximise regular belts by making gaps as small as possible. Not sure why that is.

Thanks for pointing out. That's because I punished the path distance with "underground belt length * 2", I think this issue could be fixed with a fixed amount of punishment, like "underground belt length + 5". This could be fixed in next version

4 years ago

Minimal underneathies allowed took another path than the maximal underneathies mode! Not sure why that would happen.

Do you mean like this?

No! The selected underneathie was placed after I used BR.

4 years ago

Not sure if the problem is solved now in the new version 1.1.3. Do you want to test again? :D

New response