AroAI - v1.2

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

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

AroAI - v1.2

Post by Lord Aro » 31 Jul 2010 18:23

AroAI - Lord Aro's feeble attempt at making an AI. Currently buses only.

Well, I've managed it. I've made my own working AI!
It can currently only use buses, but can max out the default vehicles count within 5 years and be sitting on a £2m pile of cash as well.
AroAI HQtown.png
HQtown
AroAI HQtown.png (335.53 KiB) Viewed 23169 times
AroAI Map.png
Routes built in under 5 years
AroAI Map.png (13.09 KiB) Viewed 23169 times
The AI uses 1.1 API so you have to have at least r20563/1.1.0-beta1 to use this!

Download it below or from Bananas.

Comments, problems and suggestions are always welcome.

AROAI CHANGELOG

Code: Select all

1.2 (2011-04-15)
------------------------------------
- Feature: New version system (r7-r13)
- Add: Don't reset the company information on load (r15)
- Add: Automatic versioning of readme.txt (r26)
- Change: Rewrite the readme (r24)
- Change: Add 96 to the version compared with the HG repo revision, so there are no incompatibilities caused by the lower version number (r19-r23)
- Change: Switch to openttdcoop hg repo (r-numerous)
- Change: Make the AI un-sexist (r18)
- Fix: A possible infinite loop if no path was found (r27)


------------------------------------ Archived Changelog from the SVN repo ------------------------------------
1.1.1 (2010-12-29)
------------------------------------
- Fix: A temporary fix for an invalid engineID (r96)
- Add: GetEventName() so AI can print event names (r95)
- Add: Some debugs (r94)
- Codechange: some variables were global when they didn't have to be (r93)
- Codechange: Put lots of numbers into constants (r92)
- Change: AutoRenewMonths to -6 (r91)
- Codechange: A variable didn't have a very explanatory name (r90)
- Fix: A building of road failure didn't actually stop the building of roads (r89)
- Doc: Standardise comments (r88)
- Codechange: Standardise some debugs (r87)
- Clean-up: Delete unused variable (r86)
- Fix: BuildBusStop() was using wrong sqrt function (built-in instead of in code) (r85)
- Codechange: Merge BuildRoadDepot() and BuildBusStation() functions (r84)
- Codechange: Combine some unneeded event manager variables (r83)
- Change: Warning debugs were actually errors(ish) (r82)
- Codechange: Merge 2 if statements because they had the same output (r81)
- Fix: Out of money debug was appearing more than necessary (r80)
- Fix: Event debug was appearing when it shouldn't have (r79)
- Change: Increased manageOnly sleeping time (r78)
- Codechange: Make coding style more like OpenTTD (r77)
- Codechange: Make the company naming block a switch block (r76)
- Codechange: Streamline the build bus route code a bit (r75)
- Fix: Another possible lock when another AI built where AI was going to build (r74)

1.1.0.1 (2010-08-22)
------------------------------------
- Fix: Debug not changed properly [Brumi] (r73)

1.1.0 (2010-08-21)
------------------------------------
- Codechange: Simplify the sign remover (r72)
- Change: A debug in loan management to something that makes better sense (r71)
- Feature: Build Bus Stations when drive through bus stations cannot (r70)
- Add: noai.openttd.org url (r69)
- Fix: Rewrite build depot code as when out of money the AI could freeze/not build the depot (r68)
- Change: Fiddle around with build route errors (r67)
- Fix: AIAbstractList has been replaced with AIList, so needed to upgrade. AI NOW REQUIRES r20563 OR LATER (r66)
- Feature: Deal with build road depot errors (r65)
- Change: An Error() to a Warning() in Stop(); to make it clearer (r64)
- Codechange: Rename debugs.nut to util.nut and move some functions into it (r63)
- Feature: Reformed debug output (r62)
- Feature: Events Manager (r61)
- Change: Some debugs in manager.nut (r60)

1.0.2 (2010-08-09)
------------------------------------
- Add: Forum url (r59)
- Fix: Variable not declared properly in vehiclemanager.nut (r59)
- Codechange: Rename moneymanager.nut to manager.nut in preparation for something... (r58)
- Fix: Display town name in GetTowns (r57)
- Add: Properly limit AI to management only when vehicle limit reached or unable to build bus route properly (r56)

1.0.1 (2010-08-02)
------------------------------------
- Fix: A debug output was an Info instead of a Warning (r55)
- Fix: When out of money, the AI would not build the route properly [Brumi] (r54)

1.0.0 (2010-07-31)
------------------------------------
First release of AroAI (r53)
- Feature: Bus support

See readme.txt for more info
AroAI-1.2.tar
(80 KiB) Downloaded 1263 times
Hope you enjoy the AI,
and that the first person to download it doesn't get an error straight away,
Lord Aro
Last edited by Lord Aro on 15 Apr 2011 09:36, edited 14 times in total.

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 01 Aug 2010 06:44

(reserved for more screens)
AroAI FIRST PROFIT.png
My AI's first ever profit!
AroAI FIRST PROFIT.png (52.76 KiB) Viewed 23025 times
Last edited by Lord Aro on 02 Aug 2010 09:01, edited 1 time in total.
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

