Page 13 of 20

Re: ChooChoo, a train network AI

Posted: 19 Mar 2011 12:52
by Michiel
planetmaker wrote:Also the current bananas version still creates continuously errors (though not fatal, it's annoying as it spams the console, which is nothing I like when doing casual testing, of also other stuff concurrently)
Sorry - they're not errors, but ChooChoo makes heavy use of exceptions, which the Squirrel VM always outputs to the console, even if they are caught and handled by the AI.

Re: ChooChoo, a train network AI

Posted: 04 Apr 2011 08:40
by krinn
I cannot use choochoo v361, there's no real errors here, just a play style

choochoo refuse to work because of construction.road_stop_on_town_road is off

well, as AI are nearly all bad guys when we speak about town and traffic, at least removing this option (i still allow them to build it on all route but not for town) this will lower chance of road stucks by a waiting bus/truck to load on a town road (because everyone use town roads). It happen too with too many vehicle waiting in front of a station, but with road_stop_on_town_road, it happen with just 1 vehicle waiting.
If i understood clear (didn't test choochoo because of the setting), choochoo isn't even really use it! It's just to extend its station coverage.

You wish keep that setting as-is or change your mind ?

Re: ChooChoo, a train network AI

Posted: 05 Apr 2011 15:15
by Michiel
krinn wrote:You wish keep that setting as-is or change your mind ?
I'll think about it :)

Re: ChooChoo, a train network AI

Posted: 07 Oct 2011 11:43
by Kogut
Without industries CHhooChoo crashes

Re: ChooChoo, a train network AI

Posted: 07 Oct 2011 18:53
by Michiel
Oh, that's kinda bad. I'll see if I can fix that, thanks!

Re: ChooChoo, a train network AI

Posted: 07 Oct 2011 19:10
by Kogut
And it will loop over and over with more freight lines to do than industries.

Re: ChooChoo, a train network AI

Posted: 11 Oct 2011 03:12
by CurlySue
There are two bugs:

Re: ChooChoo, a train network AI

Posted: 11 Oct 2011 08:42
by Lord Aro
it helps if you actually read the error message.

You need to enable "Allow building drive-through road stations on town roads" setting in the advanced setting.

Also, try to use .png for screenshots, using OTTDs built in screenshot 'taker' (click far right menu button, and select desired screenshot option)

Re: ChooChoo, a train network AI

Posted: 11 Oct 2011 09:25
by Michiel
Thanks for the bug report, Curly, and thanks LordAro for already providing the answer for me :)

Re: ChooChoo, a train network AI

Posted: 13 Dec 2011 20:50
by Endymion
i got this bug right after the ai starts

Re: ChooChoo, a train network AI

Posted: 13 Dec 2011 21:15
by S4D Rampage
Endymion wrote:i got this bug right after the ai starts
If i remember rightly i got that error like 7 years into the game (1978). Yes I start at 1971!

Re: ChooChoo, a train network AI

Posted: 13 Dec 2011 22:20
by Michiel
Thanks, I'll have a look!

Re: ChooChoo, a train network AI

Posted: 03 Jan 2012 05:47
by Aali
Perhaps you are already aware of this but your AI can completely lock up OTTD on large maps with many industries.
The problem is of course the gigantic list of routes generated then sorted with a comparator function. (sort is a native call and can not be suspended)

Since you are only ever interested in the best 10 routes this is completely unnecessary and the following change will make OTTD run smooth as silk during the bootstrap phase even on a 2048x2048 map with industries set to "high":

Code: Select all

	local routes = [];
	foreach (cargo, _ in cargoList) {
		Debug(AICargo.GetCargoLabel(cargo));
		local consumers = AIIndustryList_CargoAccepting(cargo);
		local producers = AIIndustryList_CargoProducing(cargo);
		producers.Valuate(AIIndustry.GetLastMonthProduction, cargo);
		producers.KeepAboveValue(0);
		
		foreach (producer, _ in producers) {
			foreach (consumer, _ in consumers) {
				local distance = AIMap.DistanceManhattan(AIIndustry.GetLocation(producer), AIIndustry.GetLocation(consumer));
				if (distance < MAX_CARGO_DISTANCE) {
					local route = CargoRoute(producer, consumer, cargo)
					if (route.payback > 0) {
						//Debug(route)
						routes.append(route)
						routes.sort(CompareRouteValue)
						routes = routes.slice(0, min(10, routes.len()))
					}
				}
			}
		}
	}
This is definitely one of my favorite AIs, keep up the good work!

Re: ChooChoo, a train network AI

Posted: 05 Jan 2012 15:12
by Michiel
That's a great idea! I'll put it on the to do list, but I must admit I haven't been getting around to AI development recently...
Aali wrote:This is definitely one of my favorite AIs, keep up the good work!
Thanks :D

Re: ChooChoo, a train network AI

Posted: 12 Jan 2012 19:02
by frosch
my mailbox wrote: Błąd
:)

Re: ChooChoo, a train network AI

Posted: 15 Jan 2012 14:44
by Michiel
LOL, just the other day I was telling Maninthebox that ChooChoo managed to go without a real crash for so long :P
Added to The List (TM) :)

Re: ChooChoo, a train network AI

Posted: 14 Feb 2012 01:37
by sss
nice AI, though howd u get that kind of graphics?

Re: ChooChoo, a train network AI

Posted: 15 Feb 2012 12:38
by FooBar
sss wrote:that kind of graphics?
What kind?

Re: ChooChoo, a train network AI

Posted: 20 Feb 2012 18:36
by Michiel
sss wrote:nice AI, though howd u get that kind of graphics?
Thanks! But as FooBar said... what kind of graphics? :)

Re: ChooChoo, a train network AI

Posted: 20 Feb 2012 23:11
by soravux
I've got an issue with ChooChoo on OpenTTD 1.2 beta 4.

I guess it's a Squirrel parser update in the 1.2 version of OpenTTD that broke the comparator function by not returning a 0 on similar values. The Squirrel engine returned an "Inconsistent compare function" error without this modification.

I have modified the CompareRouteValue function to make it look like this:

Code: Select all

function CompareRouteValue(a, b) {
	if (a.payback==b.payback) return 0;
	return a.payback > b.payback ? 1 : -1;
}
It now works for me on the latest version. Hope it helps...