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

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 »

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!
Congrats to you as well with the implementation of NewGRF stations :).
Lord Aro wrote: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?
Yes.... :oops: You're right to point out that I haven't been very consistent. But with the end of NoCAB development for the foreseeable future I've decided to put the version number to 2.1.0 ;).
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
Thanks, this has been fixed now :).
planetmaker wrote:
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 :-)
Very true :). Just want to focus on some other games rather than transportation sims, but I'll be bank for sure. Have some good ideas where to take NoCAB next. But if bugs arrive I'll be on standby ;).

New version: NoCAB 2.1.0
* Fixed buffer overflow problem. If NoCAB earned more than 2^31 of cash (happens more often that one would think :P) the overflow causes money earned beyond that to be treated as negative. The API makes sure the maximum number returned is 2^31 - 1, but because I also add the money NoCAB can loan this pushes it over the edge.
* Deleted all references to 'HasNext' to avoid any problems with future versions of OpenTTD.
* Better demolishing behaviour when an industry is closed.
* NoCAB now actually builds trees, although a bug causes NoCAB to plant entire rain forests around cities ;).

That's it folks, enjoy the new release, I'm off on a sabbatical :).
- Bram

User avatar
NekoMaster
Tycoon
Tycoon
Posts: 3953
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

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

Post by NekoMaster »

Thank you very much! It actually works now! Now I can play with my favorite NoAI in nightlies :3 *goes of to play on his patched version of openttd*
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!

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2366
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

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

Post by Lord Aro »

A huge well done and congratulations is in order
Your regular uprates will be missed
We will grudgingly wait for your return
(naturally, the next release of AIAI will thrash it solidly) :roll:
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

User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

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

Post by fanioz »

I'm not sure, is this has been reported or not
Attachments
Hawthorn & Co., 27th Jul 1968.png
(44.38 KiB) Downloaded 1 time
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

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

Post by Morloth »

fanioz wrote:I'm not sure, is this has been reported or not
No it wasn't, thanks! :)

Fixed in the latest version, changelog:
- Fixed a bug in the routine for building depots for ship connections. In the case of a bidirectional connection if no suitable place could be found for the other depot the array with all possible connections would be over read resulting in a crash (thx fanioz!).
- More flexible when choosing spots in a town.
- Pathfinder for ships more greedy.
- Subsum returns reports now in the order of utility score (most important first!).

Bram

User avatar
NekoMaster
Tycoon
Tycoon
Posts: 3953
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

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

Post by NekoMaster »

Im finding that when I play with no Cab, it only plays with like, thousands of buses or trucks (usually 30 per connection over very long distances) even though it has the option of using trains, planes, and ships
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.1.1

Post by Morloth »

NekoMaster wrote:Im finding that when I play with no Cab, it only plays with like, thousands of buses or trucks (usually 30 per connection over very long distances) even though it has the option of using trains, planes, and ships
There is actually a couple reasons for that behaviour. First of all you need to know that NoCAB plans ahead and build up a database of possible connections. However, I only allow it to calculate connections it should be able to build given the maximum loan or bank balance (whichever is higher). In the beginning of the game this will mean that it will be limited to mainly airlines and trucks / buses. So when the loan is raised to a point that rail connections become available as well it is very possible that it already stored 100 connections using trucks / buses. If the rail connections it plans are better than the variant using trucks / buses it will be replaced so this should fix this issue. However, usually a that point it will be making so much money and the pathfinder for rail connections will simply not be able to prevent all of the 100 truck / bus connections to be build before it has a chance of updating them.

Secondly, which ties in with the issue above, the pathfinder for rails are slower due to their nature than the pathfinder for road vehicles and airoplanes. So NoCAB will be able to calculate more truck / bus routes than train routes and given that money at some point is no longer an issue it will build more of the former.

It is true that this behaviour should be changed and it is currently planned for the next release. The plan is to allow NoCAB to upgrade its connections, for example if we first have connection from a coal mine to a power plant using trucks to transport the coal, we might find that it is actually a better idea to replace this connection with one using a train and have it transport the cargo to a power station further away gaining more money that way. This should fix this issue you're describing. But at the moment there is little you can do to change this behaviour I'm afraid :/.

Hope this helps,
Bram

User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2366
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

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

Post by Lord Aro »

apologies about bumping this thread while you're on your holiday :lol: , but i think i've found a bug:

