Convoy: train support testversion

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
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy- a Road AI

Post by GeekToo »

paullb wrote:I was running Convoy against my bus-based AI, Jinjaba (Jinjaba Is Not Just Another Bus AI) and I was neck-and-neck with Convoy for overall score.

However, despite building significantly less busses, I was much more profitable. As a result, I think you might have too many busses on your routes. See attached.
Very well possible. Line management is still rather immature, esp. when no more towns to connect can be found after 1 or 2 years.
Jinjaba does show some nice graphs, keep going! Looking forward to see that published ( probably after the challenge ?)
wilco_moerman wrote:I noticed that Convoy has a peculiar bug. Sometimes if a large and a small* town are close by, and Convoy tries to connect both, then the following can happen:

suppose A is a small town, B is a big town and the distance between them is 13, then Convoy tries to build a bus station in A, but it check all tiles within a square of 30 for highest acceptance (15 tiles in all directions). But the highest acceptance in that square is actually in town B[/b] because it is bigger! So it builds a station in B (while thinking it is building it in A) then tries to connect this new station with the exit point in A, which then fails, and then tries to build a station in B, which also fails because there is already a station too close by.

.


Thanks for the feedback, I have ideas to solve this in the next update.

I've created a scenario that very well reproduces this, so I can test the solution, might be of use to other AI developers
Attachments
towntest.scn
(12.45 KiB) Downloaded 285 times
Finaldeath
Engineer
Engineer
Posts: 72
Joined: 09 Apr 2006 23:49
Location: UK
Contact:

Re: Convoy- a Road AI

Post by Finaldeath »

Funny, once the changes to town influence were made so it can be done in a list, since the problem with my simple "Build two bus stations in one town" kept failing if there were other nearby towns, it's worked fine. I can show you my list code if it'd help anyone, since inter-city bus routes can be good in some circumstances.
Finaldeath
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Convoy- a Road AI

Post by Roujin »

paullb wrote:I was running Convoy against my bus-based AI, Jinjaba (Jinjaba Is Not Just Another Bus AI) and I was neck-and-neck with Convoy for overall score.

However, despite building significantly less busses, I was much more profitable. As a result, I think you might have too many busses on your routes. See attached.
I noticed something that probably went wrong with your AI on the tournament server by TrueLight. See e.g. this overview: http://devs.openttd.org/~noai/tournamen ... erview.gif
Look at the right end of the map, after some time your AI appearently builds a heap of roads(?) all around that town.

It can also be seen in this overview: http://devs.openttd.org/~noai/tournamen ... erview.gif


Maybe you could make an own thread for your AI, even if you won't publish it until after the contest?
* @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: Convoy- a Road AI

Post by wilco_moerman »

Finaldeath wrote:Funny, once the changes to town influence were made so it can be done in a list, (..)
why couldn't it be done in a list before then? I have used my own (static) functions with validators and it seemed to work fine.
Nunc dimittis servum tuum Domine secundum verbum tuum in pace
Finaldeath
Engineer
Engineer
Posts: 72
Joined: 09 Apr 2006 23:49
Location: UK
Contact:

Re: Convoy- a Road AI

Post by Finaldeath »

Yeah, you could wrap it in a squirrel function but it was a bit unnecessary, and unintended too I recall.
Finaldeath
User avatar
paullb
Traffic Manager
Traffic Manager
Posts: 129
Joined: 19 May 2008 13:11

Re: Convoy- a Road AI

Post by paullb »

Roujin wrote:
I noticed something that probably went wrong with your AI on the tournament server by TrueLight. See e.g. this overview: http://devs.openttd.org/~noai/tournamen ... erview.gif
Look at the right end of the map, after some time your AI appearently builds a heap of roads(?) all around that town.

It can also be seen in this overview: http://devs.openttd.org/~noai/tournamen ... erview.gif


Maybe you could make an own thread for your AI, even if you won't publish it until after the contest?
Created. http://www.tt-forums.net/viewtopic.php? ... 11#p701711
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy- a Road AI

Post by GeekToo »

Update of Convoy (v1.3):

-Using the new pathfinder V2
-A little better line management after the initial years
-Bug fixes
Attachments
Convoy.tar
(40 KiB) Downloaded 278 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI, V1.4

Post by GeekToo »

I see the competition is approaching ( and has passed ) Convoys performance, so it's time for another update.

I made Convoy a little more aggressive, so now it also uses town where other players stations are present.
I you don't like that, following Truelight's suggestion, I made it configurable, change the agressive setting in line 837 to false, and it will keep away from your towns.

Version 1.3 was not much better in performance than ConvoyLib, but this version should perform a little better than ConvoyLib.

It still uses only buses, so it's hard to compare with other AI that also use trucks and industries, but optimizing bus handling is not finished yet. I like to squeeze most out of buses before adding trucks and industries (which would improve Convoys performance rather easy).

Lots of changes have been made, esp in better vehicle management and line management. I still have a lot of ideas to further improve it, but (lack of) time is my biggest enemy at the moment.

As usual, any comments are welcome, I don't take criticism personal, but as a chance to improve Convoy.
Attachments
Convoy.tar
V1.4
(40 KiB) Downloaded 308 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V1.4)

Post by GeekToo »

Just to keep you updated, I'm working on an update of Convoy ( the 1.4 was a little disappointing in the competion with other AIs, though it did well on a stand alone map.

I'm pleased to see that after the update it is beating Admiral very nicely on a small map. Some more testing needs to be done and then I will post it. ( the pink line is Convoy, the blue line is Admiral in the Company value graphs)
Attachments
Unnamed, 1st Jan 1960.png
Unnamed, 1st Jan 1960.png (47.09 KiB) Viewed 6974 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Convoy: the bus loving AI (V1.4)

Post by Yexo »

GeekToo wrote:Just to keep you updated, I'm working on an update of Convoy ( the 1.4 was a little disappointing in the competion with other AIs, though it did well on a stand alone map.

I'm pleased to see that after the update it is beating Admiral very nicely on a small map. Some more testing needs to be done and then I will post it. ( the pink line is Convoy, the blue line is Admiral in the Company value graphs)
Concratulations, I'm curious for the new version. I hope you'll post it soon ;)

One small bug report (ok, my fault), which Zuu already fixed in the wiki: when building the route the pathfinder found, you should use

Code: Select all

local bridge_list = AIBridgeList_Length(AIMap.DistanceManhattan(path.GetTile(), par.GetTile()) + 1);
instead of

Code: Select all

local bridge_list = AIBridgeList_Length(AIMap.DistanceManhattan(path.GetTile(), par.GetTile()));
Notice the added +1, without that, it might fail in some cases.
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V1.4)

Post by GeekToo »

Ok, here you go, version 1.5 of Convoy. It's a bit more agressive now..
Attachments
Convoy.tar
(40 KiB) Downloaded 274 times
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: Convoy: the bus loving AI (V1.4)

Post by Zutty »

GeekToo wrote:Ok, here you go, version 1.5 of Convoy. It's a bit more agressive now..
Nice. How do you find the time for all the varied work you do on OpenTTD?! :D
PathZilla - A networking AI - Now with tram support.
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V1.5)

Post by GeekToo »

Update V1.6
============

-Comply to lastest API change ( adjacent stations )
-Several bugfixes
-Implementation of GetSetting Agressive: agressive is false in easy, true everywhere else. When not agressive, the AI tries to keep away from towns where another player has built stations
Attachments
Convoy.tar
(40 KiB) Downloaded 281 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V1.7)

Post by GeekToo »

Update V1.7
============

- fix of a long existing bug: when cash is not enough to build a route, it was not finished, leaving the stations unused. Now it retries to complete the route when more cash is available. Took some time, cause some structural changes had to be made
- on agressive settings, Convoy now is a lot more agressive than it used to be, making it a bit more competitive in multiplayer/ multiAI games. It was doing alright on it's own on a map, but with competing AIs it was too nice. If you don't want it to be agressive, change the settings in the config.nut file, then it keeps away from towns where other players built stations (but it alsa makes less money then :( )
-some smaller bugs solved.
Attachments
Convoy.tar
(40 KiB) Downloaded 300 times
User avatar
paullb
Traffic Manager
Traffic Manager
Posts: 129
Joined: 19 May 2008 13:11

Re: Convoy: the bus loving AI (V1.7)

Post by paullb »

Firstly, thanks for all the work on Convoy, I love using it as a benchmark to work with against Jinjaba.

However, with the 1.7 version I have noticed something perculiar. Often, for no apparent reason one of Convoy's vehicules is stopping in the middle of the road and never moved again and causes huge backups.
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V1.7)

Post by GeekToo »

Thanks for the report, it was also present in 1.5 and 1.6. I know what is causing it, and thought I solved it, but I guess I'll have to try again. :-( That's no problem, things will get better
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V8)

Post by GeekToo »

Convoy V8
====================

-revision numbering changed to integers ( so now it's v8 iso 1.8 )
-dummy save/load function added to prevent warnings in the log
-most important change: fixed the problem of buses being stopped in the middle of their trip
-some other bug fixes and optimizations
Attachments
Convoy.tar
(40 KiB) Downloaded 353 times
dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: Convoy: the bus loving AI (V8)

Post by dbkblk »

Hi !
I've found a bug with v8.

Convoy, try to make his first line then if it failed the debug show that and nothing change .... (look at the first pic).

I pressed "Reload AI" for both of the 3 convoy. It worked with the first one; i mean it has built a road and 2 stops..but it didn't built busses... AND it didn't work at all for the second. (Look at the first pic)

EDIT: I added a third pictures with strange messages when i push the reload AI button
Attachments
Jones & Co., 16 Déc 1970.png
Convoy Debug
(162.32 KiB) Downloaded 103 times
The first convoy built a line then nothing happens.png
(219.77 KiB) Downloaded 92 times
Reload Convoy v8.png
(217.62 KiB) Downloaded 94 times
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: Convoy: the bus loving AI (V8)

Post by GeekToo »

Thanks a lot for the feedback!

Judging by the logs, and the screenshot, you're playing on a hard map: very mountainous, and Convoy apparently has problems to find a good spot to build it's stations and depots.
Part of the problem is that I do not use drivethrough stations (yet, and they're setting dependent anyway) and try to minimize demolishing buildings in the town.
But I like the fact that you gave Convoy a hard time, gives me an opportunity to improve it, because of course it should also make money under these circumstances.

So, I would like you to post a savegame if that's possible, early in the game, so I can try to make things better.
dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: Convoy: the bus loving AI (V8)

Post by dbkblk »

Erf i can't find this savegame anywhere.
I'll try to reproduce that bug !

EDIT: The AI always do the same error (even are the difficultys parameters), i can send you my openTTD installation so you can try to find the problem ? maybe by mail ?

I have to noticed that it worked with previous versions !
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 15 guests