Moderator: OpenTTD Developers
This is a new AI, based of code of SimpleAI v12 (thank you so much, Mr Brumi), but isn't another (or better) SimpleAI: this AI makes very profitable single point to point large routes, with lots of long trains each one. It is very configurable, and is almost stable. The default configuration makes routes up to 1920 tiles long, with 15 tiles long trains. Of course, it can be configured to emulate SimpleAI, and it works better than this AI, it can recover unfinished routes when loading games (in some cases), and test if it can build new routes before spend money on its construction. Another features are statue of owner's company building, managing vehicles while pathfinding, better passing lanes and stations, bigger airports and replacement of small airports...
Goals: This AI was build to create more realistic cargo routes and trains. Like SimpleAI, this AI can manage trains, buses and trucks, and planes. But most of tests are done only with cargo trains, no other type of vehicles are well tested. This isn't a winner AI, but can do lots of very profitable cargo routes that looks real cargo lines. Of course, building air routes makes lots of money.
This is the changelog from SimpleAI v12 (not all modifications are documented, especially first of they, made too many years ago):
Don't remove unprofitable trains (I don't like how it works).
Longer trains, stations and passing lanes up to 7 tiles (configurable).
Single destination stations.
More than 2 trains per route.
Allow train routes up to 200 tiles.
Better passing lanes without unnecessary signals.
Allow 1, 3, 4 and 5 passing lanes.
Allow long train routes, up to 910 tiles (configurable).
New BuildPassingLanes function.
Allow up to 15 passing lanes (configurable).
Allow long road routes, up to 230 tiles (configurable).
Allow long train routes, up to 1640 tiles (configurable).
Allow long aircraft routes, up to 1640 tiles (configurable).
Disallow new/close industries logging.
Allow to add more trains on a route, then new routes are started with only one train.
Disallow large bridges and tunnels if we don't have more than 250k (inflated).
Wait if we need money to finish a rail/road route.
Check routes and events while pathfinding.
Don't send to depot fully loaded trains.
Don't reverse trains to find a depot.
Don't send to depot more than one vehicle if we can't paid it.
Restart unfinished routes when load a saved game, if it is posible.
Build statue if we have some money.
Prevent to add new train if empty train is waiting for cargo.
Forbid non-flat passing lanes (configurable).
Set name to stations.
Better aircraft manager.
Now works well if forbid_90_deg game setting is set to true.
Check if we can build all stations and passing lanes before build it.
Length of trains now depends of industry production.
Better passing lanes.
Updated max lenght of aircfraft and rail routes.
Prevent crash when GetLastMonthTransportedPercentage() runs while month change. (Fixed in SimpleAI v13)
Diagonal passing lanes.
Better order flags.
Bridges and tunnels on passing lanes.
Build stations as closest as possible to industry (configurable).
Permit 15 tiles long trains.
Allow double and triple traction.
Allow long train routes, up to 1920 tiles (configurable).
Don't destroy active routes when demolish join stations (SimpleAI bug).
Don't crash when load game with builded but not finished route (SuperSimpleAIbug).
Safer GetRailStationPlatformLength() function.
Disallow diagonal passing lanes when signals aren't PBS.
Better diagonal passing lanes.
Better passing lanes ubication.
Less railtrash when aborting passing lane building.
Capped the maximum amount of routes at 1000 to prevent "Took too long to save" errors. (Fixed in SimpleAI v13)
More fault tolerance when building road stations: the AI now should not leave C-shaped road pieces when failing to build a road station. (Fixed in SimpleAI v14)
Fixed running cost calculation in the train engine valuator (fix by SirkoZ in SimpleAI v14)
Disallow tunnels and bridges on passinglanes if this AI is configured in Old Style (TTO, TTD, SimpleAI).
Allow reverse trains only if not using PBS.
Replace non-empty trains to depot if they are 80 years old.
Replace non-empty road vehicles to depot if they are 40 years old.
Check if the heads of stations and passing lanes needs a bridge or tunnel, and if they can be build.
Build mandatory rails on stations and passing lanes heads.
Added better estimation tunnel cost with inflation.
Limit the minium length of cargo trains (configurable).
Fixed bad max distance for road routes and update it to 280 tiles.
Allow four engines in multiple traction.
Estimate inflated cost of a bridge head when they aren't on flat/well sloped tile.
Check if possible to build the destination road station before build the source road station.
Abort building rail route if source or destination industries closes.
Fixed problems with passinglanes and Sygnal Type == 3.
Build road stations as closest as possible to industry (configurable).
Build statue if we have some money, now configurable.
Don't build unnecessary temporaly depots to avoid 90 grade turns.
Limit the number of vehicles than a short road route can has.
Sell all trains and remove a rail route if source or destination industry closes.
Sell all road vehicles and close a road route if source or destination industry closes.
More checks before build road stations.
Fixed incorrect cost calculation of some bridges and wrong type of bridge.
Fixed wrong number of airplanes per route.
Fixed renaming used airports when build new route.
Optimistic GetInflationRate() function.
Use international and intercontinental airports and more agressive air model (configurable).
Better detection of industry closures.
Don't build a piece of track in "rail heads" if we can build a tunnel.
Fixed building mail rail routes when vehicles are unavailable.
More configurable options in settings.nut file.
Fixed closing mail routes if the station isn't close to town center.
Fixed incorrect calculation of distance in cargo rail routes.
Add road vehicles to a route faster.
Tries to reuse source airport with another existing airport if can't build destination airport.
Replaces small airports when reach their capacity with greater ones.
Forbid duplicate passenger routes, with no difference if they are road, rail or air.
Posible bugfix: restore previous rail type on UpgradeRailBridges() and AttachMoreWagons() functions.
Fixed crash after finish unfinished route when load a game with debug set to true.
Removed debug setting from info.nut and added SuperSimpleAI, cManager and cBuilder debug settings. (commented)
Fixed ingame setting to "build_statue" setting.
All settings in info.nut file are now optional, the default values are in settings.nut file.
Prevent infinite recursion loops in CheckRailHead() function.
New semidiagonal passing lanes (all railbuilder-passinglanes.nut code was rewrited).
Taken RailPathFinder library from WormAI, who was inspired by AdmiralAI to modify original library.
DEPENDENCES: SuperSimpleAI, like SimpleAI, depends on the following libraries:
- Pathfinder.Road v4
- Pathfinder.Rail v1 (only v23 and older versions)
- Graph.AyStar v4 (a dependency of the rail pathfinder)
- Graph.AyStar v6 (a dependency of the road pathfinder)
- Queue.BinaryHeap v1 (a dependency of Graph.AyStar)
BUGS: If the company's name is too long then fails to change stations names (since v15). In some cases this AI build rail lines with two rail types (ex: Passing lanes and stations built for Maglev, rails between stations and passing lanes built for electric rail. Detected in v19).
TODO: This AI doesn't close unprofitable routes, only if source or destination industry closes, this isn't good for non-stable economics games.
Next version: Some new functionalities require new data in savegames, and these saved games will be incompatible. These changes are:
More railbuilding and roadbuilding saved status, for recover unfinished routes after loading a saved game.
New bridge lists per route.
And, of course, bugfixes.
Recomended settings: this AI may build 15 tiles long trains, so remember to set limits of trains and stations from configuration. In some cases it can build lines with 90º turns, so don't forbid this turns. Breakdowns may be set to none, because very large routes than have only one depot.
PD: This new version 23 is the release candidate to be downloaded from BaNaNaS, last BaNaNaS version was 19 (Unfortunately, I lost my BaNaNaS account). The version 24 isn't well tested, and have 30KB of new code plus 26KB of code from WormAI-8.
- (380 KiB) Downloaded 7 times
- (420 KiB) Downloaded 4 times
1.- Remove it's train depot.
2.- Build a new train depot in same place.
3.- Send all trains to depot.
4.- Sell all trains.
5.- Wait. This AI removes all routes that doesn't have vehicles.
- Transport Coordinator
- Posts: 295
- Joined: 11 Aug 2019 18:15
- Location: Massachusetts, USA
I apologize for all the headaches my old code caused for you!
I only see one absolutely minor issue so far: I'm running two instances of this AI, and only one of them renames its stations (e.g. Brown Freight SRC_22 (1964)), the other one keeps the default names. The only difference between them in configuration is the log date format. If the AI reads station names for extra info (like, I've seen .tmp-named stations popping up here and there), this might be an actual issue instead of just visuals. Random guess: maybe the station names would be too long, given the company name F. Cuthbert Inforporated?
And I have a question for you:
Is this crash possible in SimpleAI as well? I'll also have to fix it if it's in my codeJaume wrote:v17:
Prevent crash when FindService() runs while month change.
I only see one absolutely minor issue so far: I'm running two instances of this AI, and only one of them renames its stations
Oh, yes, it's another bug. This is because the name of your second company is too long, then fails to renames its stations.
Prevent crash when FindService() runs while month change. Is this crash possible in SimpleAI as well?
EDIT: No, you fixed it in v13: Fixed possible division-by-zero error in cBuilder::GetLastMonthTransportedPercentage(). But returning 0 if LastMonthProduction is 0 may create a new route even if it is serviced. I think is better return 99.
EDIT2: I send a private message to you with bugs and improvements that I found in your code, because no other users of this forum may be interested to see code.
Thank you for you great code and inspiration!
I really like to see forks of SimpleAI, as long they remain simple, and stay more or less true to the original behavior.
The biggest wish I have would be ship support. Then it would be perfect.
I really wish I have for OpenTTD to add a simple official default AI, which is then improved over time. SimpleAI is a strong candidate, and SuperSimpleAI might be even a stronger one. viewtopic.php?f=65&t=85812
I'm sorry, I started this project too many years ago, simply disabling some functions for my funny games. Since SuperSimpleAI v19 all changes from SimpleAI v13 and SimpleAI v14 are included.
The biggest wish I have would be ship support. Then it would be perfect.
Yes, but this isn't easy, I don't know if some AI has a good code to share, but SimpleAI and SuperSimpleAI does't have. Maybe will writen from zero?
What AI you know that manages ships, and are stable?
From these, I remember DictatorAI (which also has some of its roots in SimpleAI), NoNoCAB, RailwAI and Terron AI being generally stable.
Also, I think you should add SuperSimpleAI to this list as well
Well, I updated this list to include SuperSimpleAI.
I have a problem with my account in BaNaNaS, I forgot the email address wich I used to create and upload SuperSimpleAI, and for the moment I can't upgrade this AI. Maybe changing the name of this AI... I hate Github...
Users browsing this forum: No registered users and 4 guests