Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Oct 22, 2018 2:29 am

All times are UTC




Post new topic  Reply to topic  [ 20 posts ] 
Author Message
 Post subject: RoadAI
PostPosted: Thu Sep 01, 2011 7:52 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
I would like to present my first AI, RoadAI.

This AI will build a rapidly expanding road network. It is currently in
early development so please tell me if you find any bugs so that I can
improve it. The AI works best in the temperate or subarctic regions.

This AI uses Superlib v13. Save and Load is currently unsupported.

You may need to extend your vehicle limit from 500 since the AI builds vehicles
very quickly!


Attachments:
File comment: RoadAI-1
RoadAI-1.tar [31 KiB]
Downloaded 557 times
Top
   
 Post subject: Re: RoadAI
PostPosted: Thu Sep 01, 2011 9:24 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Nice to see someone doing something different than the typical point to point connection concept.

I'm also happy to see that you've built ontop of the SuperLib library and thus has been able to do this much on just 696 lines of code. I do have to say however, that the code is a bit more compact than my taste of writing code. But it is your AI and your decision how you like to write your code. :-)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: RoadAI
PostPosted: Thu Sep 01, 2011 10:10 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Hello again,

Your AI can sometimes build a huge amount of stations.
Attachment:
Unnamed, 11th Jul 1981.png [190.07 KiB]
Downloaded 2 times

Attachment:
File comment: Used "Last nightly" => trunk version r22864
RoadAI_test.sav [213.81 KiB]
Downloaded 173 times


(Edit: this game started in 1950, so some overcrowdyness is to be expected after 30 years of gameplay, but not to this extent)

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Sep 02, 2011 12:24 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Feb 07, 2011 10:04 pm
Posts: 1183
Location: East Coast, United States
Zuu wrote:
Hello again,

Your AI can sometimes build a huge amount of stations.
Attachment:
Unnamed, 11th Jul 1981.png

Attachment:
RoadAI_test.sav


(Edit: this game started in 1950, so some overcrowdyness is to be expected after 30 years of gameplay, but not to this extent)

Didn't Paxlink have the same issue? I remember having a game with an old version of Paxlink where the entire city was plastered with bus stations.

How did you solve that?

_________________
Like my avatar? See my screenshot thread
Chill's Patchpack, an awesome collection of OTTD patches


Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Sep 02, 2011 4:34 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
Here is the next release for RoadAI. I only made a couple of fixes

Zuu wrote:
Hello again,

Your AI can sometimes build a huge amount of stations.

(Edit: this game started in 1950, so some overcrowdyness is to be expected after 30 years of gameplay, but not to this extent)


I tried to address this issue by preventing the RoadAI from adding more than one network per town.

I also added another AI Setting which controls the maximum number of road networks the AI may make.

Thank you for all of your suggestions!


Attachments:
File comment: RoadAI Version 2
RoadAI-2.tar [31.5 KiB]
Downloaded 111 times
Top
   
 Post subject: Re: RoadAI
PostPosted: Sun Sep 04, 2011 1:13 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 885
I gave your AI a try, here are my remarks:

I think the AI could have placed the bus station better here:
Attachment:
screenshot1.png [298.03 KiB]
Downloaded 2 times


Road construction often fails for some reason, maybe the AI ran out of money while building the road and didn't increase its loan?
Attachment:
screenshot2.png [150.3 KiB]
Downloaded 2 times


In my test, the AI has only settled in three towns by the year 1964. I have town density set to low, and every seventh town is a city.


Top
   
 Post subject: Re: RoadAI
PostPosted: Sun Sep 04, 2011 2:45 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
Brumi: Do you happen to have the save game with the town in screenshot 1?

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: RoadAI
PostPosted: Sun Sep 04, 2011 5:24 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 885
Sorry, I don't have it. SuperLib related issue?


Top
   
 Post subject: Re: RoadAI
PostPosted: Sun Sep 04, 2011 9:12 pm 
Offline
OpenTTD Developer
OpenTTD Developer
User avatar

Joined: Mon Jun 09, 2003 6:21 pm
Posts: 4538
Location: /home/sweden
I would recommend using SuperLib.Road.BuildStopInTown(town, road_veh_type, accept_cargo = -1, produce_cargo = -1) over using Road.BuildBusStopNextToRoad as the later does not allow specifying cargo that the bus stop should accept. I think however, that future versions of the library should probably allow passing the accept_cargo and produce_cargo params to Build*NextToRoad as well as the higher-level functions that takes a town or industry rather than a tile as argument for where the road station should be placed.

I'm not sure exactly what the choose rule is if you have both accept_cargo == -1 and produce_cargo == -1 which is the case when you use Build*InTown. IIRC it is distance from center, but I dont exactly remember. (it could actually be preferring as far as way from center as possible as that is the behaviour for airports without cargo requirement specified)

It is also worth to mention that RoadAI use min_loops == 25, while CluelessPlus (Road.BuildStopInTown) have it at 50. This setting decide how many steps the algorithm will walk around in the town before settling with the best solution so far.

_________________
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)


Top
   
 Post subject: Re: RoadAI
