NoCAB - Bleeding Edge edition Version 2.2a4

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

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

NoCAB - Bleeding Edge edition Version 2.2a4

Post by Morloth » 21 Apr 2009 11:47

Hi everyone,

I've recently got back into coding NoCAB and decided some big changes need to be made which means I cannot guarantee that every iteration will be as stable as the original NoCAB. Therefore I'll be using this channel for developing the next iteration of NoCAB (version 2.2). Please let me know if you come across any bugs, once it is stable enough and includes all the features I want it to contain it will be released as NoCAB 2.2.0.

New Features:
  • Upgrade existing connections using a different connection type (e.g. upgrade a road connection to a train connection).
  • Better handling of build failures and fail gracefully. NoCAB now stops construction and destroys everything it made (if necessary).
  • Support trams / helicopters.
Bugs to crush:
* "travelFromNode does not exist" (http://www.tt-forums.net/viewtopic.php?p=947564#p947564).
* Ship docks sometimes build too far away from industry (http://www.tt-forums.net/viewtopic.php?p=948615#p948615).
* Assert failure after completing construction of a connection (http://www.tt-forums.net/viewtopic.php?p=936856#p936856).
* New trains keep getting build even though the line has reached maximum throughput http://www.tt-forums.net/viewtopic.php?p=948918#p948918.

Bux fixed in SVN version:
WIP

Bugs fixed:
* Loading / Saving takes too long (http://www.tt-forums.net/viewtopic.php?p=942632#p942632).
* "Saved connections are loaded twice!" (http://www.tt-forums.net/viewtopic.php?p=949318#p949318).
* "Trying to build vehicles for connections which do no longer exist." (http://www.tt-forums.net/viewtopic.php?p=949201#p949201).
* Sometimes bits of existing rail roads are removed when building a connection failed.
* Terraforming creates weird ridges at times which sometimes fails connections.

Please add more to the list if you find new bugs. They'll be squashed ASAP.

- Bram

P.S. You need a nightly later than rev. 22584 - otherwise the AI will not work!

Revision details:
-= Version 2.2a4 =-
* Terraforming issues solved.
* Train deconstruction does not remove pieces of rails of other connections anymore (hopefully!).
* Engines to be used are now evaluated on a connection to connection base. So expect to see a very diverse fleet as different connections might be better served with different vehicles.
* Repay loan at the very beginning of the game - no need for unnecessary losses!
* Upgraded to API 1.2.
* Check slopes for road and train paths (thx ac84!).
* The decision making process now takes into account the amount of money which will be made the next X months and can now decide to wait X months before doing construction because this will yield more income in the long run.
* A lot of other bugs fixed and massive code cleanup (WIP).

-= Version 2.2a3 =-
* Fixed a problem with saving.

-= Version 2.2a2 =-
* Problem with loading saved games.
* Fixed a problem where we tried to build vehicles for connections which do no longer exist.
* Make sure the depots and docks are removed if building a ship connection failed.
* Some code cleaning.

-= Version 2.2a1 =-
* Made loading and saving a LOT faster. Before it went over all possible industry connections to find the matching pairs :|.
Attachments
NoCABleedingEdge-2.2a4.tar
NoCAB 2.2.a4 Bleeding Edge Edition
(440 KiB) Downloaded 547 times
Last edited by Morloth on 23 Jun 2011 14:36, edited 53 times in total.

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1506
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by SirkoZ » 21 Apr 2009 17:08

Nice to see alpha version released separately, Morloth.

"Try to stay away from already serviced industry" is nice indeed however instead of trying - a direct "Stay away from industries with more than 60% of last_month_pct_transported[j] (j = production_rate 0 or 1) I think is simpler to implement even, if of course the last_month_pct_transported is exposed already in this new-fangled NoAI.

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by belugas » 21 Apr 2009 17:13

I don't think it is required.
What if one wold like to see service at 40%? or 70%? or 20%?
Hardcoding is bad.
In this case, it only serves your personal intentions, Sirkoz
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones

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

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by fanioz » 22 Apr 2009 04:53

I would like to say make a branch is a great idea , morloth.
Congratulations ... :D
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 - Bleeding Edge edition - Version 1.18a1

Post by Morloth » 22 Apr 2009 18:00

SirkoZ wrote:"Try to stay away from already serviced industry" is nice indeed however instead of trying - a direct "Stay away from industries with more than 60% of last_month_pct_transported[j] (j = production_rate 0 or 1) I think is simpler to implement even, if of course the last_month_pct_transported is exposed already in this new-fangled NoAI.
Yes, it would be easy to implement. But like belugas said, hard coded values are bad and I see no particular reason for imposing such a hard value. What I do now is divide the total production of a facility with the number of stations around it (+1) and consider this value its 'slice of the pie'. So the more stations the less likely it will consider it as a possibility. But this isn't final yet, still need to tweak this values and it could very well be that I end up with a hard value, although it seems unlikely.

But if you want to have a hardcoded version: fork NoCAB and create your own version :). The file you're looking for is 'management/connections/IndustryConnectionNode.nut'.

Thx fanioz :), I think more will follow over time.

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1506
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by SirkoZ » 22 Apr 2009 21:05

Well - the reason for those 60% is that original AI had this and it was known to compete also with itself.
That way it only competed when its previous service was bad (productions increased and the service couldn't handle it).
Of course the good part was that it only prevented it to compete with itself.

Your implementation doesn't bother me I just wanted to know your stance on this. Thx.

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1506
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by SirkoZ » 22 Apr 2009 21:09

belugas wrote:I don't think it is required.
What if one wold like to see service at 40%? or 70%? or 20%?
Hardcoding is bad.
In this case, it only serves your personal intentions, Sirkoz
Sure, why not, personal intentions, whatever you say.

Now for some facts. 60% is a very specific number in o/TTD, isn't it, belugas?
Remeber that 153 number with which you enumerated PERCENT_TRANSPORTED_60 in industry_cmd.c?

As I explained in the post above...

EDIT: And I agree, hard coding is not particularly preferable. ;-)

User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by belugas » 23 Apr 2009 02:17

PERCENT_TRANSPORTED_60 and PERCENT_TRANSPORTED_80 are used in standard and smooth economy as threshold to check if we increase or decrease production level (or give a bonus, in the 80 case). And the fact that I enumerated them is to make the code more readable.
So no, 60% does not have a VERY SPECIAL meaning. It's just a threshold in order to make economy dynamic, a bit.

I guess that is has nothing to do with AI.

Now... of course there are hard coded values in the program. You cannot expect all values to be configurable. It will be a mess for users to find their way in all that maze.
If you are not ready to work a bit for your ideas, it means they don't count much for you.
OpenTTD and Realism? Well... Here are a few thoughs on the matter.
He he he he
------------------------------------------------------------
Music from the Bloody Time Zones

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1506
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by SirkoZ » 23 Apr 2009 05:35

My point was - that 60% not only makes the AI stay away of your services, but also from needless competition (% > 60 where noone gets real benefits).

With resumed competition if % falls under 60% not only does competition show real benefits for the new-comer (AI or player), but also industry really likes that and keeps increasing.
I'm just talking about the behaviour that I observed with either economy and (although) the old AI, but works really well (should also with new AI's nicely).

That's the only reason I'm so hanging to those 60%. Because of the industry. ;-)

Speechless
Engineer
Engineer
Posts: 5
Joined: 02 Feb 2009 19:39

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by Speechless » 27 Apr 2009 18:17

Just found out nocab will crash a competitor if it goes bankrupt.
There will be a popup and just after reloading the AI player which has crashed there will be a message about the competitor going bankrupt.
The popup mentions a non-existent index '219'

Image

Besides this minor issue the AI works great so far :)

User avatar
glx
OpenTTD Developer
OpenTTD Developer
Posts: 620
Joined: 02 Dec 2005 15:43
Location: Drancy(93) - France
Contact:

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by glx » 29 Apr 2009 14:52

[off topic]
Why use jpeg when openttd can make easier to read PNG screenshots ?
[/off topic]

Speechless
Engineer
Engineer
Posts: 5
Joined: 02 Feb 2009 19:39

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by Speechless » 29 Apr 2009 15:33

Lol, because I wasn't even aware OpenTTD could make screenshots :oops:
I changed it back from full screen to windowed, pressed print screen and did the rest in mspaint :D

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

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Post by Morloth » 01 May 2009 01:43

Speechless wrote:Just found out nocab will crash a competitor if it goes bankrupt.
There will be a popup and just after reloading the AI player which has crashed there will be a message about the competitor going bankrupt.
The popup mentions a non-existent index '219'

...

Besides this minor issue the AI works great so far :)
Thanks for your feedback! This problem is now solved in the latest version ^^.

Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: NoCAB - Bleeding Edge edition - Version 1.18a2

