Page 6 of 7

Re: CivilAI

Posted: 01 Jan 2020 19:54
by xarick
CivilAI-25 has a bug function GetVersion() { return 24; }

Re: CivilAI

Posted: 02 Jan 2020 02:01
by PikkaBird
Whoops. :roll:

I also took the opportunity to fix some logic which was largely preventing the AI building new cargo trains once it had a passenger network.

Version 29:
Bug fixes:
Trains
- Fix AI getting stuck trying to build a junction on a station tile.

Version 28:
Tweaks:
Road Network:
- Unified and revised the road depot building code, removing the old concept of "Home Depot."

Version 27:
Bug fixes:
Trains:
- Fixed AI getting stuck building wagons if it fails to build a locomotive.

Version 26:
Bug fixes:
- Correctly updated version number in-game.
Trains:
- Fixed AI not building new rail lines if it has existing termini with available connections but no supplying industries.

Re: CivilAI

Posted: 02 Jan 2020 08:55
by andythenorth
Hurrah! More trains! :D

Found something weird in v29, got a train with only one order. It's plugged up that route. :twisted:

Re: CivilAI

Posted: 02 Jan 2020 15:27
by PikkaBird
That's odd. I'll look out for that. In the meantime, I guess it will sell such trains after 2 years when they fail to make any income. :)

Version 30:
Bug fixes:
- Fixed crash when loading a savegame (due to the changes in v28, oops!).
Trains
- Fixed crash when AI attempts to electrify tracks of another company (reported by andythenorth).

Re: CivilAI

Posted: 14 Jan 2020 11:42
by PikkaBird
I really do enjoy Civi's naming + the "Silly" toyland townnames. :D
Image3.png
Image3.png (63.62 KiB) Viewed 11803 times

Re: CivilAI

Posted: 14 Jan 2020 20:08
by Fairyfloss
I've found a bug that's likely to do with the vehicle GRFs I use, but I thought it would be a good idea to bring this to your attention.

It bought a Metro Cammell EMU, then decided it wanted carriages, and proceeded to buy 827.7 tiles worth of carriages it could not attach to the train, for a total of about 2000-ish carriages?
uhm.PNG
uhm.PNG (1.54 KiB) Viewed 11771 times

Re: CivilAI

Posted: 15 Jan 2020 01:15
by PikkaBird
Thanks! Yep, clearly a problem with the wagons not being able to attach to the loco. Damn NewGRF authors and their BAD FEATURES. ;)

Which newgrf is it? I'll experiment and see what I can come up with. :)

Re: CivilAI

Posted: 15 Jan 2020 05:37
by Fairyfloss
PikkaBird wrote: 15 Jan 2020 01:15 Thanks! Yep, clearly a problem with the wagons not being able to attach to the loco. Damn NewGRF authors and their BAD FEATURES. ;)

Which newgrf is it? I'll experiment and see what I can come up with. :)
It's a NewGRF that goes by the name of UKRS2, you might have heard of it? :)
The carriages are from RUKTS, meanwhile, so the issue might be purely because of NewGRF mixing? Still, maybe it's fixable?

Re: CivilAI

Posted: 15 Jan 2020 06:46
by PikkaBird
Darthrafael wrote: 15 Jan 2020 05:37 Still, maybe it's fixable?
I'm sure it is. I'll try out the GRF combination, thanks. :)

Re: CivilAI

Posted: 17 Jan 2020 07:09
by PikkaBird
I figure I've got enough bug fixes and tweaks to release another version. :) I really need to focus on the new pathfinder for v32 though, as the route building is what's really slowing the AI down now.

Version 31:
Features:
Trains:
- AI can now build stations and trains of varying lengths, instead of always 3 tiles.
- AI will build additional freight trains to meet demand.
Road Network:
-Building the intercity road network has been disabled.
Tweaks:
- AI will now avoid planting trees on farm fields.
- Most parameters (max buses, minimum air route distance etc) have been removed from the player-adjustable AI options.
- If you're an advanced user and really want to change these numbers, you'll find them at the end of saveload.nut.
Trains:
- Made avoiding double-connecting industries more reliable.
- Tinkered with locomotive selection to avoid using high-speed locomotives for freight.
Aircraft:
- AI can now buy a cheaper aircraft if its ideal aircraft is too expensive.
Bug fixes:
Trains:
- Fixed wagon selection bug that was preventing electrified freight trains from renewing.
- Disallowed PBS-locked track loops at station entrances.
- Fixed AI ripping up newly built routes because it couldn't quite afford the locomotive yet.
- Added code to handle NewGRF wagons not being attachable (thanks Darthrafael).
Goods Trucks:
- Fixed the AI repeatedly trying to build goods pickup routes to unroutable factories.
- Fixed the AI buying lots of goods trucks if the dropoff station stops accepting goods.
- Fixed the AI building a goods pickup depot when it cannot afford the trucks.

Re: CivilAI

Posted: 17 Jan 2020 18:52
by andythenorth
I broke it again, sorry :oops:

2 types of crash, see attached :)

Re: CivilAI

Posted: 18 Jan 2020 02:30
by PikkaBird
Excellent. Fun fact: this bug did not manifest before v31 because of a typo that was causing it to build a passenger car if it couldn't find a mail van. Fix a bug, make a bug. :)

Version 32:
Bug fixes:
Trains:
- Fixed crash when there is no appropriate mail van available for a new passenger train (reported by andythenorth).

Re: CivilAI

Posted: 03 May 2020 02:49
by 2TallTyler
I got a crash when playing before any trains or ships were available. The only NewGRFs loaded are eGRVTS and a town set I'm developing.

Re: CivilAI

Posted: 03 May 2020 09:00
by PikkaBird
I don't think I've done anything with ships since I allegedly fixed a similar bug in v20, but nonetheless please update to the latest version of the AI (v32) and let me know if the bug persists.

Re: CivilAI

Posted: 03 May 2020 18:28
by 2TallTyler
My apologies. I've got the latest version on my Windows partition but haven't updated on MacOS and was running version 6... :oops:

Re: CivilAI

Posted: 05 May 2020 02:50
by 2TallTyler
Upgraded to Version 32 and still getting the same crash before ships or trains are available.

Savegame is attached. I just published the town set on BaNaNaS, but if you need to look at the code it's here.

Re: CivilAI

Posted: 05 May 2020 04:46
by PikkaBird
Ta, I'll look into it.

Re: CivilAI

Posted: 13 May 2020 14:33
by RockyPapery
I love how this AI focuses on expanding the city and then spread out to other city near it. But what bothers me is that they seems only build small airport and 2 type of small planes. Then, it has a habit of merging a station, which is fine, but the buses just taking the most cargo, resulting in very low income train and airplane. It didn't even upgrade the plane. After 50 years it only has 2.000k operating profits. The other AI has around 6.000k - 40.000k / 3 months.

My settings:
airplane speed factor: 1/1
Maintenance cost: high
construction cost: high

Re: CivilAI

Posted: 14 May 2020 03:28
by 2TallTyler
Not a crash this time, but a train line where one station and the main line is rail, but the other station is monorail. Version 32.

Re: CivilAI

Posted: 12 Nov 2020 22:00
by Timberwolf
I have the same crash when no ships are available with CivilAI 32, it looks like it's caused by line 163 of ship.nut where it does the following:

Code: Select all

cost = cost + BuyAFerry(dock1, dock2, beams1, beams2, intersect, depot, true, null);
When there are no ships available the function returns null, and causes a crash. I fixed it in my local copy with a quick null check, but that was just a hack to get things working without having to dig around too much in what BuyAFerry() actually does.