NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.1.3

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

peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.16

Post by peter1138 »

This hasn't been mentioned yet...

dbg: [ai] Registering two AIs with the same name and version
dbg: [ai] 1: /home/petern/.openttd/content_download/ai/NoCAB-2.0.15.tar/nocab-2.0.15/main.nut
dbg: [ai] 2: /home/petern/.openttd/content_download/ai/NoCAB-2.0.16.tar/nocab-2.0.16/main.nut
dbg: [ai] The first is taking precedence.
He's like, some kind of OpenTTD developer.
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by Morloth »

New version! :D

After seeing AIAI and Trans AI becoming better and better, leaving NoCAB biting the dust in the previous competition I decided something had to be done ;).

I looked at the current weak points in the current AI and decided that the subsum algorithm needed some thought. Before it was a greedy algorithm, presented with a list of possible connections to build or upgrade it took the set with the highest utilities by first selecting the one with the highest utility it could still pay for and working down the list. While this did work, it would miss opportunities like the following:

Money available: 10000

Possible connections:
A -> B : cost = 10000 : utility = 100
C -> D : cost = 6000 : utility = 80
E -> F : cost = 4000 : utility = 60

Using a greedy algorithm we end up with the connection A -> B and the utility 10000. However if we took the last two we would end up with a utility of 14000. To make this happen NoCAB now uses the greedy algorithm as the base line and than uses a random algorithm to try different combinations for a set amount of time, continuously trying to improve the utility.

This in addition to a better utility function makes for way better performance than before! :D

In addition, I also noticed that some NewGRFs are being developed with custom rail types. I've tweaked the code to make sure that NoCAB is now more flexible with the rails types it uses, i.e. not "only the latest added", but rather choose the rail type depending on the engines to be used. While it is not full proof (not yet any way) it at least works in the scenarios I've tested it on.

Lastly the HQ will no longer be build at the beginning of the game but will be build once NoCAB has been making some money. More than once it happened that building an HQ at the start of the game in the hard setting removed 25% of NoCAB's money. So it will now be build when NoCAB has $1.000.000 to waste and also be build at a more suitable location than just the smallest town ;).

That's all folks! The complete changelog is below:

-= 2.0.18 (r484) =-
* HQ is now only build once NoCAB has earned enough money.
* Better subsum algorithm, NoCAB makes better (i.e. not only greedy) decisions.
* Added support for NewGRF rails (e.g. NuTracks).
* Better signal placement for less jams.

Enjoy! :)
Bram
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by Kogut »

Morloth wrote:More than once it happened that building an HQ at the start of the game in the hard setting removed 25% of NoCAB's money.
Ekkhhm. How?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by Morloth »

Kogut wrote:
Morloth wrote:More than once it happened that building an HQ at the start of the game in the hard setting removed 25% of NoCAB's money.
Ekkhhm. How?
Hmmz... maybe that's my bad and I wasn't paying attention as NoCAB failed to finish a connection and mistook the money spend as the money spend on the HQ :P. If it's not that expensive I'll reintroduce it :).
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by Kogut »

60 base cost, 1500 with clearing 4 field tiles
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.19

Post by planetmaker »

A small comment dedicated to this AI as based from my (short) competitive run with a number of other AIs: you survived :-)

Best areas of improvements now seem to be from this brief test: it seemed to have picked not the most profitable routes for the RV, but it got heavy competition on its routes, too; but there were industries which were not (yet) serviced, maybe it could check for that.
I actually hoped that NoCAB would be one of the AIs which would give me a nice train support - even though I didn't make it easy for AIs as I added the 2cctrainset with default settings where indeed a start with RV or possibly a money maker using a handful of planes might seem like a good choice (albeit even that is difficult in 1945).

Attached a screenshot which compares this AI with the best AI (AIAI) and the best train-using AI (simpleAI)

All in all: kudos, even though NoCAB didn't do quite as well as the last time, it's one of my favourite AIs. And it's probably one time win, other time loose :-) Keep up your good work!
Attachments
nocab.png
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.19

Post by Kogut »

And great thanks for that tournament!
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.19

Post by Morloth »

planetmaker wrote:A small comment dedicated to this AI as based from my (short) competitive run with a number of other AIs: you survived :-)
That's at least something ;).
planetmaker wrote:Best areas of improvements now seem to be from this brief test: it seemed to have picked not the most profitable routes for the RV, but it got heavy competition on its routes, too; but there were industries which were not (yet) serviced, maybe it could check for that.
That's true, at the moment I assume my AI can transport everything and simply ignore the competition. Usually I test NoCAB only against a single opponent in which cast it's not a big issue. But when facing 14 opponents this is a different issue. So I'll give it a try, although there is an option for that (NiceCAB).
planetmaker wrote:I actually hoped that NoCAB would be one of the AIs which would give me a nice train support - even though I didn't make it easy for AIs as I added the 2cctrainset with default settings where indeed a start with RV or possibly a money maker using a handful of planes might seem like a good choice (albeit even that is difficult in 1945).
Same here :). But I'll have a look at these NewGRFs, I usually don't enable any so I don't know if something weird is going on.
planetmaker wrote:All in all: kudos, even though NoCAB didn't do quite as well as the last time, it's one of my favourite AIs. And it's probably one time win, other time loose :-) Keep up your good work!
Thanks, and thanks for running the tournament :). But you're right, some runs you win some runs you loose. There doesn't seems to be any pattern, but NoCAB has a lot of randomness in its decision making so it's kinda hard to predict how it is going to play :).

I'll have a look at you comments and try to include them in the next version :).
Bram
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.20

Post by Morloth »

New version! Took some of the previous comments into account and came up with better algorithms and methods to determine when to spend money and - following the method of AIAI - taking into account the optimal distance for vehicles. Resulting in a more competitive NoCAB :).

Also some issues regarding the CC2 train set have been fixed and NoCAB should be able to build these trains (although this is not a work around for the bug mentioned here).

Bram
User avatar
RFHolloway
Engineer
Engineer
Posts: 5
Joined: 11 Jan 2008 10:13

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by RFHolloway »

Morloth wrote:New version! :D

I looked at the current weak points in the current AI and decided that the subsum algorithm needed some thought. Before it was a greedy algorithm, presented with a list of possible connections to build or upgrade it took the set with the highest utilities by first selecting the one with the highest utility it could still pay for and working down the list. While this did work, it would miss opportunities like the following:

Money available: 10000

Possible connections:
A -> B : cost = 10000 : utility = 100
C -> D : cost = 6000 : utility = 80
E -> F : cost = 4000 : utility = 60

Using a greedy algorithm we end up with the connection A -> B and the utility 10000. However if we took the last two we would end up with a utility of 14000. To make this happen NoCAB now uses the greedy algorithm as the base line and than uses a random algorithm to try different combinations for a set amount of time, continuously trying to improve the utility.

This in addition to a better utility function makes for way better performance than before! :D
Surely you want to rank based on utility divided by cost, and then do fluctuations around that? if your measure of utility is expected profit per year then utility divided by cost is return on capital, which is exactly what you should be maximising.
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.18

Post by Morloth »

RFHolloway wrote:
Morloth wrote:New version! :D

I looked at the current weak points in the current AI and decided that the subsum algorithm needed some thought. Before it was a greedy algorithm, presented with a list of possible connections to build or upgrade it took the set with the highest utilities by first selecting the one with the highest utility it could still pay for and working down the list. While this did work, it would miss opportunities like the following:

Money available: 10000

Possible connections:
A -> B : cost = 10000 : utility = 100
C -> D : cost = 6000 : utility = 80
E -> F : cost = 4000 : utility = 60

Using a greedy algorithm we end up with the connection A -> B and the utility 10000. However if we took the last two we would end up with a utility of 14000. To make this happen NoCAB now uses the greedy algorithm as the base line and than uses a random algorithm to try different combinations for a set amount of time, continuously trying to improve the utility.

This in addition to a better utility function makes for way better performance than before! :D
Surely you want to rank based on utility divided by cost, and then do fluctuations around that? if your measure of utility is expected profit per year then utility divided by cost is return on capital, which is exactly what you should be maximising.
That's what I did before, but I found out that maximizing profit per month - regardless of cost - actually works better. The costs for the connections are taken care of by the sub sum algorithms as shown above. But I'm not sure if I tried to use the method you suggest in combination with the new sub sum algorithm. I'll certainly give it a try :).

Thanks for your comment!
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Morloth »

Version 2.0.21:

Support for NewGRF stations! :D
NewGRF stations for NoCAB :)
NewGRF stations for NoCAB :)
Unnamed, 9th May 1967.png (88.15 KiB) Viewed 4321 times
Fixed a bug which calculated that trains can only carry 0 pieces of cargo...

Enjoy! :)

P.S. This will be the last update for quite a while. I'm going to focus on some other projects at the moment so only if bugs pop up I'll take a look. But for the moment this is the last version of NoCAB for the near future. Thanks for all your feedback!
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Michiel »

Congrats! I hope it'll stand the test of time. Those stations look really cool! Don't mind if I have a look at how that's done ;) ChooChoo is supposed to be about making things look good, after all :)

Good luck on your new projects!
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Lord Aro »

is it me, or have you got your AI version numbers in a muddle?
shouldn't this be v2.1.0 or something because you've added a minor feature?
i mean it's (mostly) not a bug fix is it?
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Kogut »

Michiel wrote:Congrats! I hope it'll stand the test of time. Those stations look really cool! Don't mind if I have a look at how that's done ;) ChooChoo is supposed to be about making things look good, after all :)

Good luck on your new projects!
Via BuildNewGRFRailStation http://noai.openttd.org/api/trunk/class ... 2262c8b42f
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by NekoMaster »

NoCAB still crashes in nightlies....
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Kogut »

So it may be nice to say WHY it crashes.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by NekoMaster »

Kogut wrote:So it may be nice to say WHY it crashes.
If you look at some of my earlier crash posts, its a "HasNext" not found
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by Morloth »

NekoMaster wrote:
Kogut wrote:So it may be nice to say WHY it crashes.
If you look at some of my earlier crash posts, its a "HasNext" not found
Nasty... I'll have a look at it, followed some of the other threads about this but didn't really pay attention regarding NoCAB. Will make a fix ASAP!

Bram
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: NoCAB - Trains, Trucks, Busses, Aircraft and Ships! v2.0.21

Post by planetmaker »

Morloth wrote: P.S. This will be the last update for quite a while. I'm going to focus on some other projects at the moment so only if bugs pop up I'll take a look. But for the moment this is the last version of NoCAB for the near future. Thanks for all your feedback!
Thanks for all your frequent updates. I'll find it sad, when this great NoAI should not see the maintenance level it did so far and which can be considered outstanding :-) I hope you'll return to it with the same passion after a well - deserved break :-) Yes, sometimes one has to do different things in order to keep the joy :-)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 36 guests