PostPosted: Thu Oct 13, 2011 11:22 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
Here is the next (and possibly final) release of RoadAI.
This is a picture of the improvement:

Attachment:
File comment: Breakdown of AI Improvement
Green is RoadAI v3
Yellow is RoadAI v2

Capture.PNG [72.66 KiB]
Downloaded 2 times


This is a very rough list of the new features:

1. Greatly improved speed (which actually changes much of the behavior of the AI in many areas :D )

2. Now can mass upgrade vehicles

3. More dynamic vehicle orders (as in vehicles may go to a larger variety of towns in the network)

3. Other various fixes (including a some recommended on this thread)

I am planning on creating a new AI with the majority of this AI's code simply because I feel limited by the name of the AI and I would like to add air, and possibly train support :wink: .


Attachments:
RoadAI-3.tar [34 KiB]
Downloaded 135 times
Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Oct 14, 2011 11:11 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Thu Jun 25, 2009 4:42 pm
Posts: 2364
Location: Location, Location
there's no problem with changing the name of the AI... i think... as long as you keep the shortname the same (?) (you might want someone to check that)

_________________
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


Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Oct 14, 2011 11:42 am 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 21, 2007 11:47 am
Posts: 6559
Location: The Netherlands
Though you cannot change the name of a BaNaNaS entry.

If you consider this AI "done", I'd keep it as it is. Just get a new (short)name for your new AI. It's not that we're particularly short on shortnames.

_________________
FooBar's Tram Tracks | TransRapid Track Set | Metro Track Set | OpenGFX base graphics set | FIRS Industry Replacement Set
Dutch Tram Set | Dutch Trainset 2 | Dutch Road Furniture


Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Oct 14, 2011 5:57 pm 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
OK I see what you mean. If it becomes and issue I hope there is an admin that I can talk to to help me change it. Keep in mind that this AI will still accept bug fixes if you find any bugs that may go into my new AI!


Top
   
 Post subject: Re: RoadAI
PostPosted: Sat Oct 15, 2011 12:54 pm 
Offline
Chairman
Chairman

Joined: Sat Jul 18, 2009 5:54 pm
Posts: 885
I've tried the new version, a problem which I reported earlier still exists, the AI sometimes cannot finish road construction for some reason, probably it is out of money. It would be good if the AI took some loan in this case, or the AI could simply take the maximum loan while constructing a road, then pay it back after construction.


Attachments:
roadai.png [195.76 KiB]
Downloaded 2 times
Top
   
 Post subject: Re: RoadAI
PostPosted: Sat Oct 15, 2011 5:16 pm 
Offline
Engineer
Engineer

Joined: Sun Oct 25, 2009 9:56 am
Posts: 69
Location: Belgium
You could try putting something like this?

Code:
if(!buildRoadCommand())
{
if(AIError.GetLastErrorString()=="ERR_NOT_ENOUGH_CASH")
{
AICompany.SetLoanAmount(AICompany.GetLoanAmount() + AICompany.GetLoanInterval());
buildRoadCommand()
}
}

_________________
--------------------------------------------------
MailAI, a casual postal service for openTTD.
--------------------------------------------------


Top
   
 Post subject: Re: RoadAI
PostPosted: Tue Sep 20, 2016 8:02 am 
Offline
Tycoon
Tycoon

Joined: Wed Aug 26, 2009 6:33 am
Posts: 2493
Location: Poland
crash


Attachments:
Selection_004.png
Selection_004.png [ 13.86 KiB | Viewed 2386 times ]
Selection_005.png
Selection_005.png [ 3.57 KiB | Viewed 2386 times ]

_________________
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Top
   
 Post subject: Re: RoadAI
PostPosted: Sat Oct 08, 2016 3:06 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
RoadAI-4

Kogut wrote:
crash

* Should be resolved
* Updated to SuperLib v39
* Updated to GPL v3


Attachments:
RoadAI-4.tar [70 KiB]
Downloaded 29 times
Top
   
 Post subject: Re: RoadAI
PostPosted: Fri Aug 17, 2018 3:47 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 225
crash with wrong number of parameters


Attachments:
Unnamed, 1968-03-29.png [262.14 KiB]
Not downloaded yet

_________________
Formerly known as Samu
Top
   
 Post subject: Re: RoadAI
PostPosted: Sun Sep 30, 2018 12:16 pm 
Offline
Traffic Manager
Traffic Manager

Joined: Thu Feb 26, 2015 12:52 am
Posts: 225
Crash after loading savegame.


Attachments:
Unnamed, 1974-03-26.sav [4.65 MiB]
Downloaded 11 times
Unnamed, 1974-05-04.png [293.37 KiB]
Not downloaded yet

_________________
Formerly known as Samu
Top
   
 Post subject: Re: RoadAI
PostPosted: Wed Oct 03, 2018 4:18 am 
Offline
Engineer
Engineer

Joined: Thu Sep 01, 2011 7:23 pm
Posts: 92
Location: Oregon, USA
xarick wrote:
crash with wrong number of parameters


yea that crash was pretty stupid, and old!

Here is the fixed version, for both of the issues you sent, xarick


Attachments:
RoadAI-5.tar [70 KiB]
Downloaded 8 times
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 20 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.