NotPerfectAI

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
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

NotPerfectAI

Post by RolandKnight »

Features:
  • created entirely from scratch (no dependencies)
  • uses all kinds of transport (including NewGRFs)
  • connects industries and towns (and any combination of them)
  • fast and accurate decision algorithm
  • fast road / rail / water pathfinder
  • fast road / rail builder
  • compatible with many popular NewGRFs
If the AI crashes, freezes or behaves incorrectly please let me know here or using my email: grzegorzabedzki@gmail.com . Any feedback appreciated :D

Github: https://github.com/hakerg/NotPerfectAI

License: CC-BY v3.0
Attachments
NotPerfectAI.zip
Version 1.3
(29.55 KiB) Downloaded 97 times
NotPerfectAI.zip
Version 1.5
(36.35 KiB) Downloaded 17 times
Last edited by RolandKnight on 24 Feb 2021 13:04, edited 8 times in total.
Brumi
President
President
Posts: 913
Joined: 18 Jul 2009 17:54

Re: NotPerfectAI - a new competitive AI

Post by Brumi »

I wanted to give it a test run, but it crashes right on startup:
screen.png
(33.74 KiB) Not downloaded yet
AI was downloaded using the in-game content downloader. OpenTTD version is 1.10.2, full vanilla game, no NewGRFs.
User avatar
jfs
Tycoon
Tycoon
Posts: 1310
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: NotPerfectAI - a new competitive AI

Post by jfs »

Brumi wrote: 24 Jun 2020 08:06 I wanted to give it a test run, but it crashes right on startup:
screen.png

AI was downloaded using the in-game content downloader. OpenTTD version is 1.10.2, full vanilla game, no NewGRFs.
That's a bug in OpenTTD, it doesn't handle the way this AI has structured the files inside the tar archive.
Issue #8230 has been fixed, the fix will be in a version 1.10.3 if that ever happens, and is already included in the latest nightly builds. As a workaround, you can find the downloaded tar file and unpack it in-place with a tool such as 7zip or WinRar.
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI - a new competitive AI

Post by RolandKnight »

Brumi wrote: 24 Jun 2020 08:06 I wanted to give it a test run, but it crashes right on startup:
screen.png

AI was downloaded using the in-game content downloader. OpenTTD version is 1.10.2, full vanilla game, no NewGRFs.
Fixed
Attachments
NotPerfectAI.zip
Version 1.1
(29.54 KiB) Downloaded 153 times
cjtron
Engineer
Engineer
Posts: 1
Joined: 19 Oct 2020 17:19

Re: NotPerfectAI

Post by cjtron »

dude, how to download??? I cant download through ingame cause it never loads, very slown net,.. and the bananas server thing wont let me download, it says its ingame,,,, such BS

Can you upload it plz
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

cjtron wrote: 19 Oct 2020 17:41 dude, how to download??? I cant download through ingame cause it never loads, very slown net,.. and the bananas server thing wont let me download, it says its ingame,,,, such BS

Can you upload it plz
Hello cjtron,

you can download the newest version 1.3 by clicking the file in the attachment from the main post. Put it in folder located in Documents/OpenTTD/ai (or something similar).

Greetings,
hakerg
User avatar
odisseus
Traffic Manager
Traffic Manager
Posts: 226
Joined: 01 Nov 2017 21:19

Re: NotPerfectAI

Post by odisseus »

Your AI builds way too much rail. Infrastructure maintenance costs consume most of its income.
Attachments
notperfectai-vs-fastptpai.sav
(208.54 KiB) Downloaded 38 times
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

Well, it's very difficult to play with infrastructure maintenance costs enabled even for humans. I will take a look at it one day probably, but I officially stopped developing my AI. I am glad that I achieved my goal of beating all existing AIs. Greetings!
User avatar
luk3Z
Engineer
Engineer
Posts: 93
Joined: 25 Dec 2005 17:42
Location: Poland

Re: NotPerfectAI

Post by luk3Z »

RolandKnight wrote: 11 Feb 2021 11:03 Well, it's very difficult to play with infrastructure maintenance costs enabled even for humans. I will take a look at it one day probably, but I officially stopped developing my AI. I am glad that I achieved my goal of beating all existing AIs. Greetings!
Is it stable enough (at last for few hours) ?
Find new graphics easier:
GRFCrawler -> http://grfcrawler.tt-forums.net
BaNaNaS -> https://bananas.openttd.org/
32 bit gfx in OTTD: https://wiki.openttd.org/en/Community/N ... 20graphics
32 bit gfx comparison: viewtopic.php?f=67&t=88503 Check "online content" button in the game menu % type "32bpp".
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

luk3Z wrote: 11 Feb 2021 12:41
RolandKnight wrote: 11 Feb 2021 11:03 Well, it's very difficult to play with infrastructure maintenance costs enabled even for humans. I will take a look at it one day probably, but I officially stopped developing my AI. I am glad that I achieved my goal of beating all existing AIs. Greetings!
Is it stable enough (at last for few hours) ?
Yes, it should last for at least 30-40 years with infrastructure maintenance costs enabled and infinitely long with this setting disabled
User avatar
odisseus
Traffic Manager
Traffic Manager
Posts: 226
Joined: 01 Nov 2017 21:19

Re: NotPerfectAI

Post by odisseus »

Your AI doesn't replace obsolete vehicles. In fact, this seems to be the main reason why it eventually bankrupts.
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

odisseus wrote: 21 Feb 2021 05:40 Your AI doesn't replace obsolete vehicles. In fact, this seems to be the main reason why it eventually bankrupts.
AI sells unprofitable vehicles every year, so theoretically it should not bankrupt when infrastructure maintenance costs are disabled
User avatar
odisseus
Traffic Manager
Traffic Manager
Posts: 226
Joined: 01 Nov 2017 21:19

Re: NotPerfectAI

Post by odisseus »

How do you detect unprofitability? Do you just look at the vehicle's yearly profit numbers, or do you take into account the upkeep of the infrastructure used by that vehicle? Said infrastructure upkeep can cost quite a lot even without the "infrastructure maintenance costs" setting.
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

odisseus wrote: 21 Feb 2021 22:14 How do you detect unprofitability? Do you just look at the vehicle's yearly profit numbers, or do you take into account the upkeep of the infrastructure used by that vehicle? Said infrastructure upkeep can cost quite a lot even without the "infrastructure maintenance costs" setting.
There is an event that informs AI about negative income of a vehicle, AI just handles these events and sells the vehicles. It does not sell unused infrastructure, because it's difficult to tell which tiles are used and which are not and they do not generate much costs with the setting disabled anyway.
User avatar
odisseus
Traffic Manager
Traffic Manager
Posts: 226
Joined: 01 Nov 2017 21:19

Re: NotPerfectAI

Post by odisseus »

RolandKnight wrote: 21 Feb 2021 23:36 because it's difficult to tell which tiles are used and which are not
Doesn't your AI use an entirely separated stretch of track for every single train? If that's the case, finding unused tracks shouldn't be too difficult.
RolandKnight wrote: 21 Feb 2021 23:36 they do not generate much costs with the setting disabled anyway.
That's just not true. Build enough tracks, and eventually they will weigh down any company, especially with add-ons that change base costs.

Besides, the "infrastructure maintenance costs" setting is quite a common one. Other AIs seem to have no problem with this setting.
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

odisseus wrote: 22 Feb 2021 03:01
RolandKnight wrote: 21 Feb 2021 23:36 because it's difficult to tell which tiles are used and which are not
Doesn't your AI use an entirely separated stretch of track for every single train? If that's the case, finding unused tracks shouldn't be too difficult.
RolandKnight wrote: 21 Feb 2021 23:36 they do not generate much costs with the setting disabled anyway.
That's just not true. Build enough tracks, and eventually they will weigh down any company, especially with add-ons that change base costs.

Besides, the "infrastructure maintenance costs" setting is quite a common one. Other AIs seem to have no problem with this setting.
Ok, I should probably dig into the code and fix it
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

A new version of the AI has been released. Now it sells unused rails and airports to avoid unnecessary maintenance costs. I also fixed an issue with picking roads with too low max speed, slightly improved performance of rail pathfinder and applied some other minor improvements.
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

I see that trams have trouble turning around at the stops, so it is still not perfect AI :wink:
User avatar
odisseus
Traffic Manager
Traffic Manager
Posts: 226
Joined: 01 Nov 2017 21:19

Re: NotPerfectAI

Post by odisseus »

The new version of your AI is still incompatible with infrastructure maintenance. It bankrupted in 15 years despite having the highest income.

In another game, the AI has been doing good for 30 years, although the ratio of property maintenance to income quickly grew to 70% and kept increasing at a slow rate. In year 1986, the property maintenance exceeded the income for the first time, and after year 1990 the AI had a net loss every year. It bankrupted in year 2007, after spending the funds it had amassed during the earlier years.

In yet another game, the AI evolved in the same pattern: it was making good profits for 40 years, after which point it started losing money every year. However, this time I took control of the company and manually replaced every locomotive with the fastest model available. The profits instantly came back.
Attachments
notperfectai-2.sav
(145.31 KiB) Downloaded 8 times
notperfectai-3.sav
(235.84 KiB) Downloaded 6 times
notperfectai-4.sav
(229.12 KiB) Downloaded 6 times
User avatar
RolandKnight
Engineer
Engineer
Posts: 11
Joined: 17 Jun 2020 09:12

Re: NotPerfectAI

Post by RolandKnight »

Thanks for testing @odisseus. I see that replacing old vehicles needs to be implemented
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests