trAIns is an AI for OpenTTD (the acronym AI will be adopted to denote a set of algorithms that control an agent in the game). The AI is called trAIns because it only constructs and manages railroad routes - one of the four transport types available in the game. The creation of trAIns has started in a graduation project that after became a research project. trAIns has been created to provide a competitive and intelligent AI that can play with railroads. A general metric of intelligence for AIs is that its actions and decisions must result in behaviors similar to the ones caused by human players. OpenTTD has a lot of AIs but few can use trains and generate good results according to this metric.
The following list enumerates the major trAIns features.
- The construction of railroads employs an abstraction called double parts that enables the construction of double railways. This approach permits many trains to circulate on the same route and also imitates one construction style of human players.
- Some special parts (named junctions parts) can be applied to branch the railroad. These branches allow the creation of complex railway networks (that is, several industries can have their production transported to one destination industry sharing parts of the railroad). Furthermore, this concept permits the concentration of production, another important strategy adopted by some players.
- The number of trains in each railroad route is computed dynamically. This dynamism permits the adjustment when the production increases or decreases or when another company starts to transport the industry production. The goal is to always keep at least one train waiting to be loaded in each loading station.
- trAIns can change the rail type to employ new locomotives. It will change the locomotive engine when it recognizes that the new one is the best engine available. During the evaluation, it considers the aspects: maximum reliability, running costs, maximum speed, power, weight and price.
- The railroad planner applies a carefully implemented version of A* algorithm. Its cost function is simple enough to avoid the expansion of several nodes and to permit the planning of relative long railways (250 tiles of length). In spite of the trade off between good railways (that is, straight lined railways) and fast planning, the planner can generate good results.
- It creates railroad routes that connects industries and railroad routes that connects two towns. The last can only transport passengers.
- During the railroad route management, trAIns can detect unprofitable routes and demolish them.
- It tries to select the industries with the largest potential of money generation. To do this, it considers the monthly production rate, the number of stations around the industry, the cargo type and the percentage of production transported last month.
- The town selection tries to avoid the towns that demands some cargo to grow.
- trAIns is partially compatible with the NewGRFs NARS (North American Renewal Set) and 2CC.
There is also a list of problems that must be solved.
- There is no upgrade of bridges.
- The junction placement can generate very strange results.
- trAIns does not sell the old vehicles.
- It can construct two consecutive bridges instead of only one.
- There is no treatment for industries that produces more than one cargo.
- trAIns can not build railroad routes connecting industry to towns.