When the AI is set to rail only (and i suppose it would happen at another time as well) the rail station building always returns a ERR_PRECONDITION_FAILED

see pic:
nocab bug.png
(62.88 KiB) Downloaded 2 times
also, station placing of docks needs a bit of work:
the AI placed the dock just out of range of the factory, and it also took it years to get rid of the station:
Attachments
nocab ship problem.png
(128.49 KiB) Downloaded 2 times
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

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

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

Post by Morloth »

Lord Aro wrote:apologies about bumping this thread while you're on your holiday :lol: , but i think i've found a bug:

When the AI is set to rail only (and i suppose it would happen at another time as well) the rail station building always returns a ERR_PRECONDITION_FAILED

see pic:
nocab bug.png
also, station placing of docks needs a bit of work:
the AI placed the dock just out of range of the factory, and it also took it years to get rid of the station:
Thanks for the report :). I'll have a look next month to see if I can fix this issues.

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

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

Post by Morloth »

New version 2.1.2 released. After reading the results of a small test by Samu I went on to discover why NoCAB did so bad. As it turned out there has been a change in the code of building NewGRF stations 4 months ago which broke that part of NoCAB, so it wasn't able to build train connections for that long! :evil:

Here is the fix! Enjoy :).
Bram

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

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

Post by Samu »


Brumi
President
President
Posts: 905
Joined: 18 Jul 2009 17:54

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

Post by Brumi »

I also had a crash using NoCAB 2.1.2 on OpenTTD 1.0.4, it seems to be the same problem as Samu's:
Attachments
NoCAB crash 1.png
(30.76 KiB) Downloaded 2 times
NoCAB crash 2.png
(21.79 KiB) Downloaded 2 times

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

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

Post by Zuu »

Code: Select all

[url=http://www.openttd.org]Some text[/url]
=> Some text
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

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

Post by Samu »


Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

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

Post by Samu »

Some text
Some text

http://cid-23b29f3de45f6f1f.office.live ... 201953.png

The forum hates me.

<iframe title ="Preview" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" style="width:320px;height:179px;padding:0;background-color:#fcfcfc;" src="http://cid-23b29f3de45f6f1f.office.live ... "></iframe>

http://cid-23b29f3de45f6f1f.office.live ... =455874334

Some text
Last edited by Samu on 09 Nov 2010 21:56, edited 5 times in total.

Yexo
Tycoon
Tycoon
Posts: 3653
Joined: 20 Dec 2007 12:49

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

Post by Yexo »

The ^ in the url makes it fail.

Edit: more like the ].

Edit2: this works:

Code: Select all

[url=http://cid-23b29f3de45f6f1f.office.live.com/self.aspx/.Public/Sem%20nome,%209%20Out%201953.png]Some text[/url]
Some text

Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

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

Post by Samu »

Microsucks sucks.

Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

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

Post by Morloth »

Thanks for the bug report, but it seems my fix only works for the nightlies. As AIIndustry::INDUSTRYTYPE_* in only included in there. I'm going to assume that 1.0.5 will include these change so when that version is released NoCAB should work as expected. The only way I can "fix" NoCAB for the current version is by disabling the NewGRF stations and then enable it when 1.0.5 comes around. So I keep NoCAB as it is and hopefully 1.0.5 will come around quick enough.

Bram

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

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

Post by Zuu »

I assume you refer to AIIndustryType::INDUSTRYTYPE_*. Those are only part of the nightly API docs - not the 1.0.x API docs. Thus they are not available in the 1.0 API version. Sometimes if you develop on a nightly build you can by accident access 1.1/trunk API functions/features even if you have told OpenTTD that you want the 1.0 API.

This is probably because OpenTTD provides backward compatibility using the compatibility nut files that ship with OpenTTD. These act as a bridge between the new API and the old API so that an AI written for an old API still work (given that it tells OpenTTD which compatibility layer to load). However it doesn't seem that these compatibility layers hide the new features which is probably what have happened it your case.

Be sure to use the 1.0.x API docs http://noai.openttd.org/api/1.0.5/ to not accidentally use new features by mistake.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Mac_
Engineer
Engineer
Posts: 1
Joined: 21 Nov 2010 15:47

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

Post by Mac_ »

Same error, on 1.0.5
:-(
Attachments
NoCAB_error.png
(275.38 KiB) Downloaded 1 time

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 0 guests