CluelessPlus

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

Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: CluelessPlus

Post by Wasila »

Running CluelessPlus v23 with ChillCore's patchpack. Crashed.
Attachments
British Rail, 7th Aug 1961.png
(122.04 KiB) Downloaded 1 time
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Thanks for your bug report. This will be fixed in the next upcoming release.
planetmaker wrote:I just started a test game I'm running with a couple of AI for the rest of the day. A detailed analysis will follow later, but what I saw when I just looked around the map initially is the behaviour of CluelessPlus on its first bus route: it seems quite overloaded with busses.

All content should be available from either bananas or the devzone.
In the next release, this should be slightly improved as it will not account for the entire town population if it is too large.

Late, but also thanks to you planetmaker for your report.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Update - Version 24

Changes:
  • Bug fixes
  • Mass-upgrade of vehicles when there is a better engine available
  • Buy statues when there is plenty of money
  • Use SuperLib version 7 instead of version 6
Attachments
CluelessPlus-v24.tar
Dependencies: (AI libraries)
Pathfinder.Road - version 3
Queue.FibonacciHeap - version 2
SuperLib - version 7
(230 KiB) Downloaded 173 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: CluelessPlus

Post by planetmaker »

I still had v23 configured and had - rather accidentially - run my machine the whole day and found this crash when I returned home tonight:

Code: Select all

dbg: [ai] [3] [S] Your script made an error: the index 'SellVehicle' does not exist
dbg: [ai] [3] [S] 
dbg: [ai] [3] [S] *FUNCTION [HandleEvents()] CluelessPlus-23.tar/cluelessplus-23/main.nut line [1832]
dbg: [ai] [3] [S] *FUNCTION [Start()] CluelessPlus-23.tar/cluelessplus-23/main.nut line [1570]
dbg: [ai] [3] [S] 
dbg: [ai] [3] [S] [connection] NULL
dbg: [ai] [3] [S] [lost_veh] 1054
dbg: [ai] [3] [S] [lost_event] INSTANCE
dbg: [ai] [3] [S] [ev_type] 13
dbg: [ai] [3] [S] [ev] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [i] 1197
dbg: [ai] [3] [S] [not_build_info_printed] false
dbg: [ai] [3] [S] [last_manage_time] 745691
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] The AI died unexpectedly.
EDIT: you'll need two custom newgrfs which I used in testing versions: ogfx-landscape and ogfx-industries
Attachments
random_AI_test.sav
associated savegame
(685.45 KiB) Downloaded 266 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

I'm quite sure that I've fixed that bug in v24, as it looks very similar to a bug that was reported some time before v24 was released.

It happens whenever the AI receives a vehicle lost event.


Edit: Nevertheless thanks for your report.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: CluelessPlus

Post by planetmaker »

Zuu wrote:I'm quite sure that I've fixed that bug in v24, as it looks very similar to a bug that was reported some time before v24 was released.
Yeah, might be, but I just thought I post it nevertheless. I only noticed I had an older version when I actually wrote this report and saw your posting above with the version update. Seems that the AI config did or does not auto-update to the newest version of an AI when starting new games... I guess I have a feature request for the NoAI framework (for myself?) ;-)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

When loading games it should pick the newest compatible AI. However that feature might be missing in the create new game process?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: CluelessPlus

Post by planetmaker »

Hm, actually it does. I did not update my installed bananas content since then :-P Sorry for the confusion. The next games will now be with v24 :-)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Update - version 25

New feature:
- A setting that when enabled will limit building of new connections so that they will be located near the already existing connections.

It uses a simple bounding box model that grows whenever new connections are built or it fails to find a new connection within the box. This works best on eg 128x2048 maps where the edge of the bounding box will be close to existing connections for the most part of the edge. However, even if the bounding box might be a bit too large if the AI have two connections in a cross, it can happen that it fill up the bounding box and make a square of it.

I should note that it only require one of the two nodes of new connections to be within the bounding box.

The setting has these defaults:
  • easy: On
  • medium: On
  • hard: Off
  • custom: Off
This is just an initial implementation. With more time invested, it is possible to improve it further.
Attachments
CluelessPlus-v25.tar
(230 KiB) Downloaded 179 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Update - version 26

Time to say goodbye to CluelessPlus as road-only AI. :-) This version contains initial support for air services. For now I have only implemented it for town-to-town transport, but support for industries will come in a later version.
Unnamed, 16th May 1971.png
Unnamed, 16th May 1971.png (53.94 KiB) Viewed 5236 times

Mind that CluelessPlus requires several libraries that will be fetched automatically if you download it inside OpenTTD. If you however download CluelessPlus from the link below, you will need to update to SuperLib version 10. Take a look on the first page in this thread for a complete list of dependencies that CluelessPlus requires.
CluelessPlus-v26.tar
(180 KiB) Downloaded 149 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Update - version 27
A quick bugfix-release. By mistake I had left some code that filtered the loading of connections to only look at road vehicles. Thus only road connections were loaded. This has been fixed now.

