Page 1 of 1
AI and autorenew?
Posted: 21 Apr 2009 12:29
by Bilbo
Does AI have access to setting autorenew options for its company?
The option whether autorenew or not, and the options for min money and min. age of vehicle. While AI can periodically watch vehicle list and just send old vehicles to depot so they can get cloned and scrapped quite easily, the renew is better, as renewed vehicle keeps its current cargo and history of profits. Also, it means less code in the AI :)
AIController have only GetSetting, but no SetSettings... while most client-side settings do not make sense for AI (like whether something is shown in toolbar or not), the autorenew settings does make sense.
Re: AI and autorenew?
Posted: 21 Apr 2009 12:35
by Yexo
Yes, the functions you want are in AICompany. Note the AIController::GetSetting returns an AI setting, not a game setting. Those can be queried by AIGameSetting
Re: AI and autorenew?
Posted: 21 Apr 2009 12:51
by Morloth
I actually encountered quite a few problems with using the auto renew option in AIs:
- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
What I've done now, is to have an order list like this:
1: Load / Unload Cargo
2: Move to some waypoint / or service in depot when needed, etc.
3: Load / Unload Cargo
4: If age >= max age goto 6
5: goto 1
6: Go to depot and stop
Then every now and then check all vehicle in depots and if they're over age do a replace function otherwise just sell them.
That should do the trick and solve all problems

.
Re: AI and autorenew?
Posted: 21 Apr 2009 12:55
by Yexo
Morloth wrote:- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
The first is a problem also for human players, not with the NoAI code. The second is intended.
I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
They are available in AIGroup.
Re: AI and autorenew?
Posted: 22 Apr 2009 04:50
by fanioz
Yexo wrote:Morloth wrote:- In the case of ships then a ship needs to be auto renewed and get the order to go to the nearest depot it might get lost because there are no depots in the neighbourhood.
- When a vehicle becomes obsolete it can't be autoreplaced with the same vehicle and thus never will.
The first is a problem also for human players, not with the NoAI code. The second is intended.
I know in-game you have options to select 'replace vehicle X with vehicle Y', but I don't think these are available to AIs at the moment. Even then, the first problem will still exist.
They are available in AIGroup.
I've ever tried using AIGroup functions, it can autoreplace vehicles only if the new engine(vehicle) can goto station/depot order same as the old vehicle one. (the error said something like "Auto replace failed, the new vehicle can't goto one of your destination order")
Re: AI and autorenew?
Posted: 22 Apr 2009 07:24
by Yexo
fanioz wrote:I've ever tried using AIGroup functions, it can autoreplace vehicles only if the new engine(vehicle) can goto station/depot order same as the old vehicle one. (the error said something like "Auto replace failed, the new vehicle can't goto one of your destination order")
Am I right when you're saying you can't replace normal rail trains with monorail trains? That's intended, it's the same as for humans.
Re: AI and autorenew?
Posted: 23 Apr 2009 05:38
by fanioz
Yexo wrote:Am I right when you're saying you can't replace normal rail trains with monorail trains?
Similiarly

, it happened with road vehicle. The new engine is articulated, the road station is not a drive-thru, thus it can't go there, and autoreplace would failed.
And u're right :
Yexo wrote: That's intended, it's the same as for humans.