Forum



jh am 31.01.2016 21:41 #14009


At some time in the past someone introduced that the AI only builds roads with a length divisible by 2 - probably to get a better density of flags.

I think that results way too often in strange paths. Examples:





Does anybody know why these were introduced? If no one disagrees I would remove that 'feature' again.

Editiert von jh am 31.01.2016 21:50

~Gast am 31.01.2016 21:46 #14010


Nothing wrong with the second picture, I also build that way.

The first one is indeed a little strange. But regarding the things I've seen in older version, this is still acceptable.


Spike am 01.02.2016 10:20 #14011

Im Ruhestand
I still think the second one is related to "do not use 3 segment roads" as they might be
slower later.
It's a waste of space and I still think no good player (if not in a situation for that) uses
this style:

Because the AI is blocking a building slot which is quite bad.

---



PoC am 02.02.2016 07:04 #14012


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

jh am 02.02.2016 21:50 #14014


Ok, I understand that people like the two-segment preference. :)


I looked into the first case a bit more: It seems that the two buildings A and B are built and connected simultaneously.



The mainroad of A will be connecting to the headquaters (26/99 -> 24/99), an alternative road is not built as it does not improve any connections (A knows of its future mainroad). However, B will build a alternative road, as it will greatly improve the connection to A at this time! (no connection between B and A, because the mainroad of A is not yet built).

Why is it allowed that multiple constructions and road buildings are done simultaneously (= in the same NWF). If I remember correctly I orginally waited several GFs between each action of the AI to avoid situations like these. Did you change that on purpose?

As video: https://www.youtube.com/watch?v=faDOPLxVJKo

Editiert von jh am 02.02.2016 21:52

Flamefire am 03.02.2016 00:39 #14015


Maybe because the delay would be much bigger? Note that from issuing a command to its execution there can be up to 2 NWFs time: NWF happened, directly issue command, commands are sent after 1 NWF, commands are received after another NWF.

Not sure if this was taken into account... As far as I understood the code, then the AI refills its build queues directly after a NWF happened, thus 1 NWF to early to avoid things like this.

I think the AI should rather use virtual roads too, so it "sees" what it is going to do.

---
Github: https://github.com/Flamefire


PoC am 03.02.2016 06:43 #14016


Yes at some point I changed it so the AI could construct a new building once the previous command's building and main road are
up - but I suppose a check for alternative road: is flag connected at all (or maybe just is that a new flag?) might be useful in
addition to the don't connect to military flag rule.

Editiert von PoC am 03.02.2016 06:44

jh am 03.02.2016 21:39 #14017


Yeah, I can add such a check...

But wouldn't it be easier and safer to just wait ~2 NWFs? I mean, it doesn't really matter if the AI builds buildings/roads every few milliseconds or every second. Why bother with placing those safeguards when the game itself does it for you? For example: I saw complicated check in the alternative road code to avoid crossing the (not yet built) main road. By building it a second later that could be easily avoided.

Why do we have to build so fast?


PoC am 04.02.2016 08:01 #14018


nwf time is 'fixed' vs gf time being based on game speed - so the saved nwfs get more important with increased game speed.  
Constructing faster is one of the things the ai can do to increase the difficulty level - as long as the calculations don't
slow down the game (and get the same end result as just waiting) I would keep/add anything that makes the ai even slightly more
difficult to defeat

Editiert von PoC am 04.02.2016 08:02



Feel free to post in English!

Antwort schreiben

Username:
Security code:
Text:

   
  Convert smilies like :), ;) etc. into small graphics?
  Convert WWW-addresses into clickable links?
  Soll Boardcode in ihrer Nachricht aktiviert werden?