Re: NoAI Branch - An AI Framework
Posted: 20 May 2008 22:17
True, but it also does not make sense to build a road that does not connect to a neighbour since it will never be used.kuifware wrote: BuildRoad and BuildRoadFull require that start != end, so you can't build individual road segments on one tile (without also building on neighbouring tiles as well).
I see your point, I would have to check whether this is true in execute mode. In test mode it probably wastes money, because no changes are made to the map in testmode, so the full cost will be counted. In execute mode the changes are made, I don't know if a full tile is charged in that situation. If it is, a small gain in cost is possible, but it would be a rather insignificant one.kuifware wrote:
- When you want to connect a road depot or station, you need to build a road segment which will be replaced by the depot/station. A slight waste of money.
In my first efforts I did use the testmode, but did find out that it is rather useless in predicting whether a tile can be built or not: no changes are made to the map, so a piece of road that can be built in testmode, can be not buildable in execute mode, because the route did create a foundation in the previous tile, making all your efforts in planning the route ( cost ) useless. Because there is also no function to retrieve the roadbits that are already present on a tile, there is no easy way around this. So, until there is a function to query the road segments of a tile that you requested, I switched to another strategy: before building, loan the maximum amount you can get, and start doing the real thing. When money does not suffice, stop building, and wait until it does and continue. If it suffices, pay back the loan after building.kuifware wrote:
- More interesting is the possibility to use BuildRoadSegments in AITestMode. It makes it much easier to estimate the costs of a road path. (Using BuildRoad in AITestMode won't allow you to do that because then you'd typically double-count the cost of clearing the tiles and the costs of building foundations. Workarounds for this are less efficient and prone to bugs.)
But, unless you want to buy out, like mentioned above, why would you want to know that? I.e. in what way would that influence the behaviour of your AI? Imo, most AIs that are currently built are still struggling with vehicle management, path finding etc. Buying out other companies is at another strategic level, that, at least my AI is not ready for yet. I'm not saying it's an invalid request, I just would like to understand the thought behind it.kuifware wrote: If you want to know how much funds your competitor can raise, you need to know its BankBalance and MaxLoanAmount - its LoanAmount.