Why OpenTTD should have a default AI

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
Wuzzy
Engineer
Engineer
Posts: 66
Joined: 18 Aug 2019 18:04

Why OpenTTD should have a default AI

Post by Wuzzy »

Currently, when you install a fresh OpenTTD, you will find a major feature missing: AI. There's no AI. :( So if you just jump into the game like you used to in TTD, you will be forever alone. Without competition the game is kinda boring.

OK, of course that was a lie. Of course there's AI. What I actually mean is that there is no AI by default. But that's the problem! I know what I am supposed to do, i.e., download an AI from the download section, but that's besides the point.

My problem is that the way this is currently implemented is user-unfriendly. There are several problems:
  • :!: The lack of a functioning default AI is a major downgrade compared to TTD. This is a direct violation of one of the official goals: “Replicate the original gameplay”
  • Computer enemies do not work out of the box. They require additional installation and configuration. This is bad usability, and I don't see why.
  • (apparent) lack of quality control. There are a couple of AIs that are just outright broken and crash and completely ruin the game! Yet they appear in the in-game download service.
  • Too much trial-and-error: There are a lot of AIs, and many of them are not general-purpose. It will take players a lot of time until you finally find an AI that you can actually use to play against. Many AIs are too specialized, which is fine, but normally you want opponents that at least are capable of using all modes of transportation. Having a default AI would take the burden of “reseach” off the player
  • Annoying to get rid of “bad” AIs: If you have downloaded an AI that is bad (crashes, too many bugs), it's annoying to get rid of it again. It seems you must go into the OS's file system for that … :(
  • Of those AIs that are not outright broken, still many are not very good. Some AIs just do silly or annoying things, like placing annoying signs everywhere, or even advertisements, or giving their stations crazy names with long complicated number codes that just feel “unnatural”. Or they place stations in insane places where they just don't make sense. Nothing really game-breaking, but these minor annoyances add up
  • I don't know if it's true, but I don't know how many newbies completely fail to realize they are supposed to open the extensions menu to get a functioning AI. I mean, the game doesn't tell them. They will probably just start playing without AI, wondering where the other companies are …
  • AI development seems to be completely outsourced to the community. So IMHO most AIs don't seem to be held to high quality standards in general. Correct me if I'm wrong.
Therefore, I suggest to include at least one good, general-purpose, high-quality AI by default, and that this AI will be enabled by default. This AI must work out of the box in a fresh install, no additional installation, download or configuration required. Of course, I do NOT suggest to abolish the add-on system at all, just to make OpenTTD playable out of the box.

Wish list for a default AI:
  • Be high-quality overall and be held to the same standards as OpenTTD itself
  • Support all 4 modes of transportation (that doesn't mean it always has to use all of them in a game, only that it's capable of)
  • Support all vehicles
  • Support all industries and goods
  • Support all important buildable things
  • Connect industries and cities
  • Do nothing silly or annoying, like spamming with signs, use crazy station names, etc.
  • Never crash
  • Be suitable for a classic game of OpenTTD
  • Be more or less be like TTD's AI (as long it makes sense; the goal of OpenTTD is being a TTD clone, after all)
  • Bonus points for having a difficulty setting
Maybe one of the existing AIs already checks most or all of the boxes and just requires little modification to be “promoted” to default status. :)

TBH, I am quite surprised that OpenTTD managed it to version 1.9.2 yet that such a core feature is kind of “tricky” to get to work … :roll:
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7239
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Why OpenTTD should have a default AI

Post by Redirect Left »

There definitely should be a decent AI active by default when you download OpenTTD. I tried to introduce a friend to OpenTTD and he got so confused by the AI stuff and finding a decent AI in the online files he just gave up.

A lot of the AI on the forums here eventually error out with varying errors, entirely ruining things after sometimes a long play with them. It seems to be usually related to them eventually struggling to do X or Y within a CPU timeframe the game is happy about.
As a secondary point, making an AI is very tricky and silly difficult to do, i've tried a few times but within an hour got bored of even trying, its just an odd language and way of creating something i find.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
User avatar
Wuzzy
Engineer
Engineer
Posts: 66
Joined: 18 Aug 2019 18:04

Re: Why OpenTTD should have a default AI

Post by Wuzzy »

Thanks for your answer! Heh, turns out I was completely right about the usability argument. To be clear, I am a power user and I usually don't get confused by this stuff. But I know crappy UX when I see it. That's the whole point of having a default. :)

Anyway: Well, who says you need to make the AI from zero? There's already a couple of readily-available AIs, so I'd say just pick one that is closest to being a reasonable default AI, and build on that.

I also suggest to not be perfectionistic about it, at first. Just make sure it doesn't crash and ruin the game first and behaves semi-reasonable. The rest can come over time … Otherwise, we will never have a default AI for years to come because of whatever.

IMO having a mediocre default AI is still 1000 times better than having no AI at all and having newbies being confused forever. Heck, this system even sucks for advanced users such as me, I just don't want to try out dozens of AIs, many of which are crap.

I think SimpleAI seems like a good start. But I haven't tried out many general-purpose AIs yet. Please suggest other AIs that could be a potential default (after fixing, cleanup, etc.).

Slightly off-topic, I think the whole list of downloadable AIs needs to be curated. At the very least, all crashing AIs should be banned, no exceptions. There's absolutely no point in providing broken add-ons. Even worse: It ruins the gameplay experience to have an AI die in the middle of a game.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7239
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Why OpenTTD should have a default AI

Post by Redirect Left »

Wuzzy wrote: 18 Aug 2019 23:44I just don't want to try out dozens of AIs, many of which are crap.
I'd personally recommend 'AIAI' & 'ChooChoo', they're relatively decent at making competant rail networks, and make enough money to expand rapidly (which is all i care about in an AI), but as time goes by both are likely to eventually error out with the issue of taking too long to decide something. Both also suffer from zero respect of road vehicles, and will happily place tracks over roads that are actively used by RVs and crash into them, even if its their own vehicles. I don't know if this is because AI simply cannot get the 'history' of a road to know if its actively being used or not, or a lack of care by the creators to always use bridges anyway.

My understanding of AIs is that the issue where they crash due to taking too long to do X or Y is relatively easy to fix when you understand the way the Ai is made (i struggle here as a lot of AIs don't have reasonable commenting on the code). 'ChooChoo' is one of the ones i have tried to modify, but ran into this.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Why OpenTTD should have a default AI

Post by Alberth »

Wuzzy wrote: 18 Aug 2019 18:24TBH, I am quite surprised that OpenTTD managed it to version 1.9.2 yet that such a core feature is kind of “tricky” to get to work … :roll:
So how to decide which one should be default?

Note that all AIs are made by volunteers, and you want a fair process where everybody has an equal chance. Being part of the standard distribution is a huge advantage to other equally hard working AI developers.


One step further, so you aim for a replacement of the original AI, but why? Wouldn't it be better if you could choose the kind of AI you want? If yes, how would the process work then?
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7239
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Why OpenTTD should have a default AI

Post by Redirect Left »

Alberth wrote: 23 Aug 2019 14:29 One step further, so you aim for a replacement of the original AI, but why? Wouldn't it be better if you could choose the kind of AI you want? If yes, how would the process work then?
In that case, would be better to have the default AI have parameters so you can essentially tweak the behaviour to what you're looking for, i'd suggest three levels.

Beginner - The bot acts similar to the original AI, not very good, a lot more A than I, but it gets itself up and running and just about maintains a very basic rail network mostly bolstered by RVs.
Amateur - Bot starts to act in more sensible manners, starts to use trains more than RVs, mixes point to point network with small mostly sensible networks.
Pro - Bot goes to max, it attempts to make a full network similar to how a lot of real players play (and how the AIs 'ChooChoo' & 'AiAi' work currently, they're very impressive as far as I feel, from what i have found in other AI)

Difficult thing would be to make an AI that can act in three different levels depending on what the user wants. But i feel this will always be the more user friendly way of handling it, instead of them having to trawl through many different AI to find one that is stable and does what they want. At bare minimum there should be a team of people that test AIs and remove or mark an AI as possibly not fully working, and a little red alert triangle comes up next to the AIs name in the list of downloadble AIs, allowing it to be still downloaded for people to play with or look at what is wrong and repairing it, but notifying the less advance users that they may want to look a bit further.
Perhaps getting some volunteers to run a game with many bots will quickly weed out the faulty ones, i recently did this whilst i was trying to learn AI code, although the bots in those screenshots i'd still mark as "working", as they didn't error just acted... interestingly. I'd be happy to make up such a group if there was a desire to get together a list of AI known to function without errors in the long haul, whether to make an ingame notification / alert, or just a list here on TT-F. Nothing worse than many many years into your game the AI that is doing so well errors and gets wiped and your map looks a ghost zone. If done, perhaps later on we can also attempt to fix those with licences that allow us to do so, if there is an audience for that specific AI.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Auge
Director
Director
Posts: 633
Joined: 23 Oct 2006 02:07
Location: Berlin

Re: Why OpenTTD should have a default AI

Post by Auge »

Hello
Wuzzy wrote: 18 Aug 2019 18:24 Currently, when you install a fresh OpenTTD, you will find a major feature missing: AI. There's no AI. :( So if you just jump into the game like you used to in TTD, you will be forever alone. Without competition the game is kinda boring.

OK, of course that was a lie. Of course there's AI. What I actually mean is that there is no AI by default. But that's the problem! I know what I am supposed to do, i.e., download an AI from the download section, but that's besides the point.
I played OpenTTD for the first time at a time when the rewrite of the original AI was part of the game and it was a godsend that I was able to deactivate the AI and to play without any dumb AI-based disturbance. Nowadays, when the game has an adult multiplayer mode and is nicely playable without an AI, the computerised opponents IMHO do not play the major role in OpenTTD-game-playing that you proclaim.

Tschö, Auge
User avatar
Wuzzy
Engineer
Engineer
Posts: 66
Joined: 18 Aug 2019 18:04

Re: Why OpenTTD should have a default AI

Post by Wuzzy »

So how to decide which one should be default?
One that ticks off all the boxes and basically provides good gameplay in the vanllia game. Have you not read my post?

The first goal is to have at least something that works out of the box and does not crash every 5 minutes, like many AIs do. This thing is partially an usability issue as well.
Note that all AIs are made by volunteers, and you want a fair process where everybody has an equal chance.
Why not making AI development (of the default AI) part of the official project then? So the AI will be considered part of OpenTTD and must go through the same level of scrutiny and quality control as anything else. If AI bugs are just outsourced, they will just linger forever and never get fixes, because nobody takes responsibility.

It's very possible to pick up one of the existing AIs, one that is closest to the wishlist, and fork it for official development. The default AI could be started from scratch, but it doesn't have to.

I already said it and I say it again: IMO it's important to not be perfectionistic about the default AI for now. Otherwise we will never have a default AI. The default AI is also NOT an AI that must be able to support absolutely everything, like support all obscure NewGRFs. The default AI should be a good starting point for the vanilla game, nothing more. It is NOT intended to replace the add-on AIs or to make them irrelevant. Players will likely continue to install and download AIs. The default AIs is something for the new players which just want to instantly jump into action.
(…) and you want a fair process where everybody has an equal chance. Being part of the standard distribution is a huge advantage to other equally hard working AI developers.
First, filter out all AIs that crash or do something insane or annoying (like sign spam). Congratulations! You already narrowed down the number of candidates a lot. :D
Then, check which AIs fit the wishlist the best and would best fit for a vanilla game experience. If the winner is of decent quality, pick it, and then fork it and fix the remaining issues.
In that case, would be better to have the default AI have parameters so you can essentially tweak the behaviour to what you're looking for, i'd suggest three levels.
This is a very good idea indeed. A difficulty setting is very good. Yeah, a good default AI is one that many players will enjoy. Parameters are an excellent way to handle this.
One step further, so you aim for a replacement of the original AI, but why? Wouldn't it be better if you could choose the kind of AI you want? If yes, how would the process work then?
I'm not the one who dumped the default AI! Also, I didn't say re-using the original AI is not an option. However, the “real” original AI won't come back anyway, as it cheated a lot. You probably meant SimpleAI, right? SimpleAI might be a starting point. But there are other potential candidates.
I played OpenTTD for the first time at a time when the rewrite of the original AI was part of the game and it was a godsend that I was able to deactivate the AI and to play without any dumb AI-based disturbance.
IIRC, we can disable the AI for waaaaay longer than that, iirc it was even that way in original TTD. Of course, the option to not play with any AI will always exist, this is not up to debate.
Nowadays, when the game has an adult multiplayer mode and is nicely playable without an AI, the computerised opponents IMHO do not play the major role in OpenTTD-game-playing that you proclaim.
Maybe not to you! But many players do not want to play online! Not everyone thinks like you! Original TTD was mostly a singleplayer game. Yes, multiplayer is a nice feature, but it shouldn't be an excuse to completely neglect singleplayer. Just because you don't care about singleplayer anymore doesn't mean that nobody does. Also, the multiplayer community is small (I never see more than about 12 players at once).
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5656
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Why OpenTTD should have a default AI

Post by andythenorth »

Wuzzy wrote: 26 Aug 2019 11:54
So how to decide which one should be default?
One that ticks off all the boxes and basically provides good gameplay in the vanllia game. Have you not read my post?
That’s defining an outcome, not the method :wink:

Which AI would you propose as the default?? There are several.
Auge
Director
Director
Posts: 633
Joined: 23 Oct 2006 02:07
Location: Berlin

Re: Why OpenTTD should have a default AI

Post by Auge »

Hello
Wuzzy wrote: 26 Aug 2019 11:54
I played OpenTTD for the first time at a time when the rewrite of the original AI was part of the game and it was a godsend that I was able to deactivate the AI and to play without any dumb AI-based disturbance.
IIRC, we can disable the AI for waaaaay longer than that, iirc it was even that way in original TTD. Of course, the option to not play with any AI will always exist, this is not up to debate.
When I played TT, it was absolutely no option to disable the AI. So OpenTTD was my first encounter of that feature. Not TTD and not the patch.
Wuzzy wrote: 26 Aug 2019 11:54
Nowadays, when the game has an adult multiplayer mode and is nicely playable without an AI, the computerised opponents IMHO do not play the major role in OpenTTD-game-playing that you proclaim.
Maybe not to you! But many players do not want to play online! Not everyone thinks like you! Original TTD was mostly a singleplayer game. Yes, multiplayer is a nice feature, but it shouldn't be an excuse to completely neglect singleplayer. Just because you don't care about singleplayer anymore doesn't mean that nobody does. Also, the multiplayer community is small (I never see more than about 12 players at once).
Yes, not every one thinks like me. But also not everybody thinks like you. The portion of online players might be small but so it seems (at least) to me is the portion of players who uses an AI as opponent. I wanted only to suggest that your opinion is not the imperative "truth" like you presented it. So as noone elses.

Tschö, Auge
rowdog
Engineer
Engineer
Posts: 67
Joined: 24 May 2017 12:51
Location: East Texas

Re: Why OpenTTD should have a default AI

Post by rowdog »

Alberth wrote: 23 Aug 2019 14:29 So how to decide which one should be default?
Ask xarick, he's been testing the AIs and reporting bugs for a long time. What are the top 5 in all those competitions? Use a forum poll to vote for a winner from the top 5. It's not really a hard question when approached with a combination of testing + voting.

Not that I'd ever use it, I don't like playing with AIs.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Why OpenTTD should have a default AI

Post by planetmaker »

TLDR: yes, it should have a default AI.

More in detail:

Arguably having no AI by default is a bit boring (and also a deviation from OpenTTD's origin) - yet a decision for a certain AI is difficult. However it might improve the new player experience when there is at least some AI by default - after all a default would not change the way anyone can play the game. It might work similar to how base sets are chosen with a change to default settings.Thus a change to defaults would not stop playing anyone the way he or she likes - but give new players a different start, a more whole game experience.

There is one chance currently to grab: We have currently a request from a company to actually sponsor some kind of competition around christmas - which can also be an AI competition.That could in fact be used to decide on a default. Maybe a default AI could last as long as the titlegames do last: one default for a complete cycle of one major release cycle and make a similar competition an annual event?

Is there someone willing and with enough time to actually organize this event? I shall be more than happy to forward the corresponding e-mail.

Cheers,
planetmaker
This is just my personal 2ct and does not reflect the opinion of anyone else.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: Why OpenTTD should have a default AI

Post by SirkoZ »

Alberth wrote: 23 Aug 2019 14:29
Wuzzy wrote: 18 Aug 2019 18:24TBH, I am quite surprised that OpenTTD managed it to version 1.9.2 yet that such a core feature is kind of “tricky” to get to work … :roll:
So how to decide which one should be default?

Note that all AIs are made by volunteers, and you want a fair process where everybody has an equal chance. Being part of the standard distribution is a huge advantage to other equally hard working AI developers.


One step further, so you aim for a replacement of the original AI, but why? Wouldn't it be better if you could choose the kind of AI you want? If yes, how would the process work then?
That's very simple - Brumi's SimpleAI should be default - it is reimplementation of the old TTD AI and more. :idea:

I just remembered - the alternative to SimpleAI would be Yexo's AdmiralAI because it implements as many AI functions as possible and it does it very well; ships can also be added to it if need be...
pelya
Transport Coordinator
Transport Coordinator
Posts: 342
Joined: 18 Nov 2010 19:48
Contact:

Re: Why OpenTTD should have a default AI

Post by pelya »

For the pre-installed AI, the main requirement is that it shall not crash, ever, and shall not cause franerate drop even on 4096x4096 map on year 2055.

So I propose to take the simplest dumbest AI that is easy to maintain, but that is not so dumb to go bankrupt on default settings.

It's fine if it builds only trains, or builds only bus transport, as long as it's building anything. This will be totally enough for inexperienced players who struggle to turn a profit.

It's up to the user to install more advanced AI and deal with crashes.
User avatar
odisseus
Director
Director
Posts: 552
Joined: 01 Nov 2017 21:19

Re: Why OpenTTD should have a default AI

Post by odisseus »

I believe the default AI should teach the player by example. For that purpose, the AI should use every transportation mode that is present in the default game: buses and trucks, passenger and freight trains, ships and aircraft.

It should build networks that are simple, but very reliable and reasonably efficient. No multi-track mainlines, but deadlock-proof design is absolutely required. The road networks should be resistant against deadlock too (though this is harder in the general case due to interference by other players). No big deal if the service rating for a station is far from ideal, as long as cargo is still supplied and the vehicles make a profit.

The default AI should avoid direct competition with player, if possible — if I were a beginner, I would hate to be bankrupted by an aggressive AI! If there are plenty of towns and industries on the map, the AI should pick those that aren't serviced by the player. However, this shouldn't be a hard rule: if suppliers are scarce, any industry is fair game.

As others have already pointed out, it is absolutely necessary that the AI can handle large maps and lots of vehicles without crashing.

It is okay if the AI goes bankrupt under adverse conditions — for example, if there are no cargo suppliers whatsoever, or if the player sets out to compete with it. However, the AI should be able to perform reasonably well across the range of different settings available in the default game — Cargodist, weight modifiers and breakdowns to name a few. NewGRF settings, such as town growth rules and base costs, are out of scope.
meisthemunch
Engineer
Engineer
Posts: 1
Joined: 19 Jun 2020 15:52

Re: Why OpenTTD should have a default AI

Post by meisthemunch »

Hi there,

I am new here and actually signed up so I can comment on this post. I think I am a good example of the target market for the OP!

I played TTD a lot when I was younger, was never a master but loved it and am very nostalgic about it. I've just downloaded and am really looking forward to playing again, but have this exact issue with the AI: I've spent an hour or so browsing the forums but have no idea what AI to use. I'd say I'm a pretty determined individual but generally its very difficult to know what to do about AI when you want to play the game.

A default AI, which has basic abilities, is exactly what im after. Who knows, once I play and get better, I will want to branch out, try harder AIs, and multiplayer - but at the moment I want to learn and have some fun. If we could change the 'quality' of the AI, with 3 difficulty levels, that would be even better.

I guess another way to think about it is; why is there no default AI in the offical build? Do people prefer to play online? Or without any competition? maybe this question can help.

In a related manner, I came across the below thread which looked to determine the best AIs, which I found useful, but not sure if the project has progressed since.

viewtopic.php?f=65&t=86439

EDIT: I guess i am not much wiser than before for my first game! ha. Looks like I will try SimpleAI, perhaps AdmiralAi and AIAI at another date, but if anyone has any reccommendations I would really appreaciate it :D
Exilyth
Engineer
Engineer
Posts: 2
Joined: 20 Jun 2020 16:05

Re: Why OpenTTD should have a default AI

Post by Exilyth »

Hi.

I'd like to begin by stating that I'm all in favour of distibuting OpenTTD with one or more default AIs included.

Before I started to embark on the journey of creating my own AI (which is still WIP atm), I did some research on AI in openTTD and found out that quite a portion of AIs are actually based on research papers:
[+] Spoiler
Scientific research related to AI for openTTD
(warning: the papers referenced and described below are probably overkill for just writing a 'my first AI' or some casual AI. Many of them could help improve competetive AIs though and may prove enlightening to the interested reader. Please do cite sources if you do base your work on a research paper.)

For scientific research on OpenTTD see e.g. (in order of discovery):
  • "Artificial Intelligence for the OpenTTD Game", master thesis, by Maciej Wisniewski, Technical University of Denmark, 2011
    • resulted in the 'SPRING' ai
    • lots of info on what needs to be considered to make an AI more efficient or more human-like
    • chapter 4 'existing AI analysis' contains a quick overview over the different strategies used by certain AIs
      • 'PathZilla' (graph based network planning)
      • 'AdmiralAI' (unfortunably, not much insight on this one)
      • 'ChooChoo' (builds random 4-way crossing and extends from there, connecting towns as it goes)
      • 'trAIns' (builds rail from predefined segments)
      • 'Rondje' (scans for existing routes and uses them too)
    • chapter 5 details the SPRING ai strategy (a form of graph based network planning)
    • appendix contains 'ai sidecards': small TL;DR descriptions of many AIs from 2011
  • "trAIns: An Artificial Inteligence for OpenTTD", by Luis Henrique Oliveira Rios and Luiz Chaimowicz, Universidade Federal de Minas Gerais, 2009, inproceedings: VIII Brazilian Symposium on Games and Digital Entertainment
    • resulted in the 'trAIns' ai
    • builds 2 lane train routes from combinations of pre-defined segments
  • "Umelá inteligence pro OpenTTD", bachelor thesis, by Radim Kratochvíl, Masarykova univerzitam, 2016
    • this paper is written in czech, which I do not speak, so I had to use translation software
    • chapter 4 shortly describes MogulAI, AdmiralAI, trAIns and TracAI (for tracAI, see next paper)
    • 'MogulAI' builds 2 lane roads
    • chapter 5 talks about the implementation of a new 'QatAI'
    • based on MogulAi
    • uses roads and trains
    • can place signals at train length, uses vehicle groups for deleting all vehicles on a route, can upgrade rails to monorail/maglev (as of writing, this ai is not yet available on BANANAS)
    • according to the last paragraph[translated via googe translate]: "Until the registration is corrected, it will be possible to find the AI only in the information system of Masaryk University." Well, let's hope the author uploads that AI eventually.)
  • "Umelá inteligence pro OpenTTD", bachelor thesis, by Daniela Plachtová, Masarykova university, 2015
    • this paper is written in czech, which I do not speak, so I had to use translation software
    • chapter 4.3 shortly describes AdmiralAI, WormAI and trAIns
    • chapter 5 reveals this is the paper for 'TracAI'
    • based on WormAI
    • TR AC = AirCraft and TRains
    • picks pairs of cities and connects them for PAX
    • picks pairs of industries and connects them for freight
    • in depth descriptions of how this is done
  • "Planning of railway network for Open Transport Tycoon Deluxe", master thesis, by Ondr?ej Lakomý, Charles University, Prague, 2020
    • chapter 3 describes trAIns, ChooChoo and AdmiralAI
    • new AI called 'TrainsferAI'
    • advanced network planning based on hierarchical openTTDcoop train network designs
    • acts in multiple phases
    • contains code and explanaitions on building arbitrary 2 lane crossings
  • "Umelá inteligence pro OpenTTD s prvky emotivního chování", bachelor thesis, by Michal Zopp, Masarykova university, 2018
    • this paper is written in czech, which I do not speak, so I had to use translation software
    • chapter 5 shortly describes AdmiralAI, DictatorAI, SimpleAI
    • DictatorAI is based on AdmiralAI with the addition of removing roads to prevent use by opponents
    • SimpleAI builds lines connecting 2 places via the shortest route semi-randomly
    • chapter 6 reveals this to be the paper for 'EmotionAI'
    • based on SimpleAI
    • implements various techniques to defend against 'attacks' by other players
    • implements various techniques to attack other players
    • keeps track of a 'karma' score to decide when and who to attack in revenge
  • "Umelá inteligence pro OpenTTD", bachelor thesis, by Lukáš Dihel, Masarykova university, 2017
    • this paper is written in czech, which I do not speak, so I had to use translation software
    • chapter 4 shortly describes AdmiralAI, ConvoyAI and MogulAI
    • 'ConvoyAI' uses only busses
    • chapter 5 new AI called LuDiAI is presented (nowadays also known as: 'LuDiAI after fix')
    • builds routes connecting random towns
    • has some settings to e.g. limit to cities
  • "Umelá inteligence pro OpenTTD s podporou Cargodist", bachelor thesis, by Aleš Paroulek, Masarykova university, 2019
    • this paper is written in czech, which I do not speak, so I had to use translation software
    • chapter 5 shortly describes AdmiralAI, AIAI, DictatorAI, MogulAI, NoNoCAB, SimpleAI and WormAI
    • AI not affected by cargodist are discarded
    • chapter 6 analyzes AdmiralAIs air route algorithm
    • chapter 7 describes the addition of cargodist support to AdmiralAI
    • focus is on air
    • dynamic population of routes with planes
    • uses a collection of planes to reuse instead of selling/buying planes when closing/opening routes
    • chapter 8 describes the addition of cargodist support to AIAI
  • "MCTS in OpenTTD", thesis, by Geert Konijnendijk, Maastricht University, 2015
    • briefly presents the application of mote carlo search trees (MCSTs) to AI in openTTD
    • 'MCTrAIns' AI based on 'trAIns' (not on BANANAS)
  • "Evolving dynamic AI opponents for OpenTTD using Dynamic Scripting and Grammatical Evolution", master thesis, by Frank Bijlsma, Utrecht University, 2014
    • chapter 2 describes PathZilla, trAIns, ChooChoo and AdmiralAI
    • uses genetic algorithms to generate a wide variety of AI from a grammar
    • provides the resulting 'best performing rules' which have been found
    • has some problems with pathfinding over rails placed by opponents

not a scientific paper, but honorable mentions: (I could provide pdf links for each paper if requested, but since this is my first post on the forums, I won't include any links in this post for now)

In short (aka. TL;DR:):
  • AdmiralAI is often noted for code quality, stability and the ability to play all modes of transportation
  • trAIns is often noted as creating aesthetic rail networks
  • The road 'recycling' employed by 'rondje' is often felt to be an effective but unfun tactic (although I know at least one case from another forum thread where someone used rondje to do the feeder busses for them)
  • Road AI can have a tendency to block each other by spamming loads of road vehicles.
  • Most Ai aim to be more effective.
  • EmotionAI is one of the AIs which aim to be more human by adding a karma-based emotional component
As one can trivially see, only a subset of AIs has been put to test in the literature so far.
  • https://wiki.openttd.org/Comparison_of_AIs exists but is not very thorough
  • https://openttd.mousetail.nl/ runs (or used to?) AI tournaments (but no info is given on e.g. at what date a tournament ran, which version of an AI was used or which openTTD version is used)
  • ai comparision threads on the forums here run tournament style comparisions, often with a semi-random, non-exhaustive choice of AIs. Parameters used tend to vary wildly between threads and if the thread doesn't restrict itself to the base game, the choice of NewGRF (mods) tends to vary wildly. The last point would be a good thing if some ai didn't completely fails to cope with some or all of the various industry replacement NewGRFs. Still, the lack of common test cases makes it somewhat harder to compare AI performance.
An exhaustive survey paper comparing all current AIs regarding their ancestry, strategy used and efficiency under different conditions would be quite the endeavour, but certainly a boon to the community and to further research.


But back to a 'default AI' for openTTD - there are different types of players with different goals and desires, who desire different behaviours out of AI:
  • beginners and casual players: seek an AI they can play with but which doesn't get ahead or in their way too much
  • the average player: just wants to have fun with a bit of competition but does not want to fight for routes too much
  • competetive-minded and hardcore: seek an AI that puts them through hell and back and challenges them just as if not more than a human player
  • cooperative: likes an AI which they can cooperate with, e.g. having the AI take over one or more types or parts of the transport while they do the other(s) while not getting in each others way too much
  • realist/model train enthusiast: seeks an AI which builds routes with at least some resemblance to some desired real life pattern/template
  • special interest: sometimes you just want some help with living the place up or have some other desires which do not concern efficiency, see e.g. 'StreetTraffic' and/or 'TownCars' AIs.
Some of theese goals/desires are at odds with each other, or outright conflict each other. Also whether the chosen AI hinders or helps a player can be highly subjective, e.g.: "How dare that AI put a route across where I want to build!" vs. "Oh, how nice, now I've got a reason to put a bridge here, which makes my layout look so much more interesting.".

It may be a good idea to provide at least one casual-nonhindering and one competetive-offensive AI.

What all types of players desire though is stability: Ai must be able to cope with a variety of circumstances, e.g. weird landscapes, odd industry/town placement, no suitable vehicles, no suitable transportation type and many more without suffering the AI equivalent of a 'nervous breakdown'.

Now, as a result of some testing I did, here's a selection of scenarios to test and improve AI stability:
  • All scenarios use the base game, no NewGRF, 64x64 map (choose other terrain params to your liking, e.g. set more water if your AI can handle ships)
  • I'd recommend default game settings, but game settings are not the deciding factor here
  • Starting year: pick one - 1950, 1975, 2000, 2025, 2050
    1. "It's a small world": minimal industry, a few towns, regenerate until at least 2 towns are created. Not much challenge here, just to see if the AI works. Will probably get very cramped very soon.
    2. "Something's amiss": manual placement of industry (no initial), regenerate until at least 2 towns are created. Most AI will struggle a bit, but then settle on some point to point PAX and/or mail route.
    3. "A rock": repeat with 'alpine', more/less water and rivers and other terrain settings tweaked to make the map less flat. Most AI will struggle a bit, but then settle on some point to point PAX and/or mail route.
    4. "A hard place": manual placement of industry (no initial), minimal towns - regenerate until only one town with 300-850 population is created. With the default NewGRF, this will be hard to impossible - the correct course of action would be giving up unless a profitable route can be found. Interestingly, I found a few AI actually give up on this, while others tried to find a good spot until they went bancrupt. Yet others just crashed when they could not find a second town to connect to.
Theese scenarios are far from a 'normal' game, which usually takes place on maps of size 256 and up, but they are interesting corner cases to test AI stability on nonetheless. They're also fast to generate/load as a side effect of their small size. :)

Talking about settings, it would be great if more AIs had some basic settings in common, e.g. an option to
  • toggle offensive actions on or off to allow players to make the choice between constructive competition and destructive competition.
  • force the AI to stay away from where the human players have built
  • change difficulty: a rough 'easy, medium, hard' setting which affects e.g. parameters for path planning or cost estimation. In addition, an AI could e.g. turn itself up by restricting which types of track segments can be built to only the most effective, or tune itself down by allowing even less effective track segments.
I'm currently writing my own AI and unfortunably found the NOAI documentation to be a bit lacking, especially when it comes to code samples. Don't get me wrong: the AI tutorial trail on the Wiki is a good start, but it tends to go from 'my first idling main.nut' almost directly to 'ok, now let us do some rocket science - if you have questions, go look at some other AIs'. A few more intermediate tutorials (e.g. how to place your company HQ, how to get info about tiles, how to work with AISigns, ...) would make the transition less steep and a few advanced, topic specific tutorials (e.g. specific transportation quirks (esp. trams, placing newObjects, ...) would help spread
Better quality documentation would lead to AI developers spending more time on functionality and implementing a good/new/weird strategy instead of wrangling with a (to them) new api (noai) and a (to them) new scripting language (squirrel).
This would also in turn result in people having more time to spend on making their AI more robust/stable and/or more customizable.

Sorry about the wall of text - just some things I wanted to add.
User avatar
Wuzzy
Engineer
Engineer
Posts: 66
Joined: 18 Aug 2019 18:04

Re: Why OpenTTD should have a default AI

Post by Wuzzy »

Personally, I think SimpleAI might be a good starting point, basically because it's … well … simple and it works. It also did not crash on me … so far. However, I think it does not support ships. :( So that would need to be added. The default AI doesn't have to be a strategic mastermind.

Your testing suggestions are a good starting point for testing. :)

I like your deep analysis of "things that players might want" and it's great to keep in mind. But for now,this is kind of missing the point here. The goal is to at least have some default AI that at least does something. Doesn't need to be absolutely perfect in everything, especially in the 1st version.

Maybe the different "behaviors" like aggressiveness, strategy, etc. could be put into the AI's settings. That would make the default AI also much more powerful. But I would reserve that for later versions, the first step should be to have a functional simple default AI to begin with, and then build on that.
User avatar
luk3Z
Traffic Manager
Traffic Manager
Posts: 197
Joined: 25 Dec 2005 17:42
Location: Kielce, Poland (Mars sometimes)

Re: Why OpenTTD should have a default AI

Post by luk3Z »

Of course it should. By the way - why don't divide AIs for "stable AI" and "unstabe AI" ?
Divide based for example on time after it crash in vanilla game (without any addons):

stable AI = is not crashing during few hours
unstable AI = is crashing within 59 minutes
Find new graphics easier:
GRFCrawler -> http://grfcrawler.tt-forums.net
BaNaNaS -> https://bananas.openttd.org/
32 bit gfx in OTTD (32bpp) -> https://wiki.openttd.org/en/Community/N ... 20graphics
TTDPatch 2.6 -> viewtopic.php?f=19&t=67694
How to subtract tax from income (workaround) -> viewtopic.php?t=89763&start=20
How to ban distance from income -> Simple Cargo Decay Override
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: Why OpenTTD should have a default AI

Post by Baldy's Boss »

Another category/consideration...at times I have pursued a strategy of buying out successful competitors...this can help or hurt the bottom line depending on how well they're run.
(Having negative economies of scale built into the game is something of a deterrent,though).
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 4 guests