CivilAI
Moderator: OpenTTD Developers
Re: CivilAI
Bug: The AI builds Cargo Trains double.
Yes, both of the lines are carrying Grain
Yes, both of the lines are carrying Grain
Re: CivilAI
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:Could you add a feature that the AI would add a Busstop in Villages when a IC bus would drive through it without stopping?
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.BW89 wrote:Bug: The AI builds Cargo Trains double.
Out of interest, did this happen on a relatively small map?
Re: CivilAI
It was a 512x512 map with high amount of water.
Here a map with the industries.
Here a map with the industries.
Re: CivilAI
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
Re: CivilAI
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 433 times
Re: CivilAI
I had that happen once during testing, but couldn't reproduce it. Consider it an "open investigation".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.
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.
-
- Engineer
- Posts: 2
- Joined: 20 Feb 2019 15:21
Re: CivilAI
The ai chashed while trying to buy a ship even though there are no ships
- Attachments
-
- civilaicrash.PNG
- (42.62 KiB) Not downloaded yet
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
Nice trains it's building 

- Attachments
-
- Civil.png (223.36 KiB) Viewed 19760 times
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
Entertainment unbounded 

- Attachments
-
- Civil_2.png (638.25 KiB) Viewed 19170 times
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: CivilAI
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!
Re: CivilAI
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.
Error: Cannot iterate null, see screenshot.
- Attachments
-
- Unnamed, 2023-01-06#1.png
- (491.59 KiB) Not downloaded yet
Re: CivilAI
Your script made an error: parameter 1 has an invalid type 'null' ; expected: 'instance'
- Attachments
-
- Unnamed, 2051-02-10.sav
- (180.92 KiB) Downloaded 336 times
-
- Unnamed, 2051-02-09.png
- (95.38 KiB) Not downloaded yet
Formerly known as Samu
Re: CivilAI
Thanks both. I'm currently working on v20 and both crashes have been fixed.
Re: CivilAI
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.
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.
Re: CivilAI
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).

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.
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
Hurrah
Testing testing testing.

Testing testing testing.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- andythenorth
- Tycoon
- Posts: 5705
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: CivilAI
Solid result: it's built a TGV for iron ore 

- Attachments
-
- civil-helm-wind-lolz.png (210.11 KiB) Viewed 17672 times
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: CivilAI
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...

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...
Re: CivilAI
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.
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.
- 2TallTyler
- Director
- Posts: 572
- Joined: 11 Aug 2019 18:15
- Contact:
Re: CivilAI
What a bridge!


Who is online
Users browsing this forum: No registered users and 8 guests