Page 2 of 4

Re: TownCars AI

Posted: 19 Jul 2009 11:19
by nb-au
I get similar problems to that guy above except i get them on all maps i try to start :'(

Re: TownCars AI

Posted: 19 Jul 2009 22:01
by Zuu
The problem you have will not go away until StreetTraffic and/or TownCars gets updated.

Re: TownCars AI

Posted: 21 Jul 2009 06:50
by Wasila
What about:

You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.

Re: TownCars AI

Posted: 21 Jul 2009 14:33
by Zuu
Wasila wrote:What about:

You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.
That is the thing that need to be addressed in the code when updating the AIs. If I confused you, I meant by updating, that the code has to be changed/updated with regard to the error you just mentioned.

Re: TownCars AI

Posted: 29 Jul 2009 05:22
by Zuu
TownCars version 4

I've fixed the DoCommand error. So it should work again with recent OpenTTD versions. Version 4 is on BaNaNaS (the content download system) right now.

It is fixed by removing the usage of a custom valuator function and instead use the default valuate function. To do so both CanConnectToRoad and GetNeighbours4 need to not belong to the TownCars class. (static membership might work though, but have not tested that)

Re: TownCars AI

Posted: 04 Aug 2009 20:40
by ruivilela
Thanks for fixing that issue on towncars. I already missed that cars hanging around the scenario.

but some things: I have breakdowns active, and if that cars don't get maintenance, they will crash quite often, no?

and is there any renew of cars by new models? If I get to 2009, cars created in 1930 are the Model T (generic cars grf) .

Re: TownCars AI

Posted: 05 Aug 2009 03:29
by Zuu
Yes if you have break down on eventually the cars created by TownCars will break down very often.

Maintanence and renewal of vehicles are features available in the spin-off StreetTraffic, but not TownCars. StreetTraffic was created from version 3 of TownCars and has not been fixed but for that reason I have written quite clearly how I did to fix TownCars.

Re: TownCars AI

Posted: 05 Aug 2009 10:01
by ruivilela
I notice a performance issue in a game I created. in a duo core P7530.

I had only 12 planes. And I started to created road infrastructure.

Cheated to get more cash. I created a map with 64x1024. Made a "motorway", with bridge/tunnel intersection, and the double road (each with a uniq way) covered about 800 tiles. 4 towncars AI with 200 cars each, there was around 25 towns on map. I connected all cities on that tiles. The towncars spreaded all over the map. Then I noticed there was a extra CPU usage.

It was running apparently normally, but I could not get the game faster (tab key) ... So I cut the double road on the middle of map, and I got a little better performance.

I reload the 4 AI and the performance issue disappeared. The game has problems with ~800 cars around?

Re: TownCars AI

Posted: 27 Oct 2009 21:36
by Spedichef
StreetTraffic v2

I played a bit around with Franks StreetTraffic-AI and added some code to it.

Major point is the extended AI lifespan. The AI checks its bank balance and will take only the loan it really need, so it does not run out of cash. Of course, one day the AI has taken all the loan and will die (, but not for lang, as Franks AI will start all over again). You can only save the AI from dying using the cheat console with ALT + C + CTRL, pause the game, change the company to “StreetTraffic”, add a lot of funds, change back to your company and enjoy a game with a never dying AI and its traffic.


Changes / additions to the code:

- make the AI playable again for OpenTTD nightlies after 0.7.3 release. The developers removed the GetHeight-Function and added a GetMaxHeight command.

- New formula 1 : 1000 for the car / inhabitants ratio instead of 1 : 100. This allows a "softer" car output in the cities.

- AI tells you more details in AILog Consol, what it does and how long it took etc, look in the AI Debug Console what's going on.

- AI tries not to die by bankruptcy by repaying the maximum loan and then adjusting the loan in steps. Depending on the AI settings the lifespan of the AI can be extend quite a lot. Feel free to do some experiments with it: 25 cities with 2 cars per 1000 inhabitants gives approx 65 years, 5 cities with 5 cars per 1000 inhabitants comes to approx 85 years, both scenarios built a maximum of 500 cars.

- Changed the AI config from „ticks“ to „days“, assume it is more "userfriendly" for the player.

- The „ticks per day“ (ingame ticks for one ingame day) can be amended to influence the vehicle purchasing rate, waiting times for next actions – this might be useful for player using the daylength patch.

I am not a coder, so the coding style might not look as it should be. This was just for some fun for myself and to honor Franks work on this eyecandy AI. If you find a bug, please post here, maybe someone will correct it. ;)

To use the AI you will need of course the "Generic Cars"-NewGRF available from the Content Download-Option in OpenTTD.

Thanks & best regards from Switzerland
Tim

(p.s. first post after joining the forum in 2005)

Re: TownCars AI