Post by Wold » 01 May 2009 18:12

Have a look at this
Attachments
Duninghall Transport, 20th Nov 1962.png
(96.88 KiB) Downloaded 131 times
Image

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

Re: NoCAB - Bleeding Edge edition - Version 1.18a2

Post by Morloth » 01 May 2009 20:48

Wold wrote:Have a look at this
*Looks*, yes this is standard output, nothing unusual. The "problem" is that NoCAB plans connections up ahead and there could be a serious delay in planning a connection (e.g. an air connection) and actually building it, sometimes even years / decades apart. So when it comes to constructing such a connection it might very well be that a town cannot accept another airport or that it's impossible to place one.

There are some errors while building connections as well and the current fallback policy when something goes wrong is to simply report an error and move on, whilst you might want to do some repairing instead of abandoning constructing a connection. This will we one of the bigger features coming up any time after next month (very busy at the moment ;)).

Thanks for your feedback, hope I made it clear why it's not an error :).
Bram

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

Re: NoCAB - Bleeding Edge edition - Version 1.18a4

Post by Morloth » 07 Jun 2009 13:57

Probably the last update before OpenTTD 0.7.1 hits the shelf, it's basically a small bugfix release, mainly concerning ships.

The change log is as follows:
- Make sure ships are guided by building a buoy every 25 tiles (pathfinding truelly is idiotic ;))
- Make ships build connections from oil rigs and other water based industries.
- Update the road list of ships once the connection is build. We only want to include the buoys and end / start points. The rest of the data is irrelevant.
- Make sure that ships are nicely handled when sold so they don't get lost!
- Fixed the orders given to ships.
- Fixed a bug where ship depots were both build at the same site in case of a bidirectional connection.

