[NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Moderator: OpenTTD Developers
[NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Hello,
Some time ago, Krinn, who is the conceptor of DictatorAI (http://www.tt-forums.net/viewtopic.php?f=65&t=52982) made the request for a new event : ET_VEHICLE_OLD (http://bugs.openttd.org/task/5078).
This Event will permit to avoid looping on all vehicle in order to check the age and renew it if it's too old.
I made a first patch in order to provide this event.
In this first release of this patch, the event is triggered each time OpenTTD triggers a "vehicle is old" (triggered 1 year before lifetime), "vehicle is very old" (triggered at lifetime), and 'vehicle is very old and need to be replaced" (triggered each year after lifetime).
According to Yexo, something better must be found in order to trigger this event only once. It appears to me that the event triggered at lifetime should be the best moment.
And You, as conceptor of AI Script, when do you think it's the best way to send this event to your script ?
When replying, you can also link to your AI topic (if any).
You can also use the poll !
Thank you for your participation.
Some time ago, Krinn, who is the conceptor of DictatorAI (http://www.tt-forums.net/viewtopic.php?f=65&t=52982) made the request for a new event : ET_VEHICLE_OLD (http://bugs.openttd.org/task/5078).
This Event will permit to avoid looping on all vehicle in order to check the age and renew it if it's too old.
I made a first patch in order to provide this event.
In this first release of this patch, the event is triggered each time OpenTTD triggers a "vehicle is old" (triggered 1 year before lifetime), "vehicle is very old" (triggered at lifetime), and 'vehicle is very old and need to be replaced" (triggered each year after lifetime).
According to Yexo, something better must be found in order to trigger this event only once. It appears to me that the event triggered at lifetime should be the best moment.
And You, as conceptor of AI Script, when do you think it's the best way to send this event to your script ?
When replying, you can also link to your AI topic (if any).
You can also use the poll !
Thank you for your participation.
Last edited by Muxyy on 26 Aug 2012 17:19, edited 1 time in total.
OpenTTD France - http://www.openttd.fr
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
What's wrong with having all 3?
ET_VEHICLE_OLD
ET_VEHICLE_VERY_OLD
ET_VEHICLE_VERY_VERY_OLD - maybe not this one though :L
ET_VEHICLE_OLD
ET_VEHICLE_VERY_OLD
ET_VEHICLE_VERY_VERY_OLD - maybe not this one though :L
AroAI - A really feeble attempt at an AI
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Why an AI would need 3 events nearly the sames, posted 1 year before lifetime, at lifetime and 1 year or more after lifetime ?
If your AI is competitive, then the best is to renew as soon as possible, so at first time the framework will trigger the event.
If your AI is lazy (or stupid ?), then dont use this event, and let the vehicles outdated.
If your AI is competitive, then the best is to renew as soon as possible, so at first time the framework will trigger the event.
If your AI is lazy (or stupid ?), then dont use this event, and let the vehicles outdated.
OpenTTD France - http://www.openttd.fr
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Another option would be to send this event every year, from begining with parameter indicating remaining year until lifetime. In that way you can replace vehicle when you want.Muxyy wrote:If your AI is competitive, then the best is to renew as soon as possible, so at first time the framework will trigger the event.
OpenTTD France - http://www.openttd.fr
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
That is beyond what the player currently gets, and thus not allowed.
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Maybe another solution would be to make this configurable by the AI, for example using some AIController::SetYearsBeforeAgingEvent(years) function.
Although I also think that an event like this would be a good idea, polling the vehicles is not that bad after all. SimpleAI polls the vehicles at the start of every year, and it's quite enough.
EDIT: Alberth posted while I was writing this. Responding to that, I think if we want to stick with getting the same information as the player, then Lord Aro's suggestion would be the most realistic.
Although I also think that an event like this would be a good idea, polling the vehicles is not that bad after all. SimpleAI polls the vehicles at the start of every year, and it's quite enough.
EDIT: Alberth posted while I was writing this. Responding to that, I think if we want to stick with getting the same information as the player, then Lord Aro's suggestion would be the most realistic.
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
After some talking with TrueBrain on IRC, i think that only one event is not enough.
When the event is triggered, the AI will be able to replace the vehicle with some conditions. Money is one fo those. If a new vehicle cant be bought, then it's useless to send the vehicle to the depot.
This vehicle has to wait for the next year for the event to be triggered again.
As said by Alberth, the first event must be triggered like in normal game : lifetime - 1 year, then every year until it will be replaced.
Last question : is it usefull to have a event parameter who indicates the replacement age in year (age - lifetime) ?
When the event is triggered, the AI will be able to replace the vehicle with some conditions. Money is one fo those. If a new vehicle cant be bought, then it's useless to send the vehicle to the depot.
This vehicle has to wait for the next year for the event to be triggered again.
As said by Alberth, the first event must be triggered like in normal game : lifetime - 1 year, then every year until it will be replaced.
Last question : is it usefull to have a event parameter who indicates the replacement age in year (age - lifetime) ?
OpenTTD France - http://www.openttd.fr
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
You mean a player-specified value of the age on which to replace rolling stock. I.e., specifying 5 means you get the reports from an age of 4 years (5-1) onward.Muxyy wrote:Last question : is it usefull to have a event parameter who indicates the replacement age in year (age - lifetime) ?
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
Replacement age (in year) = vehicle age (in year ) - lifetime (in year).Hyronymus wrote:You mean a player-specified value of the age on which to replace rolling stock. I.e., specifying 5 means you get the reports from an age of 4 years (5-1) onward.Muxyy wrote:Last question : is it usefull to have a event parameter who indicates the replacement age in year (age - lifetime) ?
When receiving the first ET_VEHICLE_OLD, parameter will have value : -1. Lifetime will be reached in 1 year
Second event : value 0. Lifetime has been reached.
Next events : 1, 2, 4. Lifetime has been reached n years ago. Time to spare some money for replacement
OpenTTD France - http://www.openttd.fr
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
I think we should get it once a year after the vehicle has reach lifetime -1 age. Like a human player get.
We don't really need any parameter, as an AI could just don't care about the information at all, if the vehicle is old enough to candidate for replacement, i might just don't care about its age and try to replace it.
And if we care about its lifetime remain or age, the API can gave us that if need, as soon as the AI get the event, the AI can take deeper look at vehicle info to take a final decision.
So save some extra cpu cycle and drop the parameter and let AI itself take that cpu cycle cost if it need.
We don't really need any parameter, as an AI could just don't care about the information at all, if the vehicle is old enough to candidate for replacement, i might just don't care about its age and try to replace it.
And if we care about its lifetime remain or age, the API can gave us that if need, as soon as the AI get the event, the AI can take deeper look at vehicle info to take a final decision.
So save some extra cpu cycle and drop the parameter and let AI itself take that cpu cycle cost if it need.
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
IMHO - at the same time as it is presented to human player, to limit confusion.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
AIAI - AI for OpenTTD
- MinchinWeb
- Traffic Manager
- Posts: 225
- Joined: 01 Feb 2011 12:41
- Contact:
Re: [NoAI] For AI Writers - ET_VEHICLE_OLD Discussion
I'll second that.Kogut wrote:IMHO - at the same time as it is presented to human player, to limit confusion.
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Who is online
Users browsing this forum: No registered users and 15 guests