User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: AroAI - V1.0.0

Post by fanioz » 01 Aug 2010 09:05

Congratulation...
Lord Aro wrote:EDIT: i can't seem to upload it to bananas - Unexpected error while uploading
I've got that same error sometime ago, but that is because the unsupported license . So, what is the license you've set for the AI?
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 01 Aug 2010 09:15

only gpl 2 :?
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

User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: AroAI - V1.0.0

Post by fanioz » 01 Aug 2010 10:53

Thats right. What about the tar content? Is there any other text except ai script?
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 01 Aug 2010 11:09

Its exactly the same as the download above
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

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: AroAI - V1.0.0

Post by Zuu » 01 Aug 2010 11:16

If you tried to upload to bananas the same tar file that you have uploaded to the forums, then you could try to create a new tar file where you remove the COPYING file. When you select the GPL 2 license on the upload page, it will try to add a standard COPYING file. When I reread the Terms of Service it does not actually state that you must not include a copying file if you select a non-custom license. The only thing could be is that they use lower-case letters for the COPYING, README and LICENSE files.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: AroAI - V1.0.0

Post by Brumi » 01 Aug 2010 18:06

Congratulations Lord Aro! :D Considering that you did it without any programming experience beforehand, it's a great achievement. :))

I gave it a short test (I will test it more of course :) ) and there was no crash. But the AI has problems when it doesn't have enough money to finish a road.
not enough money.png
not enough money.png (52.4 KiB) Viewed 23099 times
And again, congratulations for the first release :)

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 02:38

@Zuu

nope, removing the COPYING file hasn't worked
i'm trying to input this infomation, see anything wrong with it:

edit: remove attachments becasue problem fixed

@Brumi
Thanks! :D

@Brumi's AI problem
are you sure it was just that it didn't have enough money? could you possibly post the debug? because when it doesn't have enough money to build a road it's supposed to wait for a while (500 ticks) before trying again. In fact, i've seen it do it properly my self. Even so, expect an update soon!
Edit: although, i've never seen it have a problem with the same tile twice, so maybe that's the problem area
Last edited by Lord Aro on 05 Aug 2010 12:32, edited 1 time in total.
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

User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: AroAI - V1.0.0

Post by fanioz » 02 Aug 2010 03:04

Have u tried to remove all file except only *.nut file?
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 03:17

just have!
no...
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

User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: AroAI - V1.0.0

Post by fanioz » 02 Aug 2010 04:00

Last effort ...
Try upload this
Attachments
AroAI-1.0.0(r53).tar
(40 KiB) Downloaded 355 times
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 04:57

thats got it! :mrgreen:
AI is now on BaNaNaS!!
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

Brumi
President
President
Posts: 904
Joined: 18 Jul 2009 17:54

Re: AroAI - V1.0.0

Post by Brumi » 02 Aug 2010 07:51

Lord Aro wrote:@Brumi's AI problem
are you sure it was just that it didn't have enough money? could you possibly post the debug? because when it doesn't have enough money to build a road it's supposed to wait for a while (500 ticks) before trying again. In fact, i've seen it do it properly my self. Even so, expect an update soon!
Sorry I don't have the savegame, but I remember that there were many yellow 'Waiting for money' lines in the debug window. Later the AI seemed to turn to other things.

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 08:51

Update!

Changelog:
1.0.1 (2010-08-02)
------------------------------------
- Fix: When out of cash, the AI would not build the route properly (Brumi) 8)
- Fix: A debug output was an Info instead of a Warning

download in first post or off bananas

total downloads as of posting: ~16! :mrgreen:
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

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

Re: AroAI - V1.0.0

Post by Rubidium » 02 Aug 2010 09:08

Lord Aro wrote:EDIT: i can't seem to upload it to bananas - Unexpected error while uploading
Congratulations! You are the first (of over 1000 BaNaNaS uploads) that used '(' or ')' in their filename, so we didn't know that that would break the uploading. Now it should be quite a bit sturdier and allow such uploads! Or in other words: the failure to upload should be resolved now.

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: AroAI - V1.0.0

Post by Zuu » 02 Aug 2010 11:30

Congratulations to getting your AI ready for a first release. I decided to give it a test run, but it had problems with my settings.

Problem:When building drive through stations on town roads is disabled, then the AI fails to build road stations instead of falling back to building them on new/own road.
Attachments
Unnamed, 26th May 1965.png
(68.02 KiB) Downloaded 2 times
AroAI.sav
Saved with nightly r20279.
(51.43 KiB) Downloaded 336 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 11:38

Thanks Zuu, its near the top of my todo list (which is quite lengthy - 15+things - see readme or main.nut for full list)
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

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: AroAI - V1.0.0

Post by Samu » 02 Aug 2010 14:42

I don't see it on banana :(

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2365
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: AroAI - V1.0.0

Post by Lord Aro » 02 Aug 2010 16:01

I'm going to be answering a lot of this - AroAI is the first AI released to use 1.1API (i think) so you need a recent nightly to use this
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

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests