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 v6

Post by MinchinWeb »

Leanden wrote:I tried this AI, and it crashed straight out of the box.
Thanks for the report Leanden. This has been fixed with WmDOT v6 as well. The problem was caused by WmDOT failing to build a HQ, and then not knowing what to do next. WmDOT will now search a bigger area to build the HQ, and will try other towns if the first one doesn't work. If it still can't build a HQ, it will pass a parameter so at least it won't crash! :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
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v6

Post by MinchinWeb »

OTTDmaster wrote:You lucky few - whenever I get WmDOT - I merely get a failed to compile /WmDOT-3/ and a failed to compile /WmDOT-5/.

EDIT: Downloaded from BaNaNas

Matthew:out
Matthew, this is strange... If you downloaded it from Bananas, you should have gotten the dependcies automatically, but you could check for them. With v6 of WmDOT, they are SuperLib v7, MinchinWeb's MetaLibrary (MetaLib) v1, Graph.AyStar v6, and Queue.FibonacciHeap v2. But many things could cause a crash because the AI's are compiled on-the-fly. Post a screenshot here of the crash and I'll see if I can tell you what's wrong.
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
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: WmDOT v6

Post by Roujin »

Thanks for the update and the Cleanup Crew :)
MinchinWeb wrote:
Leanden wrote:I tried this AI, and it crashed straight out of the box.
Thanks for the report Leanden. This has been fixed with WmDOT v6 as well. The problem was caused by WmDOT failing to build a HQ, and then not knowing what to do next. WmDOT will now search a bigger area to build the HQ, and will try other towns if the first one doesn't work. If it still can't build a HQ, it will pass a parameter so at least it won't crash! :D
Hm, does it need to build a HQ at all? I found it a bit strange when I came across a HQ WmDOT built since it's not a real competitor, but more of a "utility AI" ;) In one game I also killed off WmDOT via console (sorry :P) as soon as it had built a nice road network, so that on removal its roads became public (and thus removable by me when in the way).
AFAIK building a HQ has no advantage (apart from a few pax generated) or disadvantage (apart from costing some money).
I'm not sure how to fix the problem more as WmDOT really has no conception of the network as a whole or really the map as a whole. Suggestions on how to improve this are welcome!
In the long run, I'd suggest the AI to abstract a bit from towns ("I need to connect every town with every other town") to routes, i.e. figure out some place (e.g. between two rather big towns rather far away) where a main route (think highway, it could even be made one with one way roads every x tiles) is constructed, and then normal roads splitting off from that highway wherever another town is nearby.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
DeletedUser6
Transport Coordinator
Transport Coordinator
Posts: 294
Joined: 23 Jul 2007 15:13
Location: Somewhere in this page

Re: WmDOT v6

Post by DeletedUser6 »

MinchinWeb wrote:
OTTDmaster wrote:You lucky few - whenever I get WmDOT - I merely get a failed to compile /WmDOT-3/ and a failed to compile /WmDOT-5/.

EDIT: Downloaded from BaNaNas

Matthew:out
Matthew, this is strange... If you downloaded it from Bananas, you should have gotten the dependcies automatically, but you could check for them. With v6 of WmDOT, they are SuperLib v7, MinchinWeb's MetaLibrary (MetaLib) v1, Graph.AyStar v6, and Queue.FibonacciHeap v2. But many things could cause a crash because the AI's are compiled on-the-fly. Post a screenshot here of the crash and I'll see if I can tell you what's wrong.
It appears to be the info.nut - that's killing WmDOT...
Unnamed, 6th Jan 1970.png
Unnamed, 6th Jan 1970.png (105.33 KiB) Viewed 1020 times
After getting the newest version (6), it would appear to also be killing MetaLib.

I'd use the debug console - but I don't use windows...

EDIT: Dependencies are fine - except they aren't (see above)...

Matthew:out
Yay! I'm back! Did you miss me?


...


I thought not.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v6 [2011-04-28]

Post by Zuu »

Hello, while taking a look at your MetaLib I found this function.

I guess you already use it without any problems, but to me it looks like this would not create a 3-dimensional array with independent cells. As far as I remember, Squirrel objects/arrays etc. are assigned by reference and not by value. But it could be that Squirrel don't model arrays as objects, but rather as a built in type (like eg. integers, floats etc.) and thus assign them by value.

Code: Select all

function _MetaLib_Array_::Create3D(length, width, height)
{
    local ReturnArray = [length];
    local tempArray = [width];
    local tempArray2 = [height];
    
    for (local i=0; i < width; i++) {
        tempArray[i] = tempArray2;
    }
    
    for (local i=0; i < length; i++) {
        ReturnArray[i] = tempArray;
    }
    
    return ReturnArray;
}
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 v6

Post by MinchinWeb »

Roujin wrote:Thanks for the update and the Cleanup Crew :)
You're welcome!
Roujin wrote:Hm, does it need to build a HQ at all?
Because every bureaucracy needs a place to keep their minions! Actually, it's the first thing I got WmDOT to do, mostly because I thought it would look cool, and I thought it strange when AI's didn't build a HQ. Today, it is used as a rough form of save/load functionality - on reload, WmDOT looks for its HQ and recommences building the road network from there. The other place it's used is if you load up more then one copy of WmDOT, the HQ's is how they 'tell' each other where they are (otherwise the second copy keep trying to rebuild the roads the first one built and never actually builds anything new...)
Roujin wrote:In one game I also killed off WmDOT via console (sorry :P) as soon as it had built a nice road network, so that on removal its roads became public (and thus removable by me when in the way).
If only we could do that when the real life version DOT builds a freeway in front of your house :wink: But no worries, I could see myself doing the same thing! Be aware though that with WmDOT will go any bridges or tunnels its built (that's also true if WmDOT goes bankrupt).

I'll keep thinking about the extra road issue...
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
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v6 [2011-04-28]

Post by MinchinWeb »

Zuu wrote:Hello, while taking a look at your MetaLib I found this function.

I guess you already use it without any problems, but to me it looks like this would not create a 3-dimensional array with independent cells. As far as I remember, Squirrel objects/arrays etc. are assigned by reference and not by value. But it could be that Squirrel don't model arrays as objects, but rather as a built in type (like eg. integers, floats etc.) and thus assign them by value.

Code: Select all

function _MetaLib_Array_::Create3D(length, width, height)
I'm pretty new with programming and this AI stuff is a way to learn more, so although I (think) I understand the difference between by reference and by value, and I have no idea how to test which Squirrel is doing... I don't know if I've ever used the 3D version, but I'm pretty sure I've used the 2D one; it does create an array that you can use .push() to right away and it seems to work for that...
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
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: WmDOT v6 [2011-04-28]

Post by Leanden »

Well it works well, but it takes ages!!!! Anyway to make it go a bit faster. I'd only be running it until the road network was complete, so CPU speed wouldn't be an issue.
Image
User avatar
Level Crossing
Tycoon
Tycoon
Posts: 1187
Joined: 07 Feb 2011 22:04
Location: East Coast, United States

Re: WmDOT v6 [2011-04-28]

Post by Level Crossing »

Sorry for the bump, I have no idea if this is still being maintained or not, great AI though.

The cleanup crew cleaned too much, apparently. :(
WmDOT.PNG
WmDOT.PNG (142.79 KiB) Viewed 7882 times
Also, re:how to make the program 'smarter', here's my suggestion (no idea if it's feasible, should be though):

1. Choose two large towns on opposite ends of the map (as far away as possible).

2. Construct a road between them, going near but not through as many towns as possible on the way, while keeping it straight.

3. Connect said towns to the highway with short roads.

4. For each other town, find the 'ideal' way to connect it to the network (short road to another town on the network? dedicated road to the highway?), having the AI 'prefer' an existing road, but not too much.

I don't know too much about programming, but this should be possible with a special pathfinder (maybe even something from SuperLib).
Like my avatar? See my screenshot thread
DeletedUser6
Transport Coordinator
Transport Coordinator
Posts: 294
Joined: 23 Jul 2007 15:13
Location: Somewhere in this page

Re: WmDOT v6 [2011-04-28]

Post by DeletedUser6 »

Yet another WmDOT problem:

Compile error: Error wmdot-6/info.nut:1/1: expression expected
Compile error: Error minchinwebs_metalibrary-1/library.nut:1/1: expression expected

Yawn.

Matthew:out
Yay! I'm back! Did you miss me?


...


I thought not.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v6 [2011-04-28]

Post by MinchinWeb »

Level Crossing wrote:Sorry for the bump, I have no idea if this is still being maintained or not, great AI though.
It is! And the Christmas holidays give me a great time to hopefully implement a few lurking ideas.
Level Crossing wrote:The cleanup crew cleaned too much, apparently. :(
I've been having some troubles with this, and haven't figured out a good fix yet. I also have some issues on slopes sometimes. I'll look into it again.
Level Crossing wrote:Also, re:how to make the program 'smarter', here's my suggestion (no idea if it's feasible, should be though):

1. Choose two large towns on opposite ends of the map (as far away as possible).
2. Construct a road between them, going near but not through as many towns as possible on the way, while keeping it straight.
3. Connect said towns to the highway with short roads.
4. For each other town, find the 'ideal' way to connect it to the network (short road to another town on the network? dedicated road to the highway?), having the AI 'prefer' an existing road, but not too much.

I don't know too much about programming, but this should be possible with a special pathfinder (maybe even something from SuperLib).
This indeed would be possible, and the pathfinder, as such, I think I have figured out. The problem with running the pathfinder on long distances is the time it takes goes up exponentially as distance increases (i.e. as your distance doubles, your time goes up 4x)*. The other current problem with the pathfinder is that if it can't find a path, which is often because the towns in question are on two different islands, it can take a very long time to fail. The combination has meant that I've favoured small steps, but I can see if I can dream up to make the network stretch across the map faster.

* The numbers might be a little off; I've never done the testing, but I hope the idea come across...

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ZirconiumX wrote:Yet another WmDOT problem:

Compile error: Error wmdot-6/info.nut:1/1: expression expected
Compile error: Error minchinwebs_metalibrary-1/library.nut:1/1: expression expected
Hey Matthew,
Thanks for the report, but I'm not really sure how to 'fix' this... My guess is that your computer can't read the text files that make up WmDOT. Let me ask you some questions to see if I can figure out what the problem is:
  • - Did you download my AI from here or from Bananas or through the OpenTTD downloader?
    - Do other AI's work?
    - Has WmDOT ever worked on your machine?
    - What OS are you running?
    - What version of OpenTTD are you running?
Thanks.
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
DeletedUser6
Transport Coordinator
Transport Coordinator
Posts: 294
Joined: 23 Jul 2007 15:13
Location: Somewhere in this page

Re: WmDOT v6 [2011-04-28]

Post by DeletedUser6 »

MinchinWeb wrote: <snip>
ZirconiumX wrote:Yet another WmDOT problem:

Compile error: Error wmdot-6/info.nut:1/1: expression expected
Compile error: Error minchinwebs_metalibrary-1/library.nut:1/1: expression expected
Hey Matthew,
Thanks for the report, but I'm not really sure how to 'fix' this... My guess is that your computer can't read the text files that make up WmDOT. Let me ask you some questions to see if I can figure out what the problem is:
  • Did you download my AI from here or from Bananas or through the OpenTTD downloader?
  • Do other AI's work?
  • Has WmDOT ever worked on your machine?
  • What OS are you running?
  • What version of OpenTTD are you running?
Thanks.
  1. Bananas - however even Bananas doesn't recognise the fact that it has been downloaded.
  2. Yes - I have a whole fleet of AIs working - except yours
  3. No - WmDOT is never recognised, ever.
  4. Mac OS X 10.4.11.
  5. 1.2.0-beta1.
/Off-topic
MinchinWeb - use [*] for each phrase to get the desired effect.

Matthew:out
Yay! I'm back! Did you miss me?


...


I thought not.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v7 [2012-01-12]

Post by MinchinWeb »

Version 7 has been released!!

The biggest change is the addition of Operation Hibernia, which transports oil from Oil Rigs to Oil Refineries.

Image

The function has been written to transport cargo from sea-based industries. With this, it might just be enough to keep WmDOT from being destined for bankruptcy.

Please report bugs or other oddities.

For updates, I hope they will come quickly and include fixes to the issues in Operation Hibernia reported here, and improvements to the road pathfinder (bridge over rivers and railroads), and clean up crew improvements.

@ZiconiumX / Matthew: try the new version. The fact that both were error-ing out at the first character suggests it might be an encoding issue. I hope this will fix it...
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
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: WmDOT v6 [2011-04-28]

Post by planetmaker »

ZirconiumX wrote:
MinchinWeb wrote: <snip>
ZirconiumX wrote:Yet another WmDOT problem:
Do you have an Intel or a PowerPC CPU?
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 8 Released!

Mostly to take advantage of the improvements available thru an update to MetaLibrary. Improvements include:
  • Fixes a bug where WmDOT would crash if there were no towns above the population limit.
  • Can now bridge over canals, rivers, and railroad tracks.
  • Operation DOT's initial spread is based on the speed of available buses, rather than hardcoded.
  • Operation Hibernia will now make use of existing buoys.
  • Operation Hibernia can now join distance stations.
  • Minor improvements to Cleanup Crew (but I think it still has some bugs to be worked out...)
Available at the first post 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
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: WmDOT v8 [2012-01-21]

Post by JacobD88 »

Hi MinchinWeb,

I have a bug report for you, regarding operation Hibernia. For some reason when using FIRS; the AI is insistent that it has to build a buoy next to fishing grounds and set a route between the buoy, a depot, and a port (that is obstructed by the depot)... The result is that the AI ploughs thousands into a group of ships that make no money, and the AI goes bankrupt... Game started in 1860, currently at 1965... You can also see some of the oddities of WMDot building roads between towns over the 100+ years...

Savegame and Screen Below...

Interestingly, if i take-over the AI and a new one sets up, it builds the exact same route on the same part of the map, just in the tile next to the previous companies buoy/port/depot
Fishergate Logistics, 7th Feb 1963.png
Screenie
(124.09 KiB) Downloaded 3 times
Regards

Jacob
Attachments
Fishergate Logistics NewGRF Modded (UKRS2+ FIRS).sav
Savegame
(267.07 KiB) Downloaded 255 times
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 »

JacobD88 wrote:I have a bug report for you, regarding operation Hibernia. (..)
Thanks for the bug report. I can't open the savegame because of a number of GRF files that aren't on Bananas, and don't show up in Google. Would you be able to send me them, or a link to where to download them, please?
screenshot.png
screenshot.png (6.54 KiB) Viewed 7528 times
Operation Hibernia starts with a list of unserviced sea-based industries, and so until someone provides service to the fishing grounds in question, it will likely always be the best pick.

The 'extra' buoy is kind of odd... as for the harbour, it should still be reachable...
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
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: WmDOT v8 [2012-01-21]

Post by Leanden »

I can see at least one GRF which is in there that you won't get sent to you or find on the internet. (SACSobjects)
Image
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: WmDOT v8 [2012-01-21]

Post by Supercheese »

Leanden wrote:I can see at least one GRF which is in there that you won't get sent to you or find on the internet. (SACSobjects)
O RLY?! http://www.tt-forums.net/viewtopic.php? ... 08#p884508

:wink:
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: WmDOT v8 [2012-01-21]

Post by JacobD88 »

Hi MinchinWeb,

Thanks for the prompt reply, as mentioned above, im not really able to send you GRFs due to some of the licences, but i can tell you what they are...

The Seaplane Airport is in the forums
As is newobjects_mq
SACs objects has already been linked; i didn't know it had been released
TreesW.GRF is the October 2007 release of SACs Trees (By George)
TTD Landscape is on Bananas and in the forums/grfcrawler
FIRS Nightlies are available on the development thread
All the others are on Bananas or GRF Crawler

I'll PM you if you need help finding anything else...

Many thanks

Jacob
Last edited by JacobD88 on 26 Jan 2012 10:25, edited 1 time in total.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests