Page 1 of 7

NoCAB - Bleeding Edge edition Version 2.2a4

Posted: 21 Apr 2009 11:47
by Morloth
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 :|.

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 21 Apr 2009 17:08
by SirkoZ
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.

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 21 Apr 2009 17:13
by belugas
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

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 22 Apr 2009 04:53
by fanioz
I would like to say make a branch is a great idea , morloth.
Congratulations ... :D

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 22 Apr 2009 18:00
by Morloth
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.

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 22 Apr 2009 21:05
by SirkoZ
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.

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 22 Apr 2009 21:09
by SirkoZ
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. ;-)

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 23 Apr 2009 02:17
by belugas
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.

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 23 Apr 2009 05:35
by SirkoZ
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. ;-)

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 27 Apr 2009 18:17
by Speechless
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 :)

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 29 Apr 2009 14:52
by glx
[off topic]
Why use jpeg when openttd can make easier to read PNG screenshots ?
[/off topic]

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 29 Apr 2009 15:33
by Speechless
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

Re: NoCAB - Bleeding Edge edition - Version 1.18a1

Posted: 01 May 2009 01:43
by Morloth
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 ^^.

Re: NoCAB - Bleeding Edge edition - Version 1.18a2

Posted: 01 May 2009 18:12
by Wold
Have a look at this

Re: NoCAB - Bleeding Edge edition - Version 1.18a2

Posted: 01 May 2009 20:48
by Morloth
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

Re: NoCAB - Bleeding Edge edition - Version 1.18a4

Posted: 07 Jun 2009 13:57
by Morloth
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

Re: NoCAB - Bleeding Edge edition - Version 1.18a5

Posted: 08 Jun 2009 00:18
by Morloth
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

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Posted: 16 Feb 2010 10:44
by Morloth
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

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Posted: 16 Feb 2010 13:55
by Kogut
Planned stages for my future train section of AIAI

Re: NoCAB - Bleeding Edge edition - Version 2.0a1

Posted: 16 Feb 2010 17:25
by Timmaexx
Why don't you open your own Topic?