ChooChoo, a train network 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

User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Hey Wold, thanks for the screenshots. Fixed another bug :) No idea what happened in #3 though...

I'll make the search slightly less than fully random, and build in some Sleep() calls. I've got some other modifications planned as well. Back to hacking after this post :D

The newgrf sets are tricky - I found out the problem with the 2cc set. I just picked the fastest locomotive, which instead of 40k or 50k is suddenly some 220k monster which it'll never be able to afford on its starting loan. I guess I'll have to define minimum/maximum parameters for evaluating them.
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: ChooChoo, a train network AI

Post by fanioz »

I dont know if this has been known or not but. I think you should only build depot if its head is flat too. :D
Attachments
choochoo_depot.png
choochoo_depot.png (34.85 KiB) Viewed 7318 times
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
Dezmond_snz
Engineer
Engineer
Posts: 58
Joined: 19 Apr 2009 11:50

Re: ChooChoo, a train network AI

Post by Dezmond_snz »

FHS wrote:One time the 2cc set and another time the outdated swiss set taster, i didnt seem to work with either.
Yep. With 2cc ChooChoo builds monorail networks and don't build normal trains for them. Cause seems to be that no mail wagons available for monorails (no errors or warnings at debug console).
Some info here...
Some info here...
ChooChoo, 1940-03-04#1.png (59.88 KiB) Viewed 3546 times
Edit: And just got a crash.
Debug console
Debug console
ChooChoo, 1945-08-05.png (17 KiB) Viewed 3534 times
Russia
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Dezmond_snz wrote:
FHS wrote:One time the 2cc set and another time the outdated swiss set taster, i didnt seem to work with either.
Yep. With 2cc ChooChoo builds monorail networks and don't build normal trains for them. Cause seems to be that no mail wagons available for monorails (no errors or warnings at debug console).
Yup, that'll break it. I didn't expect there'd be train sets without cargo wagons. I'll add a check for that...
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Update!

- clean up failed crossing exits instead of capping them with depots
- engine selection should now work with newgrfs
- money management to prevent bankrupcy

Still to do:
- improve startup
- prevent it from blocking its own crossings
Dezmond_snz
Engineer
Engineer
Posts: 58
Joined: 19 Apr 2009 11:50

Re: ChooChoo, a train network AI

Post by Dezmond_snz »

Michiel wrote:Update!

- clean up failed crossing exits instead of capping them with depots
- engine selection should now work with newgrfs
- money management to prevent bankrupcy

Still to do:
- improve startup
- prevent it from blocking its own crossings
Good work! It plays very nice now.
But sometimes it clears wrong exits of crossings. E.g. should clean SE direction but it clears NE instead, which is already connected to station. After that it built some trains - they lost immediately... :)
Russia
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Woops... that's not good. I'll go check :)
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Hmm, couldn't find that particular problem, but here's another update. This one shouldn't block off its own crossings and it starts off with a couple cheap single track lines.

Also, new screenie: I let it run for about 30 years on a 1024x1024 map and it built this massive network, which it is currently still expanding.
Image
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Now also available in Bananas :D And now I'm off to bed :P
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: ChooChoo, a train network AI

Post by cmoiromain »

this is amazing! Of course, it's not as clever as some of the others, but I you only want to watch an AI building, this one is always active!
I am little, ugly, and nasty. How do you do?
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Thanks! And I'm definitely trying to make it as stupid as possible... cleverness just breeds bugs :) Trying to find simple algorithms that result in nice looking results. The train management is definitely TOO stupid at the moment, though.
dasy2k1
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 20 Sep 2006 23:43
Location: UK
Contact:

Re: ChooChoo, a train network AI

Post by dasy2k1 »

its just built this junction near my network, but i cant see what use it is as nothing is allowed to exit it due to the way the signals are placed
prehaps they should not be one way
Attachments
Hendhead Transport, 29th Sep 1938.png
Hendhead Transport, 29th Sep 1938.png (49.82 KiB) Viewed 3597 times
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: ChooChoo, a train network AI

Post by cmoiromain »

Also, it seems there are some missing rails to that crossing (well, you can do without them, but adding them allows to reduce the number of sharp turns, and also to run more trains on the junction depending on where they are going)
I am little, ugly, and nasty. How do you do?
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

dasy2k1 wrote:its just built this junction near my network, but i cant see what use it is as nothing is allowed to exit it due to the way the signals are placed
prehaps they should not be one way
All junctions start with the signals facing "out" on purpose. At first they didn't, but then trains would try to drive into an unfinished exit and get stuck trying to turn around. Now, it builds the connection first and then flips the appropriate signal around to allow trains to pass.

cmoiromain wrote:Also, it seems there are some missing rails to that crossing (well, you can do without them, but adding them allows to reduce the number of sharp turns, and also to run more trains on the junction depending on where they are going)
That's true, I removed the extra tracks to make the junctions look cleaner, but maybe I'll add them back in.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: ChooChoo, a train network AI

Post by Roujin »

Michiel wrote: That's true, I removed the extra tracks to make the junctions look cleaner, but maybe I'll add them back in.
I personally liked the look of your crossings. It made your AI kinda unique... you just had to look at the crossing and knew "oh, that's built by ChooChoo". :)
* @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
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

:D

You mean the current ones (screenie in first post), or the old ones with extra diagonal tracks?

Image
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: ChooChoo, a train network AI

Post by Roujin »

I meant the current one (first post).

The old one you just posted, looks so "usual".. of course it's a bit more efficient than the current one (allows two trains to turn left at the same time), so you have to decide ;)
* @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
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Efficiency, schmefficiency, I just want it to look pretty :p If you're gonna go bankrupt, you might as well go with style! Also, it's hard not to make millions of dollars with a handful of trains, so I'm not worried about profit after the first year or two.
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Update: sane brains for the new trains!

... which means it adds N (=3) trains per new station built, and sends them to those stations most in need of more trains (cargo produced vs. estimatedly carried off per month).
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: ChooChoo, a train network AI

Post by Zuu »

Hi Michiel,

I have followed this thread since you announced your AI here but have not tested it myself until today. Must say it is really cool to watch!

Very good job!

I noticed that sometimes it removes the unused entrances to a node and in one case it removed the destination station for an industry chain after the route was constructed and a train was built. (I can't promise that it was removed after the train was built, but at least I can confirm that it built a train.)
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 17 guests