[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

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 14 Nov 2018 22:01

Adding tunnels in existing railway tracks still showed some bugs in a few test runs (always fun when functions do something else than expected), as in
the following image:
Image

A changelog for version 9:
- Build signals around tunnels that were placed in an existing rail line
- Bugfix: verify if a tunnel will be built as the AI expects it to be built (expectations were sometimes wrong)
- Bugfix: A train stuck on a disconnected piece of rail will get a depot where it can be sold (might take a few years)

nihues
Engineer
Engineer
Posts: 44
Joined: 13 Jan 2015 10:26

Re: [AI] RailwAI

Post by nihues » 15 Nov 2018 14:40

Since V8, my savegame (and a new game) start with this error.
Attachments
Black & Co., Jul 2nd, 1951.png
(151.72 KiB) Not downloaded yet

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 15 Nov 2018 20:52

Thanks for reporting. I'm really surprised by this error, but I could reproduce it easily when I download the AI through BaNaNaS and start RailwAI.
If I extract the .tar file that was downloaded by openTTD to the AI folder, RailwAI starts without any problem.

If I take a look at the .tar file, it seems that openTTD writes 3 bytes too much for the file shippathfinder.nut. Usually this wouldn't matter because of zero-padding in the tar-files, but in this case BaNaNaS generated no zero-padding here :bow: I have opened an issue on GitHub about this bug in OpenTTD.

Luckily I'm not dumb and with a slightly different file length, BaNaNaS does more zero padding. :)
Changelog for version 11 (a lots of updates lately):
- Bugfix: verify if a train is in the way to build a tunnel properly
- Small changes in pathfinder for ships
- Slightly fewer buoys are used
- Workaround for a bug in OpenTTD that made this AI not downloadable through OpenTTD

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 20 Nov 2018 21:08

After a bit of development time in the last days (and a lot of testing time, mostly by running openttd in the background), version 12 is now available. I have implemented a small bit of strategy, with the goal of having more active train routes. Looking at the tests, it mainly goes at the cost of using less ships. :P

The changelog:
  • Strategy: use more trains. Use less ships. Try to build more cargo routes.
  • Bugfix: Use trucks more often
  • Bugfix: Buoys aren't anymore avoided when planning where canals should come
  • A truck service may not have the same loading station as destination station
  • Bugfix: rail will be always connected properly when a rail station became accidentally a terminus station.
  • Repair accidentally missing rail connections between two adjacent rail tiles
  • Miscellanous things: give vehicles a name
  • When extending a service A-B to C, do a better check if C is further than B (seen from A)
  • Bugfix: no crash from loading a game saved while building a new train route of which the route had been re-planned
  • Bugfix: continue building canals from a savegame, when it was doing that
  • Do not try to replan a rail track when the first attempt wasn't feasible because it was too expensive
  • Loan will not be higher than 0, if the company has 10 times more cash than the maximum allowed loan
  • Implement electrifying/upgrading rail (whole network at once, only if the company has more than 5 million pounds)

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 13 Jan 2019 20:56

A new year, so it's time for a new update. A few bugfixes, of which one was a major issue (concerning the finances): RailwAI loved to buy new road vehicles without giving them orders. Obviously, those vehicles were not really profitable.

The changelog for version 13:
  • Share orders and copy vehicle to the group, when buying a new truck/bus/ship from a different type on a connection
  • Bugfix: no crash when canceling a plan to buy a new truck/bus/ship
  • Bugfix: do not build a station meant to be a terminus connecting to other tracks
  • Bugfix: continue building a road detour around a level crossing from a savegame
  • Bugfix: try to use bridges above the desired speed limit (instead of 0 km/h) when building a road bridge
  • Removal of 90 degree turns on the rail network added in the yearly checks
  • Do not build 90 degree turns when connecting rail on a specific tile to adjacent rail tiles

peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1646
Joined: 30 Mar 2005 09:43

Re: [AI] RailwAI

Post by peter1138 » 09 Feb 2019 15:49

Bug I found in v13, in road.nut on line 128, AIRail.GetBuildCost(roadType, AIRail.BT_TRACK) is called instead of AIRoad.GetBuildCost(roadtype, AIRoad.BT_ROAD)
He's like, some kind of OpenTTD developer.

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 14 Feb 2019 20:32

Thanks for mentioning! I will fix it in the next update :)

xarick
Transport Coordinator
Transport Coordinator
Posts: 260
Joined: 26 Feb 2015 00:52

Re: [AI] RailwAI

Post by xarick » 27 Feb 2019 23:58

Slice out of range
Attachments
Unnamed, 1991-05-21.png
(273.05 KiB) Not downloaded yet
Formerly known as Samu

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 28 Feb 2019 19:44

Good finding again. I directly made a change to version 14 that I was uploading, so that is now version 15.

The changelog for version 15:
  • Bugfix: removing a dead end road on a sloping tile
  • Bugfix: do not use rail building costs when determining what road type to use
  • Bugfix: compatibility issues with Aro AI
  • Adapt chances to pick a certain transport modality based on the company name.
  • Allow to extend a single rail bridge to two parallel bridges
  • Ignore one-way roads in pathfinding.
  • Build a second road depot on long truck routes
  • Use ships slightly more often
  • Longer minimum length of double rail sections on single track railway lines
  • RailwAI became better in removing a level crossing with an alternative solution
  • Trains/trucks/buses: if only slow vehicles are available (e.g. below 60 km/h), speed is now more important for deciding which vehicle to use
  • Increased minimum distance between the first passenger railway stations on a route
  • Passenger routes: set orders sometimes to full load to increase station ratings
  • Minimum platform length of 5 tiles for freight trains
  • Improved efficiency on the feasibility checks of a new rail line
  • Retry building a level crossing when it fails because a vehicle is in the way
  • Prefer industries with high production more
  • Do not prefer very long truck routes, as the chances of getting income are less

Dr. B. Ching
Engineer
Engineer
Posts: 97
Joined: 14 May 2011 10:58
Location: Sausagewood

Re: [AI] RailwAI

Post by Dr. B. Ching » 01 Mar 2019 21:18

I don't know which change did the trick, but RailwAI seems to be doing better on sparsely populated maps now. Older versions would sometimes just sit there and investigate idea after idea, yet never build anything worthwhile or fail to establish a single route even. Perhaps industries and towns being placed much further apart than usual in comparison to the default map generator was something they couldn't handle very well.

RailwAI
Engineer
Engineer
Posts: 24
Joined: 22 Jul 2018 20:30

Re: [AI] RailwAI

Post by RailwAI » 28 May 2019 20:26

The major improvement on sparse maps was probably a combination of changes in version 15, largest part probably done by the improvement in efficiency of evaluating ideas for a new railway line.

It has been a while, but again time for some improvements. The changelog for version 16:
  • Bugfix: Ship pathfinder shouldn't fail when trying to create a new dock on land
  • Bugfix: Do not sell trucks or buses that are in a depot and were succesfully autorenewed
  • Improved search to a suitable location for docks
  • Added passenger ferry services
  • Added new options in the list for company name parts
  • Upgraded NoAI API-version to 1.6 or higher (get rid of legacy code)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest