Moderator: OpenTTD Developers
LuDiAI AfterFix is an AI that builds road routes and air routes, transporting either mail or passengers.
It's an AI that is built upon the original work of lukin_'s LuDiAI. Initial work was on fixing issues found on the original, but it became something more of its own later on.
Main differences or improvements
- Adds more configuration settings
- Randomizes most configuration settings when started as Random AI
- Can build more than 500 road vehicles
- Builds more airport types
- Builds helicopters
- Builds statues
- Builds the company HQ
- Sells old aircraft
- Is aware of cargo distribution setting
- Is aware of plane speed setting
- Is aware of aircraft max range
- Is aware of map size for route distances
- Is aware of infrastructure maintenance costs
- Matches aircraft type with airport type
- Plans optimal distances between airports
- May build more than one aircraft per route at once
- May add or remove more than one road vehicle at once during management
- Renews vehicles when better models become available
- Plans a maximum number of vehicles a route can support
- Attaches road stations to existing airports
- Removes unserviced road routes
- Use of customized road pathfinder
- Retries road construction if it finds an obstacle instead of giving up
- Is aware of articulated road vehicles' need of drivethrough stations
- Upgrades road bridges
- Retries construction of road stations instead of giving upon instantly
- Schedules removals of leftover road stations and depots on failure
- May also try to build road depots in the source or destination towns
- Founds towns
- Initiates advertising campaigns in towns
- Funds construction of buildings in towns
- Loans and repays on-the-go
Choses which cargo the AI will handle. If the AI started as Random AI, the choice will be randomized on startup.
The AI creates Passenger only routes via road and/or air.
The AI creates Mail only routes via road and/or air.
- Passengers and Mail:
The AI creates both Passenger and Mail routes via road and/or air.
When enabled, the AI will only service City status towns. When disabled, it will service both cities and towns. If the AI started as Random AI, the choice will be randomized on startup.
Town choice priority:
Defines how the AI will pair two towns. If the AI Started as Random AI, one of the following options will be picked at random on startup.
- Most cargo produced first:
The AI choses the most productive towns first when creating a service.
- None, pick at random:
The AI choses the towns at random when creating a service.
- Shorter routes first:
The AI choses towns which are closer to each other first when creating a service.
- Longer routes first:
The AI choses towns which are further from each other first when creating a service.
When enabled, the AI tries to avoid building its stations near stations of other companies. When disabled, it is allowed to do so. If the AI started as Random AI, the decision will be randomized on startup.
Enables or disables the usage of air routes.
Enables or disables the usage of road routes.
Can station spread:
When enabled, the AI expands its road stations by distantly joining new station pieces, to enlarge station coverage. It may also join road stations with airports and vice-versa whenever possible. If the AI started as Random AI, the decision will be randomized on startup.
Approximate number of days in transit for road routes:
Lower values may help pathfinding faster, but at the cost of lesser profits. Higher values may slow pathfinding and may not necessarily yield the best profits, assuming the default engines are being used. A random value of up to -5/+5 is added on startup, and the limit can never go below 10 or above 150.
Road pathfinder profile:
Select the behaviour of the pathfinder when connecting two towns by roads. If the AI started as Random AI, the choice will be randomized on startup.
Tweaked for low construction costs when the AI is poor, by avoiding watered coast tiles, which may result in some weird bridges across two coasts. May try to avoid going through drivethrough stations. May build more bridges or tunnels in difficult terrain, especially when the slopes are too steep. If the AI is rich, it may build really long bridges and tunnels. Relatively slow, but overall, the better planner.
Though the pathfinder interval cost values have been reworked and some of the logic regarding bridges and how are roads connected to each other, the default profile tries to mimic the behaviour of the original LuDiAI pathfinder. It is not cost conscious regarding coasts, slopes or bridges, doesn't avoid drivethrough stations and does not build too long bridges or tunnels.
Optimized for fastest planning speed, at the cost of low road reuse. It prefers fewer curves, which could result in roads going through sharp landscapes, or be longer than necessary. Can only build small bridges, which may not be ideal for maps with lots of water. Cannot build tunnels.
Road route capacity mode:
Determines how the AI will handle the capacity of a route by managing the number of vehicles when there's enough cargo waiting at the stations. If the AI started as Random AI, the choice will be randomized on startup.
- Maximum of 25 road vehicles:
Depending on the cargo waiting, the AI may decide to add road vehicles to the route, as long as it doesn't go over 25. It adds one at a time per management cycle.
- Estimate maximum number of road vehicles:
Same as above, but instead of 25 road vehicles, the maximum number is based on the distance between stations, maximum speed of the engine and the number of loading bays available at the stations. Stations may also spread to accommodate more loading bays, and thus more vehicles. It also adds one at a time per management cycle.
- Adjust number of road vehicles dynamically:
In this mode, the AI will keep adding vehicles to the route whenever there's cargo waiting, but will also remove road vehicles if it finds its vehicles unable to move. It will be constantly doing this all the time, which may slow down management. Contrary to the other modes, it can add or remove multiple vehicles at once per management cycle.
Road route load orders mode:
Determines how road vehicles set up their orders. If the AI started as
Random AI, the choice will be randomized on startup.
- Full load before departing:
The vehicles will use 'Full load any cargo' on their go-to orders.
- Load something before departing:
A conditional order is placed between their go-to orders that Jump to
their respective go-to order when load percentage is equal to zero.
- May load nothing before departing:
The default 'Load if available' is used on their go-to orders.
AI-GS communication support:
Allow communication between AI and Game Script SCP libraries. Currently supports Company Value GS, where the AI will think twice before spending money in town actions, just to maintain the lead or to maintain catch-up against the company ranked first.
- Use Sorted List instead of Native Heap for road pathfinder
- Actually remove NoCarGoal requirements, only part of it was removed
- Use Native Heap instead of Fibonacci Heap for road pathfinder
- Tweak road pathfinder code for improved performance
- Remove NoCarGoal requirements, as it wasn't really using it
- OpenTTD and API requirements set to 1.10.0
- Fixed english typos in the code, readme and changelog
- Road bridge names are no longer reported as rail bridges
- Planning air routes now takes into consideration whether infrastructure maintenance costs are enabled or not. It's far from perfect, but the AI plans air routes with at least 7 aircraft and try to fully serve it, before attempting a new route. It also only considers airports with the cheapest maintenance costs that can still support each of the aircraft types available. Due to the conservative approach of these changes, the AI may not perform as well as before in the very long run, but it should be able to have a better start
- Upgrading engines to a better model may be done over time instead of all at once, depending on available money
- AI is now able to get the correct capacity of a refited vehicle in most situations which should result in better engine choices
- Fixed a bug that caused detection of a suitable tile for a road depot to be incorrect
- Fixed a bug in the road pathfinder which in theory should result in a better path choice
- Fixed a bug that caused helicopter routes to be created without a hangar resulting in no helicopters being built and the route being demolished right away
- Reduced the amount of messages about failed air routes caused by low funds
- Aircraft routes may now be fully closed if they're not profitable enough
- Tweaked the income formula for aircraft, most noticeable the estimated optimal number of days when "Vehicle breakdowns" are set to "Normal". It is also able to determine how many aircraft are needed to turn a profit
- Fixed a rare division by zero error that could occur when counting the number of vehicles needed for a route
- Town actions, such as building statues, advertising campaigns and founding towns, now may only happen when the loan is zero which should result in better survivability of the AI
- When looking for a suitable airport location, also take into consideration the distance to the center of the town in case of multiple spots with the same number of houses nearby
- Fixed a bug that caused the AI to take too long to start
- When chosing a place for an airport, also take mail acceptance into consideration when "Town cargo" is set to "Passengers and Mail"
- Reworked all remaining valuators in hope to prevent stalls caused by the AI
- Don't terminate a route under plan when in the meanwhile the maximum number of road vehicles is reached. Resume it later whenever the limit permits it
- Prefer building stations on locations with more houses around while best routes are not yet used
- Pathfinder number of tries have been changed to iterations, and is now interrupted after more than a day iterating, to be resumed later on
- Custom and fastest pathfinder profiles tweaked to restrict the search area into a rectangle, which should improve pathfind total time
- Reworked how breakdowns are taken into consideration. It no longer filters out engines from the choice pool. It is now part of the income formula
- Added "Road route load orders mode" setting with 3 options to chose from: "Full load before departing", "Load something before departing" and "May load nothing before departing"
- Changed the way vehicles are added to newly constructed road routes. A vehicle is started every few days after the previous one, which should end improving cargo rating at the stations
- Only send negative profit road vehicles to depots 30 days after the last time a vehicle was added on a route, and after all vehicles have started on a new route. Also remove then one at a time
- When renewing road vehicles, remember which order the vehicle was running, and skip to it after renewal
- Fixed a bug that happened during jam detection, where the information about last time a vehicle was removed was missing
- Road vehicles added to an existing route, via "Adjust number of road vehicles dynamically" option, now start to go to whichever station has the most cargo waiting, by subtracting the engine capacity each time one is added in this manner
- Set group names to road routes and air routes
- Added the ability to select "Passengers and Mail" for "Town cargo" setting
- When evaluating towns for possible road and air routes, use a customized cargo production rating based on transported percentage for "Most cargo produced first" option
- Fixed a bug in "None, pick at random" which was preventing the last two available towns to be picked by the randomizer
- Fixed a bug with freeform edges that caused getting the offset of a tile to be off by 1
- Fixed a bug when checking for stations nearby, an incorrect radius was being applied to the search
- Fixed a bug in getting the first available Passenger or Mail cargo. It was, instead, getting the last available ones
- Fixed a bug on checking wether "distant_join_stations" were on, preventing construction of airports and road stations on adjacent road stations and airports as separate stations
- Reworked air route plan mode, to be more flexible by allowing it to interrupt the search after more than a day iterating suitable locations for airports
- Fixed a bug that prevented displaying a message about new air routes being successfully built if all planned aircraft weren't built
- Fixed a bug that caused clearing the lists of tried towns in an incorrect manner, causing the town search to not finish correctly, during 2nd airport construction phase
- Permit building airports with less catchment radius once the best routes have been used
- "Minimum distance between towns for road routes" has been removed. "Aproximate number of days in transit for road routes" has been added, which replaces the old setting. Has a minimum value of 10 and a maximum of 150. Note that much higher values increase the pathfinding search to unfeasible amounts of time
- Reworked road route management to be more often interrupted, to allow the AI perform more of the other tasks
- Allow construction of more road vehicle stations on already serviced towns once best routes have been used, or if "None, pick at random" is chosen
- Builds all statues first, then advertising campaigns after, and try not to advertise as much as before
- Added a workaround for when loading from a savegame, it removes road stations or depots that happen to not be registered during save due to being in a queue that hasn't finished in time before the save occurred
- Failure to detect a 2 tile sized tunnel or bridge was preventing road construction
- "Minimum distance between towns for road routes" setting has a random deviation of 15
- Fixed a crash that could occur when attempting to sell a road vehicle
- Avoid using valuators when looking for a suitable airport location
- Fixed a bug that caused aircraft to be in the wrong group
- Added SCP support for Company Value GS
- Added vehicle groups for routes
- Reworked send to depot code with recourse to two special groups for the effect
- Added shared orders support for vehicles
- Several optimizations were done to increase vehicle and route management speeds
- Initiates small, medium and large advertising campaigns
- Funds construction of new buildings in towns
- Reevaluated pathfinder number of tries so that it doesn't take more or less time than necessary to find a path
- Fixed a bug that caused towns founded by others than self to go unnoticed by the town manager for road routes
- Renew aircraft when a better engine model becomes available
- Fixed a bug that caused incomplete removal of road vehicle routes. Their removal is now scheduled instead
- Fixed a crash when founding a town
- Added 3 new settings:
- "Minimum distance between towns for road routes", which was always 40 in previous versions
- "Road pathfinder profile", which was "Custom" in the previous version and "Default" in even earlier versions. "Fastest" is the newer choice
- "Road route capacity mode", which was always "Maximum of 25 road vehicles" in previous versions. "Estimate maximum number of road vehicles" and "Adjust number of road vehicles dynamically" are the newer choices
- Reworked "Random picks" setting into "Town choice priority", with 4 options to chose from. "None, pick at random" is the equivalent choice if "Random picks" was on, and "Most cargo produced first" is the equivalent choice if it was off. "Shorter routes first" and "Longer routes first" are the newer choices
- Road route minimum distance takes map size into account
- Changed road route maximum distance to always have a minimum delta between it and the minimum distance
- No longer retries to find a nearby town to connect by road with na increased maximum distance after failing the first time
- Managing road routes can now be interrupted and continued next cycle
- Account for more road vehicles when estimating costs for building a road route
- Save messages are hidden
- The maximum number of pathfinder attempts is now based on distance and profile used. Also reduces duration of each attempt
- The formula used for computing days in transit for a road vehicle was wrong and has been fixed
- Prevent road vehicles with incomplete orders from running
- Renew road vehicles when a better engine model becomes available
- Station spread road stations only when it reaches maximum capacity
- Account for at least two aircraft when estimating costs for building na air route
- Try to build next air routes with two aircraft minimum, one per airport
- Managing air routes was being denied if "Air Support" is turned off while there were air routes
- Builds statues
- Builds company HQ
- Does not change company name upload loading from a savegame
- Founds towns
- OpenTTD and API requirements set to 1.4.0
- Upgrading road vehicles, engines and bridges was being denied once the AI had reached the maximum number of vehicles
- Allow road pathfinder to be interrupted and resumed without losing its current path finding progress, allowing the AI to manage other things in between, by up to 5 times
- Allow pathbuilder to retry construction when failing to build planned route roads
- Tweaked pathfinder internal cost values and how they're measured, which should result in more bridges and tunnels on difficult terrain, while being cost conscious at the same time when on a low budget
- Allow pathfinder to build bridges over rail and rivers in more occasions
- Prevent pathfinder to connect roads with level crossings in most situations
- Prevent blocking of road stations of other companies while constructing its own road stations
- Allow a few more cases where locations without adjacent roads could be suitable for constructing a road station
- There was still some cases where drive through road stations were not being built, resulting in vehicles with few orders
- Reduce number of stalls when managing too many road routes, when looking for suitable airport and road station locations
- Road vehicle engine model choice is no longer based only on maximum speed, but also on capacity, cargo payment, distance of route, days in transit and reliability
- When expanding a road station, the counting of articulated road vehicles could be incorrect in determining the need of a drivethrough station
- The build manager wasn't setting the articulated variable value at all
- When building or expanding a road station, there could be cases where the station wasn't being built at all, resulting in vehicles with few orders
- Disabled breakdowns were not being considered on estimating the viability of an aircraft engine
- Estimating air route costs could account an incorrect aircraft price
- Helicopter engine list could include invalid and unbuildable models
- Valuator for best aircraft income was using the wrong distance type
- Allow more towns to be searched for a suitable first airport
- Don't start road construction when there are no engines available
- Builds or expands routes with only drivethrough road stations if there's only articulated road vehicles
- Increased town's mail last month production lower limit
- Loosened the aircraft income estimator lower limit
- Lowered the bar for what's deemed profitable to an aircraft
- Uploaded to BaNaNaS
Users browsing this forum: No registered users and 1 guest