This should fix all remaining issues with lost ships and what not. Please make sure you have at least version r16529, because otherwise the AI will keep on building ships for oil rigs as previous versions didn't return a valid station ID for those industries.

Build on :).
- Bram

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

Re: NoCAB - Bleeding Edge edition - Version 1.18a5

Post by Morloth » 08 Jun 2009 00:18

Ai, there was still a little bug with handling industries on water. This is fixed now. NoCAB will now also build larger airports if available.
- Bram

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

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Post by Morloth » 16 Feb 2010 10:44

New bleeding edge version! This time around I'm getting ready for the release of version 2.0 of NoCAB. The biggest change will be the inclusion of Train support (yes! It's finally here :D).

The current implementation is far from stable, but it is a working test version which is able to cope with trains. At the moment no rails is being reused, only single tracks are being laid and fancy things like "signals" are not being build at the moment. As time passes I'll update this version every now and then, so those who want to track the process of the 2.0 release, this is your thread :).

All comments are welcome, because I hardly ever play OpenTTD myself I can get all the input of what good strategies are for building train networks. At the moment there is not layout scheme, but I'm looking for a model which allows me to evolve my rail roads over time (i.e. start with a single platform and gradually expand).

Hope you guys enjoy it! :)
Bram

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Post by Kogut » 16 Feb 2010 13:55

Planned stages for my future train section of AIAI
Attachments
Przechwytywanie.PNG
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

Timmaexx
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 03 Jan 2009 17:55

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Post by Timmaexx » 16 Feb 2010 17:25

Why don't you open your own Topic?

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 12 guests