[AI] RailwAI

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

With expansion limit on, RailwAI doesn't want to become larger than other companies around. If you would join the game and build your own routes, it might expand again. It can sometimes occur that planes aren't used, depending on the shape of cities. It might decide later to start with planes, but it requires at least enough cash. Thanks for your bug reports, those will be solved in the next release (and I found 2 more bugs myself that were already longer present).
User avatar
odisseus
Route Supervisor
Route Supervisor
Posts: 406
Joined: 01 Nov 2017 21:19

Re: [AI] RailwAI

Post by odisseus »

The AI seems to be confused by narrow gauge tracks. It builds dual tracks (which have a speed limit) and attaches narrow gauge wagons (which have a still lower speed limit and very low capacity) to a normal engine; as a result, the train goes at 20 km/h when 120 km/h would be possible with normal wagons.
narrow-gauge.png
narrow-gauge.png (40.24 KiB) Viewed 7498 times
Attachments
narrow-gauge-2.sav
(98.63 KiB) Downloaded 150 times
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

It was indeed confused by the fact that only some carriages and track types have speed limits. I have fixed some bugs and added more options to regulate the company expansion. Therefore version 25 (now available) should always work better than 24. The changelog:
  • Bugfix: loading a savegame while creating a new service with ships
  • Bugfix: do not send helicopters to hangars instead of the terminal
  • Bugfix: repairing pathfinder was sometimes unable to restore paths along diagonal tracks
  • Bugfix: savegames while using the repairing pathfinders sometimes caused bad behaviour after reloading
  • Trains: better support for narrow gauge newGRF
  • AI Settings: more options to limit company expansion
Jacobian
Engineer
Engineer
Posts: 2
Joined: 19 Aug 2020 16:50

Re: [AI] RailwAI

Post by Jacobian »

Hi. Where can I download this AI? Or where can I download AI: trAIns

What is the best AI for Railway only? I´m looking for Railway AI because i like to play with ships and Aircraft. So i´m looking for AI which will build Trains instead of me. Admiral AI sucks. Admiral AI build only simple trains.
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

Hi Jacobian,

This AI is available via the in-game content. After starting openTTD, you can choose the option 'check online content' and search for RailwAI. When you select RailwAI, you can press the download-button on the right to download it.
In order to play with/against RailwAI, you should tell openTTD to use it. After downloading, you can select 'AI/Game Script Settings' from the main screen in openTTD. Here you can select the artificial competitors and configure them.

Enjoy!
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

It was quite a while ago since the last update, but a new version 26 is available on BaNaNaS. The changelog:
  • Minimum required OpenTTD version increased to 1.10
  • Bugfix: repairing pathfinder should not update its counters in testmode
  • Bugfix: crash when trying to place a railway signal on a tile without rail
  • Allow to transport two cargo types in one train (e.g livestock/grain or passengers/mail)
  • Rail pathfinder: Take slope steepness into account
  • Do not use slow trucks or trains for long distance transport
  • Do not build stations that can not be used by articulated road vehicles if articulated road vehicles are used
  • Do not try to convert a rail type if crossings are present that can not be converted
  • Increase financial buffer, such that economical recessions are less of a problem
  • Allow to use different roadtypes over the years when RattRoads/U&Ratt newGRF is activated
  • Bugfix: do not remove water depots that are still in use
  • Automatically remove water depots that are not in use
  • Use the livery colour in the company name with a chance of 6%
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

I only noticed recently that is has difficulties on recognizing the default maglev locomotives, I'll solve it in the next update.
sevenfm wrote: 22 Oct 2019 18:29 Found two problems with this AI when tried it in my game (JGR 0.32):
1. It does not understand road types (I used rattroads) - it builds standard expensive road instead of cheapest, even though the fastest vehicle can run at 30 km/h at that time.
2. It builds intercity roads which can hardly pay for their maintenance at that time, instead of building local bus networks in big towns which could be very profitable and provide a cash for later expansion.
Does it work better now, or do you have any suggestions on improvement for new road types?
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

Version 27 is now available on BaNaNaS. The changelog:
  • Take the freight weight multiplier into account when determining the amount of required locomotives in a train
  • More frequent use of railway tunnels when the world has hills
  • Several pathfinder optimizations
  • Allow slopes under a railway station or airport, as long as it can be built
  • Use less planes on a single route
  • Use the monorail Millenium Z1 locomotive as a locomotive
  • Improved support for different trains NewGRF (Czech Railways set, 2cc set and more)
  • Bugfix: compute size of financial buffer correctly
  • Bugfix: do not forget to electrify railway depots
  • Bugfix: do not occasionally remove a railway bridge of another railway line when building a new railway line on adjacent tiles
  • Bugfix: railway lines were not always removed after a decision to sell all vehicles on the line
openttdfan2020
Engineer
Engineer
Posts: 19
Joined: 31 May 2019 21:26

Re: [AI] RailwAI

Post by openttdfan2020 »

Hey RailwAI, I'm curious about the Rail Expansions like (2 3 or 5 tracks) to industries (if Freight Service) and towns (if Passenger Service), It will be super cool that you add Rail Yards with Depots, 5 Tracks Freight Station, and 5 Tracks Terminal. Maybe you can support Canadian Trainset and many Unsupported Trainsets.
It might be really cool idea when's there's the next update. 8)
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

What do you mean with the first sentence?
Can you be more specific in the problems of the AI with the canadian trainset? If I don't know what's the problem, I can not try to fix it.
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

Version 28 is now available. Changes:
  • Improved financial management (bank loans)
  • Allow to demolish houses to build a railway track
  • Allow to build train stations on sloped tiles
  • Rail pathfinder optimizations
  • Use more than one depot on longer passenger railway lines when breakdowns are enabled
  • Bugfixes in the function to add wagons to an existing train
  • Bugfix: don't build disconnected railway track after building a bridge to cross another, diagonal railway line
  • Bugfix: on a single track railway line, don't place signals near the a station on such that deadlocks occur
AAAHogEx
Engineer
Engineer
Posts: 37
Joined: 30 Jan 2022 15:37
Location: Japan

Re: [AI] RailwAI

Post by AAAHogEx »

Hi.

I was trying with some AIs and Railwai crashed. (no newgrf)
Attachments
1960-05-06.png
(3.36 MiB) Not downloaded yet
1960-05-06.sav
(2.38 MiB) Downloaded 41 times
xarick
Transport Coordinator
Transport Coordinator
Posts: 301
Joined: 26 Feb 2015 00:52

Re: [AI] RailwAI

Post by xarick »

RailwAI, I wanted to ask if you were aware of this bug: https://github.com/OpenTTD/OpenTTD/pull ... 1371132045

AIGroup.GetProfitLastYear gets the profit vehicles had last year, but it doesn't include the profits of vehicles below minimum age, while AIGroup.GetProfitThisYear does.

I ask, what were you expecting the function to do when you coded it in RailwAI? When trying to read your code seems that you wanted to include (or exclude) some groups if the vehicles are not old enough.
Formerly known as Samu
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

Thanks for mentioning it here. I was not aware of the bug but assumed it would give the same value as on the GUI. I indeed exclude some groups if the oldest vehicle is too young, but I think this noAI bug might have had some negative impact on my AI. Probably not very significant, since I didn't found the bug during testing. For me it's safe if the behaviour of this function changes. Thank you for finding this issue and solving it! :D
User avatar
RailwAI
Engineer
Engineer
Posts: 71
Joined: 22 Jul 2018 20:30
Location: Headquarters

Re: [AI] RailwAI

Post by RailwAI »

Version 29 is now available
  • Passenger trains now stop at the middle of the platform
  • Planting trees now consumes less time per group of trees planted
  • Connect railway depots with two tracks instead of one
  • Be able to continue converting rail track types on the map from a savegame
  • Be able to build slightly different station throats
  • Replace road vehicles with faster road vehicles if available
  • Check town ratings when planning new train stations
  • Improvements on making railway bridges double track
  • Bugfix: do not accidentally remove a part of the first track when building parts of the second track
  • Bugfix: unintended division by zero (thanks for reporting, AAAHogEx)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest