Coulda, woulda, shoulda... I'll let Brumi decide.Lord Aro wrote:Again, the old ai would have made huge long wooden bridges, and certainly never upgrade them
![Wink ;-)](./images/smilies/icon_wink.gif)
Moderator: OpenTTD Developers
Coulda, woulda, shoulda... I'll let Brumi decide.Lord Aro wrote:Again, the old ai would have made huge long wooden bridges, and certainly never upgrade them
Brumi wrote:...Any better ideas?
Anyway, I have an easy job when talking about these little inconveniences because 'the old AI also did it like that' argument is always there
AIBridgeList?Upgrading bridges could be quite hard as tracking roads is not very easy, especially in towns. Tracking rails is possible, but so far the most conveninent solution would be to scan the whole map for bridges owned by the company and then upgrade them if possible. But this would take a really big hit on the AI's performance CPU-wise. Any better ideas?
Sorry. So it may be necessary to create array of all bridges, updated during construction.Brumi wrote:As far as I know it lists the available bridges, not the already built ones. Or maybe I'm confusing it with AIBridgeList_length...
No, I loaded the game and a couple of seconds later the AI crashed. I didn't have to do anything.Brumi wrote:Thank you for the report.![]()
Here the game was saved right after it was loaded, wasn't it? The AI hadn't finished its loading routines when the game was saved again.
Two consecutive save/loads in a very short time may cause problems when there is an unfinished route, as the AI may not be able to remove it properly. But a crash is too much here - I will look into it.
Code: Select all
function AirBuilder::IsItPossibleToAddBurden(stacja, tile, engine, ile=1)
{
local maksimum;
local total = this.GetBurden(stacja);
local airport_type = AIAirport.GetAirportType(AIStation.GetLocation(stacja));
if(airport_type==AIAirport.AT_LARGE) maksimum = 1500;
if(airport_type==AIAirport.AT_METROPOLITAN ) maksimum = 2000;
if(airport_type==AIAirport.AT_COMMUTER) maksimum = 500;
if(airport_type==AIAirport.AT_SMALL) maksimum = 600;
if(AIAI.GetSetting("debug_signs_for_airports_load")) AISign.BuildSign(AIStation.GetLocation(stacja), total + " (" + maksimum + ")");
total+=ile*this.Burden(AIStation.GetLocation(stacja), tile, engine);
return total <= maksimum;
}
function AirBuilder::GetBurden(stacja)
{
local total;
local total = 0;
local airlist=AIVehicleList_Station(stacja);
for (local plane = airlist.Begin(); airlist.HasNext(); plane = airlist.Next())
{
total += this.Burden(AIOrder.GetOrderDestination (plane, 0), AIOrder.GetOrderDestination (plane, 1), AIVehicle.GetEngineType(plane));
}
return total;
}
function AirBuilder::Burden(tile_1, tile_2, engine)
{
return AIEngine.GetMaxSpeed(engine)*200/(this.GetEffectiveDistanceBetweenAirports(tile_1, tile_2)+50);
}
function AirBuilder::GetEffectiveDistanceBetweenAirports(tile_1, tile_2)
{
local x1 = AIMap.GetTileX(tile_1);
local y1 = AIMap.GetTileY(tile_1);
local x2 = AIMap.GetTileX(tile_2);
local y2 = AIMap.GetTileY(tile_2);
local x_delta = abs(x1 - x2);
local y_delta = abs(y1 - y2);
local longer = max(x_delta, y_delta);
local shorter = min(x_delta, y_delta);
return shorter*99/70 + longer - shorter;
}
Thank you for the nice surprise. Those numbers of aircraft per airport seem right to me as I use similar numbers myself. Chance of building airports should be as it was with the old AI - that is if it fails building other two transport types, as you suggested, Brumi.Brumi wrote:Plane support is here! At least to some extent...![]()
I'd like to show you what I've been working on recently, plane support is coming for SimpleAI v5. The alpha version is downloadable from the first post. (it's not there on Bananas)
Of course there is a bunch of things missing, for example, terraforming for airports is still not there. So the AI will only be able to build airports on flat, smooth terrain. The integration of planes into the existing system is also not the best, currently it will try to build airports in roughly 10% of the cases if the other two means of transport are also enabled. Tell me if this should be higher/lower/configurable.
Currently the AI tries to build only 1 airport per city. It uses four types of airports: small, commuter, large and metropolitan. I also tried to set a maximum value of planes for each type of airport, so planes won't be added if this value is reached. So, the current airport capacities:
Small: 4
Commuter: 6
Large: 6
Metropolitan: 8
I set these values without any experimenting, so tell me if you think that these airports can handle more/less aircraft.
If you see large planes landing on small airports, or that there are more planes using an airport than the given value above, then it's a bug, please report it to me.
Also, any other bug reports are welcome. Happy testing!
Code: Select all
group = AIGroup.CreateGroup(AIVehicle.VT_AIR);
local groupname = AICargo.GetCargoLabel(crg) + " - " + AIStation.GetName(stasrc);
if (groupname.len() > 29) groupname = groupname.slice(0, 28);
AIGroup.SetName(group, groupname);
Users browsing this forum: No registered users and 1 guest