Programmer Challenge: create an OpenTTD AI

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Programmer Challenge: create an OpenTTD AI

Post by Alberth »

@Roujin: I'll give it a try:

With overwhelming power, the second 'Tjip Challenge' has been won by 'Rondje rond de kerk’. In the preliminary rounds 'Rondje' got on average 15 million pound, while 'Ottari', number 2, didn't get any further than 3.5 million. In the final nothing changed on the established order: ‘Shadows Inc.’ finished ahead of ‘NAAI’ despite a bankrupcy and a meagre score of 300 thousand during the final. Convoy played outside the competition in the preliminary rounds. It scored £5.346.034 on average, and would have finished second.

1. Rondje rond de kerk £15.671.342
2. Ottari £3.487.225
3. Shadows Inc. £2.798.447
4. NAAI £876.351
5. YATTAI £760.638
6. SubsidyAI £512.639
7. NoCAB £73.984
8. GoingForGold £17.380
9. Appelmoes Intelligentie £-38.291

Rondje rond de kerk
As said: The performance of this engine was mpressive. The four developers behind it say they spent 480 hours on its development. Besides 'Rondje', they built three test engines, of which the best - OtviAI - beated Convoy in a one-on-one situation.
They made optimal use of the holes in the game. Vehicles were for example immediately sold after delivery, since that is cheaper than driving back and pick up new cargo. Also, they didn't build any road them selves, but (ab)used the roads built by others. Engines that didn't transport passengers (NoCAB and GoingForGold amongst others) went bancrupt for this reason in games where 'Rondje' participated.

Ottari
The developers them selves were not available, instead they sent the winner of last year. As a result, I don't know much of their strategy, 'Ottari' did however built its stations in a way that 'Rondje' didn't recognize them. In a parallel running one-to-one match this caused them to win convincingly.

Shadows Inc.
A very interesting strategy was used by 'Shadows Inc'. First all available money was invested in 1 as optiml as possible line. Next, 'Shadows Inc' went on to build an optimal line with optimal length (between 150 and 200 tiles long)/ As soon as enough money was available to build it, the first line was sold. This gives a huge boost to the growth. Problem was that in half of the cases it appeared that the new line could not be built (not enough money) which slowed down the growth considerably. The developer had also done preparations to test it with a neural network, but due to illness this was not further developed. Possibly he will do this later.

NAAI
The most surprising was perhaps 'NAAI', an engine that had as goal to make life difficult for its opponents. Due to their short development time (a day!) they didn't manage to implement all, and decided to go for the only goal left: survive with a as large as possible company value. Near the end of the game 'NAAI' built road stations from all money it still had to reach a comapny value of about 800 thousand pound. This strategy was by the way also employed by 'Rondje'. Rather successful, since the company value of a station is 10 times higher than its purchase costs.

SubsidyAI
My personal favorite. Not only because he didn't go for winning but instead 'just' wanted to build a nice engine, but also because of his goal: build an engine that works like the goverment. Not necessarily goal-oriented, or efficient, some times even wasting money. It started new lines only if a subsidy was given. I had to think about a picture that is now in the 'kunsthal':

http://www.kunsthal.nl/data/pictures/e_377.jpg

Burocraticia would be a better/nicer name for the engine, I think ;)

NoCAB
Well, the engine of Morloth and myself didn't work very well. Partly because we hadn't implemented transport of passengers, partly because of some bugs that made our lines non-optimal w.r.t. profit. We were however the best Tjippers, and that counts too.

The other contestants had good stories too. 'Appelmoes Inteligentie' (transl: 'Applesauce Intelligence') was as far as I am concerned, the most hilarious (and maybe the most funny) name, while GoingForGold (my collegue and thus immediate competitor) were still very busy on Friday, and his project leader came at my desk with questions about features to build to give him a push in the right direction. :D 'Yet Another Transport Tycoon AI' was maybe not the most original name but had a thorough approach. In a number of test routines the developers had compared several mechanisms on the number of ticks that they costed.

The particpants have provided interesting input for the NoAI-framework, both in the form of engines and in the form of bugs/features, etc. It also appeared that the fun of people from a computer game is not necessarily caused by fancy graphics but instead by game play. Otherwise I cannot explain that so many people enthousiastically started with a 8-bit graphics game from 1992, in the year 2008.
User avatar
Corniel
Engineer
Engineer
Posts: 17
Joined: 01 Feb 2008 14:06
Location: Leiden - Netherlands
Contact:

Re: Programmer Challenge: create an OpenTTD AI

Post by Corniel »

Thanx for that translation. :bow:

Code: Select all

while(Me.Alive()){
    Me.KickAss();
    try{
        Me.LearnLanguage(Language.EN);
        Me.dyslectic = false;
    }
    catch{ /*nice try :( */}
}
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Programmer Challenge: create an OpenTTD AI

Post by Roujin »

Thanks from me as well, it was a very interesting read :)
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
wilco_moerman
Engineer
Engineer
Posts: 70
Joined: 05 Jun 2008 15:51

Re: Programmer Challenge: create an OpenTTD AI

Post by wilco_moerman »

Roujin wrote:Thanks for the information. :) Would someone who speaks dutch be so kind and translate the post here into english for those who don't understand dutch? :) (I was able to figure out some parts of it because it sounds like a mixture of german and english with horrible spelling if you read over it :lol: )
My rough translation of the part relating to my AI, including some extra remarks for clarification.

-------------------------------------------
Shadows Inc.
A very intersting approach was taken by Shadows Inc.. First all available money was invested in one single optimal line. After that Shadows Inc. went looking for an optimal line with optimal length (somewhere around 150 and 200 tiles long). As soon as there was enough money*, this second line was built and the first line abandoned. This boosts growth enormously. It turned out that there was a problem in about half the games** which resulted in a failure to build the second line (and further) which hampered growth severely.
Furthermore the developer had made preparations for testing (and tuning) with a neural network***, but due to medical circumstances it wasn't included in the AI for the challenge. Perhaps he will include it in his AI later on.

-------------------------------------------

my own comments:
* The idea was to select a small distance line, generate money, invest it all in new vehicles on that line, and when there was enough capital (in the form of vehicles), sell as much as needed for a longer line (already calculated by then). After that, only long lines would be built, each planned while the AI was making money (and investing it all in vehicles). After a threshold was reached, the new line would be created, and so on. In the instances when this tactic was successful, it performed the same as convoy.

** the problem was that my algorithm for finding two good towns for starting the small line, was broken. Sometimes it selected a very bad pair. Also (due to lack of time) my AI didn't register opponents yet. So it might be that it selected a "contested" town, also reducing the profit.

*** I'll certainly try to do this at a later stage. The idea was to use a neural network for several decisions (like finding a good pair of startup towns). The network weights would be tuned by an evolutionary algorithm (ESP or NEAT or something similar). The JAVA code to run multiple servers and to update the AI's during a run is finished, but there was no time to implement the required parts in my AI :(
Nunc dimittis servum tuum Domine secundum verbum tuum in pace
jorisslob
Engineer
Engineer
Posts: 1
Joined: 24 Sep 2008 11:49

Re: Programmer Challenge: create an OpenTTD AI

Post by jorisslob »

Hello everyone,

I was the creator of Burocraticia (thanks for the name!). I had lots of fun joining the competition.
The code is quite dirty and I used Convoy for some of the road building and station planning algorithms, so I will have to go through it again and add comments to credit the original coders of those snippets.

But after that, I am more than happy to share the AI.
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 24 guests