Here is my AI - PathZilla. The focus of this AI is on high level planning and neat, realistic construction.
To get the best results from PathZilla you are strongly advised to activate the advanced setting "Stations" > "Allow drive-through road stops on town owned roads". PathZilla will still function correctly without this but will need to perform more demolition in towns, which can complicate things.
The AI has a number of settings which the user should change to their personal preference. If desired, the player will find a less challenging opponent if setting planning speed to very slow, turning aggression off, and setting traffic to low. Regardless of these settings though, the AI will always attempt to build a complete network and turn a profit.
NOTE: The preferred method to install PathZilla is via the in-game content downloading service.
- High-level network planning using graph theory
- Uses two tiers of pathfinding to improve line re-use
- Aesthetic pathfinding builds tram lines alongside roads and honours town grid layouts where applicable
- Full support for articulated vehicles and trams, where available
- Builds "green belt" around towns to improve local authority rating
- Supports NewGRF vehicles (tested with Zephyris' eGRVTS, George's Long Vehicles v4, and PikkaBird?'s HOVS)
- Supports NewGRF house and industry sets (tested with TTRS, George's ECS Vectors and PikkaBird's PBI)
- Builds multiple road stations per town and maintains fleet sizes
- Supports save/load and difficulty settings
- Supports all primary industries
Snap-to-grid for 2x2 and 3x3 town layouts...
"Green belt" construction to improve local authority rating...
v6 - 08/07/2009
- Added support for primary industries and NewGRF house sets
- Improved 2x2/3x3 town grid handling
- Construction of windy "country lanes" at early dates and in small towns
- Added configuration option for amount of traffic to generate
- Allow AI to sell vehicles from unprofitable services
- Better handling of construction in traffic
- Reduce initial processing steps to allow AI to start faster
- Changed to library pathfinder (with modifications)
- Split different road types and honour 2x2/3x3 town grid layouts where possible
- Re-wrote station placement to be more flexible
- Maintain fleet sizes based on waiting cargo
- Enable bribing of town authority & build trees around a town to improve local authority rating
- Re-attempt pathfinding if construction fails
- Fixed various bugs
- Improved DTRS support and enabled ARVs where possible
- Added support for trams
- Added generic cargo support for towns only (i.e. mail)
- Improved vehicle selection criteria. Gives more variety with large sets like eGRVTS
- Changed fleet size and property management to improve profitability at early dates (pre-1950)
- Added save/load support
- Introduced size limit for service planning data sets, to reduce memory usage and save file size
- Added support for AI difficulty settings, which scale work intervals and aggression
- Added a 'aggressive' setting. When PathZilla is not aggressive it will try to avoid building stations near to competitors
- Fixed bugs
- Vastly improved performance by optimising graph algorithms
- Introduced limit on number of targets (towns) that will be included in the master graph, to make very large maps(2048x2048) playable
- Changed service selection routine to process one town at a time, furtherimproving performance
- Fixed various bugs, including one that caused the AI to go crazy when the local authority rating got too low
- Changed require() statements to use cross-platform slashes
- Reduced work intervals to make AI more aggressive
I have attached a screenshot showing performance after 10 years on a demo run. Its not going to win any tournaments, but I'm quite happy with the performance.
I have also attached a short animation (apologies for size - will remove if anyone wants) which shows how the network planning works. It starts with a delaunay triangulation of the set of all towns in the map. Based on the triangulation it then computes a shortest path tree from a large "home town" (chosen from the top 10% percentile by population) and the minimum spanning tree, and adds them together to form a "plan" graph. The AI also stores an "actual" graph, which represents what has actaully been built. Whenever new routes are built they are selected from the "plan" graph (i.e. the plan governs what CAN be built) and added to the "actual" graph.
I have commited the source to SVN at Google Code, so you can view it online if you like. The URL is...
I like the idea of browsing the code without having to download the whole thing and load it into an IDE, etc... so I think this is rather neat. The code is GPL too so feel free to use any of it.
Hope you like it Any comments or questions?
BTW I didn't draw the dinosaur! Its from a free icon set!
Edit (08/07/2009): Added version 6 with a new 10 year performance shot. Used more aggressive settings to give most "tournament"-like performance.