Posted: 27 Oct 2009 21:55
by Zuu
Nice to see an update to the StreetTraffic spin off.

I think you should try to contact Frank and either get him upload your v2 to Bananas as a next version of the already existing StreetTraffic AI. If he don't want to upload things for you, you can possible arrange together with some of the devs with access to the Bananas database to move the ownership to you. Make sure you get in touch with Frank and get his opinion before contacting the devs. Also before contacting the devs, make sure you register an account on openttd.org if you have not done so yet. (If you have an old account on eg. bugs.openttd.org make sure you migrate that account to the central user system)

Edit: I guess KI means Komputer Inteligence or something similar in one of your four official languages in Switzerland, since you seam to have used "KI" in place of "AI" at some but not all places in your post.

Re: TownCars AI

Posted: 27 Oct 2009 22:05
by Spedichef
Yes, oops, KI is the abbreviation for "Künstliche Intelligenz" the translation of the english AI "Artificial intelligence". Amended it in my post for easy understanding. Thanks for noting.

Maybe Frank reads your post too, would appreciate if he likes the amendments too and upload in the online content archive. For now, I will wait a couple of days, action can be taken later.

Best regards
Tim

Re: TownCars AI

Posted: 01 Nov 2009 10:47
by Spedichef
Info for everyone, who is loading a game and getting an "rawin"-error message: this issue is known and discussed here.

Re: TownCars AI

Posted: 01 Nov 2009 12:16
by Zuu
I can not comment on the StreetTraffic AI, but for TownCars I have tested it on both nightlies and 0.7.3 and it does not get that problem. Mostly because it does not use the rawin function. :-)

Re: TownCars AI

Posted: 01 Nov 2009 22:29
by Spedichef
Hi Zuu

Yes, most likely. Just compiled the 17927 nightly, but I have still an AI crash. At least it is only Eyecandy and not a real competitor AI, and after reloading the AI, it starts all over to build its vehicles.

Re: TownCars AI

Posted: 02 Nov 2009 08:16
by Zuu
Spedichef wrote:Hi Zuu

Yes, most likely. Just compiled the 17927 nightly, but I have still an AI crash. At least it is only Eyecandy and not a real competitor AI, and after reloading the AI, it starts all over to build its vehicles.
Which AI do you refer to, TownCars or StreetTraffic? Now that both AIs have ended up in the same thread it is quite helpful to be clear about which AI you refer to.

Re: TownCars AI

Posted: 02 Nov 2009 17:40
by Spedichef
I am referring to StreetTraffic AI.

Re: TownCars AI

Posted: 07 Nov 2009 15:48
by Gremnon
Does TownCars/StreetTraffic have trouble with hilly maps normally? I'm playing a slightly modified CargoDist game, though the only road-affecting patch is Traffic Lights, I've made sure the generic cars grf is loaded, and made sure there's spaces for them to build depots, but they just can't seem to built one.

Re: TownCars AI

Posted: 07 Nov 2009 16:33
by Spedichef
Just speaking for StreetTraffic: With my Nightly 17927 the AI builds depots and cars on all maps generated by OpenTTD on the highest levels for hills, smoothness and the lowest for water.

Have you set the AI config from the main screen ? I could imagine, that if there are no entries set by the config dialogue into the openttd.cfg, the AI won't start to do anything, as it reads from the openttd.cfg all the building data (number of cities, numbers of cars, timeframe etc).

Please check and advise. You may also open the AI debug consol from the info menu and look up, what StreetTraffic does. It talks quite a lot :).

Re: TownCars AI

Posted: 07 Nov 2009 16:46
by Gremnon
I'm using r17986, with the trunk-compatible cargodist patch from last night. I'll have to look to find out the exact revision.
I've checked the AI settings, they're set to use 0 cost/running cost RV's, which Generic Cars clearly provides - none of the other GRF's I have loaded modify that.
It also now seems that hilliness and roughness don't matter, in a new game, they've both managed to build in a single town on a 256x64 map, which has 5 towns on it.

I did also make sure the AI settings were set, TownCars is set to load first, followed a month later by StreetTraffic, and finally by PAXLink a year after.

As to the AI Debug, TownCars v4 just outputs "Failed to build depot" for all but the single town it managed to build in, then goes to sleep forever, in it's own words.

StreetTraffic (v1) is similar, it says "Failed to build depot: No cars will be build in this town!" and nothing else on the matter.
I did use the cheat dialog to change to playing as StreetTraffic, and built depots for it in the hopes it would use them, but it's ignored them.

Re: TownCars AI

Posted: 07 Nov 2009 19:41
by Spedichef
As I do not use the SVN and download the source only occasionally and compile for myself, I have only access to 17983 as latest revision from OpenTTD website. Just compiled the 17983 and all AI is still doing the job. I am afraid, I cannot help here. Maybe it is because of the cargodist patch.