Select AI when missing AI version
Moderator: OpenTTD Developers
- George
- Tycoon
- Posts: 4364
- Joined: 16 Apr 2003 16:09
- Skype: george-vb
- Location: Varna, Bulgaria
- Contact:
Select AI when missing AI version
I made the following test and got result that was not expected.
I loaded a savegame with NoCAB r315, but I had only NoCAB r323 in my OpenTTD\content_download\ai\ folder.
OTTD selected OTHER AI to manage the company. Several tests - several results CluelessPlus, MedievalAI, Trans ...
But why? Can't it recognize the other version of the same AI?
If yes - why doesn't it do so?
If no - may be it would be a good idea to store AI information that allows to load the same AI even of a different version?
I loaded a savegame with NoCAB r315, but I had only NoCAB r323 in my OpenTTD\content_download\ai\ folder.
OTTD selected OTHER AI to manage the company. Several tests - several results CluelessPlus, MedievalAI, Trans ...
But why? Can't it recognize the other version of the same AI?
If yes - why doesn't it do so?
If no - may be it would be a good idea to store AI information that allows to load the same AI even of a different version?
Re: Select AI when missing AI version

In case of NoCab,and Trans. Because it doesnt declare MinVersionToLoad().
Have you try loading a saved game with Admiral21 when you have Admiral 22?. If you still got the same, I guess it was a bug.
However your idea is good. AI should handle his past version
Re: Select AI when missing AI version
I don't think that's an issue fanioz, the save games work for all versions of NoCAB regardlessly. So it'd seem to me as a bug in OpenTTD.
Re: Select AI when missing AI version
If it does, make sure OpenTTD knows that by creating a function MinVersionToLoad in info.nut.Morloth wrote:I don't think that's an issue fanioz, the save games work for all versions of NoCAB regardlessly. So it'd seem to me as a bug in OpenTTD.
But it's indeed unwanted behavior, and I'm working on it.
Re: Select AI when missing AI version
Wasn't aware of this function, but I'll implement it thanks for the heads upYexo wrote:If it does, make sure OpenTTD knows that by creating a function MinVersionToLoad in info.nut.Morloth wrote:I don't think that's an issue fanioz, the save games work for all versions of NoCAB regardlessly. So it'd seem to me as a bug in OpenTTD.
But it's indeed unwanted behavior, and I'm working on it.

Re: Select AI when missing AI version
Just fixed this. The current behavior (r16651) is the following. As soon as one step succeeds, the sequence is stopped.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Calling the AI Load() function is only done when either 1. or 2. succeeds. When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Calling the AI Load() function is only done when either 1. or 2. succeeds. When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.
Re: Select AI when missing AI version
Fixed this in NoCAB as well, thanks again
.

Re: Select AI when missing AI version
Yexo wrote:Just fixed this. The current behavior (r16651) is the following. As soon as one step succeeds, the sequence is stopped.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Calling the AI Load() function is only done when either 1. or 2. succeeds. When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.

I think there are other function for Info.nut : (which is used in latest Trans )
Code: Select all
function CanLoadFromVersion(version)
{
return version < currentversion ;
}
- George
- Tycoon
- Posts: 4364
- Joined: 16 Apr 2003 16:09
- Skype: george-vb
- Location: Varna, Bulgaria
- Contact:
Re: Select AI when missing AI version
Sorry, not clean here. If I have AI ver 1 in savegame and ver 2 loaded, who does not define MinVersionToLoad, does it mean that random AI will be loaded? Or GetVersion here means the version of AI in the savegame, not the version of AI loaded?Yexo wrote:When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.
Re: Select AI when missing AI version
That function has been been obsolete for several months nowfanioz wrote:I think there are other function for Info.nut : (which is used in latest Trans )Is it obsoleted now ?Code: Select all
function CanLoadFromVersion(version) { return version < currentversion ; }

Both MinVersionToLoad and GetVersion are functions in info.nut, so the are defined b the AI you have. What this means is that the AI won't get the AI savegame data that is stored. An AI with the same name will alwas be prefered over an AI with a different name.George wrote:Sorry, not clean here. If I have AI ver 1 in savegame and ver 2 loaded, who does not define MinVersionToLoad, does it mean that random AI will be loaded? Or GetVersion here means the version of AI in the savegame, not the version of AI loaded?Yexo wrote:When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.
Re: Select AI when missing AI version
Oh my godYexo wrote: That function has been been obsolete for several months now![]()

After seeing this steps : ...George wrote:Sorry, not clean here. If I have AI ver 1 in savegame and ver 2 loaded, who does not define MinVersionToLoad, does it mean that random AI will be loaded? Or GetVersion here means the version of AI in the savegame, not the version of AI loaded?
It will halt at step 3. Where the AI run without any knowledge of saved data in previous saved game. Never reach step 4 unless there is no AI of the same name.Yexo wrote:Just fixed this. The current behavior (r16651) is the following. As soon as one step succeeds, the sequence is stopped.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Calling the AI Load() function is only done when either 1. or 2. succeeds. When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.

Re: Select AI when missing AI version
In my opinion 1. should never be done. Currently I have some savegames with AdmiralAI.20 when I load them the game find that version which just happens to break/crash because it is taking too long to start.Yexo wrote:Just fixed this. The current behavior (r16651) is the following. As soon as one step succeeds, the sequence is stopped.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Calling the AI Load() function is only done when either 1. or 2. succeeds. When MinVersionToLoad is missing the return value is assumed to be the same as GetVersion, so no loading from older AI versions.
And I know I manually could remove that broken .tar, but relying on every casual player to do that is flawed.
Even when I click the reload button in the UI it sticks with the broken version, but thats an issue for a different thread: http://www.tt-forums.net/viewtopic.php? ... 00&start=0
- George
- Tycoon
- Posts: 4364
- Joined: 16 Apr 2003 16:09
- Skype: george-vb
- Location: Varna, Bulgaria
- Contact:
Re: Select AI when missing AI version
agreeChruker wrote:In my opinion 1. should never be done.Yexo wrote:Just fixed this. The current behavior (r16651) is the following. As soon as one step succeeds, the sequence is stopped.
1. Try to load the exact same version of the same AI.
2. Try to load the latest version of the same AI that supports loading data from the saved version. (version of saved AI >= return value of MinVersionToLoad)
3. Load the latest version of the same AI.
4. Load a random AI.
5. Load the dummy AI.
Who is online
Users browsing this forum: No registered users and 5 guests