At the moment it will load also rail and ship connections. Hopefully that will not break anything, but I haven't made any tests to see if it really can handle those kind of connections as it can't build them yet and I haven't tried to make it take over from any other AI.


In addition, this release contains a few minor tweaks such as improved cleanup of vehicles with invalid orders and temporary removal of full load orders if a station sees very high usage. (In my tests, I found a case when the temporary link closure for secondaries didn't kick in and it didn't sell vehicles quick enough to reduce the blocking for delivery trucks (there was a small delivery stream from another direction that kept the industry "alive"))
Attachments
CluelessPlus-v27.tar
(180 KiB) Downloaded 155 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Update - version 28

CluelessPlus can now upgrade airports.

Please note that until FS#4704 has been implemented in the OpenTTD version that you use, you should enable "airports never expire" in advanced settings. If not, the AI will think that an airport that has expired has a noise generation of -1. Thus when trying to upgrade that airport, the AI will think that the available noise budget of a town is 4 too low for the small airport. Thus, it will take very long before the AI thinks it is okay to upgrade airports that has expired.

Have fun and please report back if the AI crashes or does something silly.
CluelessPlus-v28.tar
Requires SuperLib v11. See first post on dependencies.
(220 KiB) Downloaded 151 times
One sillyness that is known is that the AI is good at buying too large aircrafts for connections with little cargo. Resulting in just one big aircraft instead of several small. When the rating drops of the airport that has no aircraft, the AI buys a new one (if it can afford) and may continue to do this until the rating drops again, and then sell all but one aircraft. This may repeat quite often resulting in lots of passengers/mail being "sold" in the depot for no profit.

Eddi proposed a solution to this: make sure vehicles are empty before selling them. For now I haven't implemented this as it needs some tweaking on when to apply this technique as it can't be used when vehicle selling is done in order to loosen up a jam situation.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
krinn
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 29 Dec 2010 19:36

Re: CluelessPlus

Post by krinn »

Zuu wrote:Eddi proposed a solution to this: make sure vehicles are empty before selling them. For now I haven't implemented this as it needs some tweaking on when to apply this technique as it can't be used when vehicle selling is done in order to loosen up a jam situation.
if empty no sell
if name = jam sell (empty or not), so just rename a jam vehicle, even one might not like a vehicle name "jam" or "jamX04334" this will solve your problem easy and the name will be kept until the vehicle is sold, a small interval
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: CluelessPlus

Post by Brumi »

Wow! :D
I'm glad to see that CluelessPlus is getting new vehicle types. I'm trying it out right now...

EDIT:
The AI has crashed, see the screenshots.
Attachments
crash 1.png
crash 1.png (33.19 KiB) Viewed 649 times
crash 2.png
crash 2.png (29.54 KiB) Viewed 649 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Hey Brumi! Thanks for your report. That one is because I've spelled AIGameSettings wrong without an 's' at the end. I have a newer version in the pipeline that doesn't have this issue. As soon as I get time to test it quickly and get it out, I'll release it as the current version clearly have issues.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: CluelessPlus

Post by Brumi »

Can I make a feature request? AFAIK all AIs that handle multiple vehicle types have settings to enable/disable particular vehicle types. I think this should be there in CluelessPlus as well.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

I have thought about that but for now i revly on the OpenTTD settings for that. If adding it to CluelessPlus, I want to transparency handle it in the SuperLib helper functions that using a single call checks several ways OpenTTD can turn off a transport mode. This however enforce the internal name of those settings on all users of the librabry. So I will have to browse through some AIs and see if there is a consensus. Still some way of overriding/setting other setting names will probably be needed unless there really is a broad consensus.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

Version 29

Changes:
  • Fix of the GameSettings error reported above.
  • AI Settings to enable/disable individual transport modes for a specific CluelessPlus instance. (disabling a transport mode for all companies or all AI companies is already possible in Advanced Settings)
  • Can use articulated road vehicles (if building of drive-through-stops (DTRS) terminated with a depot is allowed in the AI Settings)
  • At a small chance DTRS are built also for non-articulated RVs. (unless they are disabled in the AI Settings)
  • Use SuperLib v12
Download:
Preferable download CluelessPlus through the in-game online content system. That way you don't have to care about the dependencies.

For manual download, make sure to also read the first post in this thread on dependencies.
CluelessPlus-v29.tar
(230 KiB) Downloaded 145 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: CluelessPlus

Post by Brumi »

I've just had a crash with CluelessPlus. It's v28, as I forgot to update the AI, but maybe you haven't met this bug so far.
Attachments
crash.png
crash.png (33.27 KiB) Viewed 4910 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: CluelessPlus

Post by Zuu »

I've seen this bug myself without being able to track it down. I've looked in the library code where it crashes but can't figure out why it happens. It seem to happen late into games and I have even got saves that easily reproduce it, but I haven't been able to solve it.

Thanks for reporting it. I was starting to wondering if this was a hardware failure or something as I have been staring at it without being able to figure out what is wrong.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests