WmDOT v14 [2016-08-29]

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
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v8 [2012-01-21]

Post by MinchinWeb »

Thanks to the wonderful people on this forum (with a little help from Google and the GRF Crawler), I have managed to find all the files needed. The behavior is...odd. For some reason, my function to find the station at the Fishing Grounds is failing. Most investigation and coding to follow...
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
doublehappy
Engineer
Engineer
Posts: 6
Joined: 11 Oct 2009 09:47

Re: WmDOT v8 [2012-01-21]

Post by doublehappy »

Hi - I am receiving the following error on initialisation of the AI. This is a fresh Windows install, so I downloaded the latest nightly and then downloaded the AI through the in-game online content. I searched the error message and it looks like AIAbstractList is obsolete now?

Image

Usually I'd give up and move on but I love the idea of this AI. Thanks for any help!
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v8 [2012-01-21]

Post by MinchinWeb »

doublehappy wrote:Hi - I am receiving the following error on initialisation of the AI. This is a fresh Windows install, so I downloaded the latest nightly and then downloaded the AI through the in-game online content. I searched the error message and it looks like AIAbstractList is obsolete now?
(..)
Usually I'd give up and move on but I love the idea of this AI. Thanks for any help!
Thanks for the report. AIAbstractList has indeed been replaced, but I guess I must have missed this one :( I'll try and fix it right away, this should be an easy fix :D
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v8 [2012-01-21]

Post by Zuu »

I believe that is a bug in SuperLib. I think you could do this at global scope to fix it until version 22 is out:

Code: Select all

AIAbstractList <- AIList
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v8 [2012-01-21]

Post by MinchinWeb »

Version 9 has been released! Available in the first post on or Bananas. Improvements include:
  • Now supports all of FIRS' water industries
  • Code fixes due to updated AI framework (doublehappy's bug and Zuu's solution, among others)
  • Should be better at building ship routes that actually connect! (JacobD88's bug)
Thanks for all your comments!

I will keep trying to fix bugs as they are reported. As for the next addition to WmDOT, I would like to improve the ship pathfinder, improve ship selection, move to dynamic route management, and move OpDOT (the road building) to a grid based system (hopefully to improve speed on larger maps).
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
Core Xii
Traffic Manager
Traffic Manager
Posts: 228
Joined: 08 Apr 2008 09:47
Location: Finland

Re: WmDOT v8 [2012-01-21]

Post by Core Xii »

There appears to be something wrong with WmDOT version 9 on Bananas, in that OpenTTD doesn't load it at all.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v8 [2012-01-21]

Post by MinchinWeb »

Core Xii wrote:There appears to be something wrong with WmDOT version 9 on Bananas, in that OpenTTD doesn't load it at all.
WmDOT v9 requires version 1.2 of the API and so requires r23879 (or thereabouts) or the latest release candidate version. I've updated Bananas so the download shouldn't show up if your version of OpenTTD can't load it. Sorry for the confusion!
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
Paasky
Transport Coordinator
Transport Coordinator
Posts: 269
Joined: 06 Sep 2004 07:38
Location: Vantaa, Finland
Contact:

Re: WmDOT v9 [2012-03-17]

Post by Paasky »

First of all, thanks for this great AI: a perfect fix for the ridiculous gridlock 2x StreetTraffic with 500 cars max each causes in cities I'm not connecting myself :)

I was wondering, would it be possible (with the current pathfinder) to make it be able to build motorways? Something simple like this:
Image

I read earlier in the thread about the problems of long-distance roads & calc time. I wonder if that could be reduced by limiting the max # of turns between two cities to one or two (then either bridge/tunnel any obstacles). I just wonder if the stock pathfinder can be used to do this. Or if it even can handle one-way roads for that matter.


Nevertheless this AI will be a great addition to the coop multiplayer games my friends and I have, making the game world feel a bit more "real" ;)
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v9 [2012-03-17]

Post by MinchinWeb »

Hey Paasky! So glad to hear you're loving my AI!
Paasky wrote:First of all, thanks for this great AI: a perfect fix for the ridiculous gridlock 2x StreetTraffic with 500 cars max each causes in cities I'm not connecting myself :)

I was wondering, would it be possible (with the current pathfinder) to make it be able to build motorways? Something simple like this:

I read earlier in the thread about the problems of long-distance roads & calc time. I wonder if that could be reduced by limiting the max # of turns between two cities to one or two (then either bridge/tunnel any obstacles). I just wonder if the stock pathfinder can be used to do this. Or if it even can handle one-way roads for that matter.

Nevertheless this AI will be a great addition to the coop multiplayer games my friends and I have, making the game world feel a bit more "real" ;)
Motorways (or freeways) would indeed be possible. Building one way roads instead of two way roads is a simple change. The pathfinder is directional, so running it both directions would give you both sides of the freeway. This would double your pathfindering time, but that would be fine as long as you don't try to go from one end of the map to the other at once (where pathfinding time is already a problem).

The hard part is actually more in the aesthetics. Running the pathfinder as it is, there is no way to enforce 'drive on the right' or 'drive on the left' rules, or to keep the two highways from crossing each other, or to keep the two highways side by side. How do you find the end of existing freeways to continue them? How long do you make the access road?

To some extent, the fact that the highways might not be side by side is a feature rather than a bug - it's used often in the real world where it's called 'independent gradelines' and used to get gentler hills.

But I love the idea, so I'll see what can be done with it next time I sit down to work on WmDOT.

P.S. I think they'd rather you upload pictures to the forum here, rather than use something like Imgur. That way, they can better make sure that the images don't disappear before the post does.
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: WmDOT v9 [2012-03-17]

Post by JacobD88 »

Hi Minchinweb,

With regards to motorways i envisage one more problem; junctions...

Once the AI has built the motorways you won't be able to join roads on to them unless you buy the AI out as you can't add junctions to one-way roads and you can't modify the road section to stop it being one-way because you don't own it.

Unless a solution can be found this would make WMDot a pain, as one of the things i love about the AI now is you can just join on to its road network as you please, even if the AI's company isn't purchased...
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v9 [2012-03-17]

Post by Zuu »

Regarding junctions:
Convert wmDOT into a GameScript, then players who want a junction can propose that by placing a sign where they want a junction with some pre-defined content (eg. "junction please") Or, keep wmDOT as an AI and create a game script that reads player signs that contain human readable commands to AIs and post that using SCP to the AI.

Or, build highways with one-way signs only every X tiles. Eg. every 3-4 tiles. That then allows players, towns or AIs to add junctions if they wish.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v10 [2012-06-27]

Post by MinchinWeb »

Version 10 released! The most notable improvement is that WmDOT is dynamically add ships. It isn't smart enough to delete ships yet, so we'll just cross our fingers that industry production just never goes down... Ship depots also will not longer be built right next to docks.

I hope the next version will add the ability to delete ships if too many are in circulation and replace ships when they get old.

No freeways have been built yet... I'm still considering the best way deal with junctions and access roads.

Available at the first post of this thread or on Bananas.
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

Junctions/freeways: Could it detect the presence of player-built roads leading up to the freeway, and then build a junction to them?
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v10 [2012-06-27]

Post by Zuu »

If you accept a delay of 1-2 months, it is possible for the GS to detect your road. If you want quicker action (and saved CPU time), it can be made that the player must tell the GS by placing a sign with a specific message at near the road.

Scanning the list of signs is a few times a month is much quicker than doing advanced scanning of the map several times a month.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

More junctions/motorways: Surely not every tile needs to be one-way? If every 4th tile (say) was one-way, this would still ensure that the road was used correctly, while still allowing other roads to be connected to the motorway.
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v9 [2012-03-17]

Post by MinchinWeb »

Zuu wrote:Convert wmDOT into a GameScript, (...)
I've considered this and even started working on a conversion, and had it running, but ran into issues as at the time because GameScripts couldn't build tunnels or bridges, and couldn't remove road tiles. I think the tunnels and bridges issue has been fixed, but I don't know if road removal works yet. Can anyone confirm that GameScripts can remove roads?
Zuu wrote:Or, build highways with one-way signs only every X tiles. Eg. every 3-4 tiles. That then allows players, towns or AIs to add junctions if they wish.
FLHerne wrote:More junctions/motorways: Surely not every tile needs to be one-way? If every 4th tile (say) was one-way, this would still ensure that the road was used correctly, while still allowing other roads to be connected to the motorway.
I'm thinking out loud trying to figure out what problems I might run into... the biggest one that comes to mind is that if I run the pathfinder in one direction, built the road with one-ways every few titles, and then run the pathfinder the other direction, what's to keep the two directions from continually merging and un-merging? (see picture below) Or worse yet, put a one-way arrow on the common (merged) piece effectively rendering the whole road one-way?
McAlpine & Co., 31st Jan 1950.png
McAlpine & Co., 31st Jan 1950.png (91.83 KiB) Viewed 6424 times
One option is to build a pathfinder that finds both directions at the same time (I know one of the AI's does that for rail pathfinding). This would probably help for pathfinding speed, but would require me to write (or heavy modify) a new pathfinder. One idea I've been playing with is a sort of 'meta-pathfinder' that would break longer pathfinding tasks into finding shorter paths between a series of grid points; maybe that could be easily expanded... Unfortunately, no code for that has been written yet either.

Thanks for taking an interest and helping me problem solve!
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

Perhaps you could build it with all one-way signs, and then remove many of them?

Totally unrelated: When used with TownCars (and presumably if any other player was using the network), the Cleanup Crew tend to leave cars stranded on single tiles while removing road links. Would it be possible to make it remove roads carefully in order to avoid trapping cars?
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

Dubious routing decision...
Unnamed, 2nd Sep 2002.png
Unnamed, 2nd Sep 2002.png (92.37 KiB) Viewed 6422 times
Fails to build a bridge...(also random loop)
Unnamed, 5th Apr 2002.png
Unnamed, 5th Apr 2002.png (81 KiB) Viewed 6422 times
What the... :shock:
Unnamed, 16th Nov 2001.png
Unnamed, 16th Nov 2001.png (138.09 KiB) Viewed 6422 times
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

As previous, but with expensive bridge...
Unnamed, 25th Feb 2004.png
(980.77 KiB) Downloaded 3 times
EDIT: Too many crossroads :P
Black & Co., 17th Oct 2015.png
Black & Co., 17th Oct 2015.png (61.09 KiB) Viewed 6418 times
EDIT2: A random bridge thing.
Black & Co., 1st Apr 2018.png
Black & Co., 1st Apr 2018.png (109.93 KiB) Viewed 6417 times
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: WmDOT v10 [2012-06-27]

Post by FLHerne »

Two examples of useless bridges...
Attachments
Black & Co., 13th May 2021#1.png
Black & Co., 13th May 2021#1.png (65.37 KiB) Viewed 6416 times
Black & Co., 13th May 2021.png
Black & Co., 13th May 2021.png (157.06 KiB) Viewed 6416 times
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests