I made the ai do the 2 length paths exclusively because of the horrible congestion problems that happened with 3 length (or even
longer) road segments.
Pic1: ai does a 'main road' (road to flag that is closest to a warehouse) and then an 'alternative road' to a flag that cannot
be reached from the main road flag or at least not without a long travel. - my guess is that the 'inner' loop wasn't closed at
the time the outer loop was done.
Pic2: Looks fine - it should be possible to add up how many building spaces will be blocked by a road and if there is more than
1 way to build a shortest road: pick the one with the least blocked building spaces.
When I added the new road rule: I could think of 3 fixes for the mid to late game problems for the ai:
1 use shorter road segments even if this will block some building places because the road can only be a 3 segment piece or
because the road is now longer and blocking more otherwise available space.
2 actively fix road problems when they occur,
3 plan ahead: first build roads into directions that might later carry high amounts of goods and then build and connect the
buildings to the existing 'highways'.
option 1 was easiest to implement so I did that :)
option 2 had way too many cases to check like: can this building be razed to fix the horrible road close to the hq and will it
actually help. Also if we can do so remember what the plan was until the building has burned down, don't build a new building on
this place, remove the bad road/flags and then build the new road.
option 3 was a bit like option 2 in that I have no idea how to accurately guess which areas will need a good connection and even
then there might be areas the ai should avoid building through depending on the map.
If you go back to the old code please add in some other fix for the problem - I really hated to see the ai fail because the main
(or sometimes only) road from the hq contained a 3+ length segment.
Editiert von PoC
am 02.02.2016 07:15