CivilAI

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

BW89
Engineer
Engineer
Posts: 104
Joined: 10 May 2015 11:42

Re: CivilAI

Post by BW89 »

Bug: The AI builds Cargo Trains double.
Yes, both of the lines are carrying Grain
Kiel Transport, 11. Mär 1861.png
Kiel Transport, 11. Mär 1861.png (166.34 KiB) Viewed 4879 times
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

BW89 wrote:Could you add a feature that the AI would add a Busstop in Villages when a IC bus would drive through it without stopping?
It would be possible, but I feel like growing villages is a little beyond Civi's remit. I'm also not sure how much I want to nerf intercity buses when I introduce passenger trains.
BW89 wrote:Bug: The AI builds Cargo Trains double.
Yes, I removed the code that stopped it doing that in the last version (because it was horribly messy) - I wasn't sure it was too much of a problem. But I can write a new solution.

Out of interest, did this happen on a relatively small map?
BW89
Engineer
Engineer
Posts: 104
Joined: 10 May 2015 11:42

Re: CivilAI

Post by BW89 »

It was a 512x512 map with high amount of water.
Here a map with the industries.
Kiel Transport, 2. Jan 1864.png
(69.28 KiB) Not downloaded yet
rambolz
Engineer
Engineer
Posts: 4
Joined: 22 Apr 2019 15:19

Re: CivilAI

Post by rambolz »

I ran into the same problem as BW89. The AI built the first route, then started thinking that it should find something else to connect to the drop-off station even before the first two trains had reached the water pump, and decided to build the same route again. This happened on a 256x256 map.
Attachments
CivilBug.png
(409.77 KiB) Not downloaded yet
rambolz
Engineer
Engineer
Posts: 4
Joined: 22 Apr 2019 15:19

Re: CivilAI

Post by rambolz »

I managed to break CivilAI in this savegame. It tried to connect to an existing station but connected to a totally wrong station and now it is doing something weird when looking at the AI debug screen. The train "George" is trying to get to the station which is not even connected.
Attachments
BrokeAI.sav
(82.58 KiB) Downloaded 205 times
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

rambolz wrote:I managed to break CivilAI in this savegame. It tried to connect to an existing station but connected to a totally wrong station and now it is doing something weird when looking at the AI debug screen. The train "George" is trying to get to the station which is not even connected.
I had that happen once during testing, but couldn't reproduce it. Consider it an "open investigation".

Assuming the AI doesn't go bankrupt in the meantime, it can recover from the situation - after the train has lost money for two years, it will send it to the depot and sell it, then remove the misconnected station and line.
baysupercool
Engineer
Engineer
Posts: 2
Joined: 20 Feb 2019 15:21

Re: CivilAI

Post by baysupercool »

The ai chashed while trying to buy a ship even though there are no ships
Attachments
civilaicrash.PNG
(42.62 KiB) Not downloaded yet
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

andythenorth wrote: 30 Jun 2019 09:00 Entertainment unbounded :)
Hey, it works, doesn't it? ;)

Bit busy for OpenTTD stuff at the moment, I'm afraid. The bugs are being noted, I'll be back!
Wormnest
Engineer
Engineer
Posts: 117
Joined: 14 Jul 2013 12:33
Location: Netherlands

Re: CivilAI

Post by Wormnest »

CivilAI crashed, not sure when since I had it running in the background. Not sure how useful a savegame is in this case, I have it if you need it. Older version of the savegame is posted in the EmotionAI thread.
Error: Cannot iterate null, see screenshot.
Attachments
Unnamed, 2023-01-06#1.png
(491.59 KiB) Not downloaded yet
xarick
Transport Coordinator
Transport Coordinator
Posts: 335
Joined: 26 Feb 2015 00:52

Re: CivilAI

Post by xarick »

Your script made an error: parameter 1 has an invalid type 'null' ; expected: 'instance'
Attachments
Unnamed, 2051-02-10.sav
(180.92 KiB) Downloaded 201 times
Unnamed, 2051-02-09.png
(95.38 KiB) Not downloaded yet
Formerly known as Samu
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

Thanks both. I'm currently working on v20 and both crashes have been fixed.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

Merry Christmas from CivilAI!

Version 20:
This huge update introduces passenger, mail, food and goods trains, and tidies up and reworks existing features to make CivilAI faster and better than ever before!
Please report any crashes or odd behaviour!

Features:
Trains:
- Added passenger and mail train networks.
- Rewrote passing places / double track line construction to be tidier and more reliably buildable.
- Rewrote disused track removal code.
- Added dynamic railtype selection, instead of always building standard rail.
- All locomotives will be considered when building a new rail line and the rail type chosen accordingly.
- When adding a new connection to an existing line or replacing an old locomotive, all compatible locomotive types will be considered and the line upgraded if necessary.
Road Network:
- The option to not build an intercity road network added in v19 has been removed. The AI now always uses a hybrid behaviour.
- AI will only build road connections when it has money to spare.
- AI will build in towns before it has a road connection.
- AI will build in towns it can't connect to with road but are within its sphere (eg on islands or across mountains).
- The AI will not build intercity buses unless both trains and aircraft are disabled.
- Buses in towns will now transfer passengers to train stations and airports if cargo distribution is disabled.

Tweaks:

Road Network:
- Adjusted pathfinder settings once more to (possibly) reduce building duplicate/messy roads between towns.
- Reduced the number of stops at the town's central station from 3 to 2.
- Towns where bus network construction failed no longer count as unserviced against road network expansion.
- AI will check mail acceptance of stops before building mail trucks.
- AI will remove disused goods truck pickup stops.
- AI will check the ground is flat before trying to build a goods pickup.
- If the AI's home depot gets cut off, it will attempt to rebuild it before giving up and entering its fail state.
Aircraft:
- AI will build airports much more speculatively, to improve the chance of starting air service early in the game.
- AI will not build airports if the maintenance cost would exceed its income.
- AI will not build airports if it can't afford aircraft and/or no aircraft are available.
- New sanity checks when levelling land for airports, to avoid flattening mountains.
- AI will build mail planes between airports which have lots of mail but not many passengers waiting.
- AI will not build additional aircraft on unprofitable routes.
Trains:
- Double-cargo connections (eg grain and livestock to a factory) will now build one train for each cargo.
- Added a delay to building second lines to a station, to avoid double-connecting the same producing industry (reported by BW89).
- New sanity checks when levelling land for stations, to avoid flattening mountains.
- AI should now build more powerful locomotives when replacing old trains on hilly routes.
- Adjusted the big/cheap/fast bias scores for locomotive selection.
- Adjusted wagon selection.
Ships:
- Only one dock will be built per station (since more than one is now possible in OpenTTD 1.10).

Bug fixes:
- Fixed second cargo lines being built to the wrong terminus station (reported by rambolz).
- Fixed potentially stranding withdrawn trains by removing tracks prematurely.
- Fixed crash when attempting to cost a ship with no ships available (reported by baysupercool).
- Fixed crash when planning a train route if the target industry gets removed mid-plan (reported by Wormnest).
- Fixed the AI getting stuck trying to demolish an airport with a plane stopped in the hangar.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

And already... ;)
Version 23:
Bug fixes:
- Removed empty file that was breaking content service download.
Trains:
- fixed the AI removing bridges or other infrastructure when building a passing place.

Version 22:
Tweaks:
Road Vehicles:
- Improved detection for city truck stops which accept food or goods.

Bug fixes:
- Correctly updated version number in-game.

Version 21:
Bug fixes:
Road Vehicles:
- Fixed road pathfinder not reporting success, leading to failure to buy goods trucks (oops).
Last edited by PikkaBird on 25 Dec 2019 14:04, edited 1 time in total.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

Would it really be an AI if it didn't? ;)

One of CivilAI's 6 'personalities' loves fast vehicles and doesn't care about running costs. But perhaps I should make it think twice about locos which will be heavily restricted by wagon speed...
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5601
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: CivilAI

Post by PikkaBird »

Version 25:
Bug fixes:
Trains:
- AI will be more patient when building wagons, to avoid sending out short trains if it runs low on money.

Version 24:
Tweaks:
Trains:
- Added a bias against buying locomotives which will be speed limited by wagons.
- When adding new trains to a passenger line, slow old trains will be upgraded.
Road Vehicles:
- Cancel transfer orders for buses when withdrawing an air service or moving an airport.

Bug fixes:
Trains:
- Fixed AI failing to electrify rail lines (reported by andythenorth).
- Fixed rail placement errors in the passing place code.
- Added 90 degree turn detection to the passing place code.
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 490
Joined: 11 Aug 2019 18:15
Contact:

Re: CivilAI

Post by 2TallTyler »

What a bridge!

Image
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 4 guests