API changes at 2009-01-13

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

API changes at 2009-01-13

Post by TrueBrain »

In todays nightly (which runs in 17 hours), the Load() function is changed. It now is:

Load(version, data)

The 'version' was added. This indicates the version of your AI which made the save-data. Useful if you want to be able to load save-data of your older AIs.

Also introduced is 'CanLoadFromVersion(version)' in info.nut, which can return 'true' to indicate Load can handle the savedat for a given 'version'.
The only thing necessary for the triumph of evil is for good men to do nothing.
El Duderino
Engineer
Engineer
Posts: 2
Joined: 22 Nov 2008 17:50

Re: API changes at 2009-01-13

Post by El Duderino »

The NOAI framework is excellent! And I appreciate the awesome work, but I have a question.
Is it possible avoid breaking the NOAI API if it is not nessecarry? I mean... twice in two days? It means that all the published AI's have to be updated, which is likely not going to happen often and/or soon. At the moment only your admiralai works, as you have broken all the other ones.

I understand that NOAI is under active development, but for example this break could have easily have been avoided by adding a seperate load_version call instead of breaking 'load'


Thanks,
Remco
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: API changes at 2009-01-13

Post by Rubidium »

But that would keep AIs with 'flawed' behaviour running about. Once a stable release has been made there should be virtually no changes to the API anymore. It's just that now it hit trunk more people are testing stuff and thus finding more flaws.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: API changes at 2009-01-13

Post by Zutty »

As an AI writer I appreciate the tireless efforts of our lovely devs :D

This is a good feature.
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests