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
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: WmDOT v13 [2014-03-10]

Post by Leanden »

Hi Minch, I dont know if you are still maintaining this, but it still runs unbelievably slow.

Im running a 4968x4968 map, and have had the AI running for 3 hours now on fast forward, and its managed to build 1 ship and nothing else (ive cheated it 50,000,000 but its not using it for roads).
Image
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v13 [2014-03-10]

Post by Zuu »

4968x4968 is extremely large and I would expect many AIs to have a problem with it unless they have some special strategy to not get into choice overload. Especially as most AIs that you find available were made when 2048x2048 was the maximum map size.

What you can do is to increase the number of oopcodes that the AI can execute per tick. Basically you can allow the AI to "think" more per game time. However, the tick will be over immediately if an AI make an API call that manipulates the game state. So for building operations it only got 74 building actions per second. This limit does not increase when map sizes increase.

Edit: In (advanced) settings you find the oopcodes setting in the group with settings for computer opponents. You will most likely need to choose to view expert settings.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: WmDOT v13 [2014-03-10]

Post by Leanden »

Another issue, the AI seemed to freeze and in debug get replaying this message:

"You can't convert a path while there's a running pathfinder."

It comes from this section of code, but i cant identify the issue:

Code: Select all

function _MinchinWeb_RoadPathfinder_::PathToTilePairs()
{
//	Returns a 2D array that has each pair of tiles that path joins
	if (this._running) {
		AILog.Warning("You can't convert a path while there's a running pathfinder.");
		return false;
	}
	if (this._mypath == null) {
		AILog.Warning("You have tried to convert a 'null' path.");
		return false;
	}
	
	local Path = this._mypath;
	local TilePairs = [];

	while (Path != null) {
		local SubPath = Path.GetParent();
		if (SubPath != null) {
			TilePairs.push([Path.GetTile(), SubPath.GetTile()]);	
		}
	Path = SubPath;
	}
	
	//	End build sequence
	return TilePairs;
}
EDIT: I set opcodes to 100,000 and it isnt any faster :/
Image
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

@Leanden:The problem you see isn't caused by the map size directly. What I think WmDOT is trying to do is run the ship pathfinder between two points in different waterbodies. WmDOT will keep trying and trying until it is absolutely sure there is no connetions. So basically it is stuck in an infinate loop. And if WmDOT got one ship running, it will probably never run out of money either. I've worked at re-writing the ship pathfinder twice, but struggled with testing.

The solution (recommend for large maps or when you just want the road building): In WmDOT's settings, turn off 'Operation Hibernia'. This will turn off the ship building. As well, run multiple instances of WmDOT (they'll play nice together). On a 512x512 map, I will often run 4 instances. So on a 2k x 2k map you could probably fill all the AI slot with WmDOT's.

Hope this helps and provides some insight.
- MinchinWeb
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 v13 [2014-03-10]

Post by MinchinWeb »

Leanden wrote:Another issue, the AI seemed to freeze and in debug get replaying this message:

"You can't convert a path while there's a running pathfinder."
It's throwing this error as the pathfinder has timed out without finding a path...
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 v13 [2014-03-10]

Post by Leanden »

Thanks, Ill try running it without Hibernia active.

Will WmDOT build level crossings?
Image
User avatar
Leanden
Tycoon
Tycoon
Posts: 2613
Joined: 19 Mar 2009 19:25
Location: Kent

Re: WmDOT v13 [2014-03-10]

Post by Leanden »

Ok new problem, the debug is spamming "cannot convert null path".
Image
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

Leanden wrote:Will WmDOT build level crossings?
I'm pretty sure WmDOT will avoid building level rail crossings wherever possible.
Leanden wrote:the debug is spamming "cannot convert null path".
If WmDOT keeps building stuff, this isn't a problem. This is what happens when the pathfinding fails, but WmDOT is much better at dealing with impossible road connections than sea connections.
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
wodencafe
Engineer
Engineer
Posts: 1
Joined: 13 Dec 2014 16:48

Re: WmDOT v13 [2014-03-10]

Post by wodencafe »

Hi, my WmDOT v 13 crashed, and told me to come to this page and report the error.

Code: Select all

dbg: [script] [14] [S] Your script made an error: parameter 1 has an invalid type 'null' ; expected: 'integer'
dbg: [script] [14] [S] 
dbg: [script] [14] [S] *FUNCTION [ToStringTiles1D()] minchinwebs_metalibrary-8/Array.nut line [570]
dbg: [script] [14] [S] *FUNCTION [Run()] wmdot-13/OpHibernia.nut line [406]
dbg: [script] [14] [S] *FUNCTION [Start()] wmdot-13/main.nut line [130]
dbg: [script] [14] [S] 
dbg: [script] [14] [S] [@ITERATOR@] 1
dbg: [script] [14] [S] [Tile] NULL
dbg: [script] [14] [S] [@INDEX@] 0
dbg: [script] [14] [S] [Temp] ""
dbg: [script] [14] [S] [Length] 2
dbg: [script] [14] [S] [ArrayLength] false
dbg: [script] [14] [S] [InArrayOfTiles] ARRAY
dbg: [script] [14] [S] [this] INSTANCE
dbg: [script] [14] [S] [Depot2] 2877462
dbg: [script] [14] [S] [Depot1] NULL
dbg: [script] [14] [S] [NumberOfBuoys] 0
dbg: [script] [14] [S] [loops] 2
dbg: [script] [14] [S] [SPFResults] ARRAY
dbg: [script] [14] [S] [WBCResults] true
dbg: [script] [14] [S] [WBCTries] 1
dbg: [script] [14] [S] [OldStarts2] INSTANCE
dbg: [script] [14] [S] [Ends2] INSTANCE
dbg: [script] [14] [S] [Starts2] INSTANCE
dbg: [script] [14] [S] [end] 2871319
dbg: [script] [14] [S] [start] 2881544
dbg: [script] [14] [S] [KeepTrying2] false
dbg: [script] [14] [S] [Ends] ARRAY
dbg: [script] [14] [S] [Starts] ARRAY
dbg: [script] [14] [S] [DockLocation] 2871320
dbg: [script] [14] [S] [BuildPair] ARRAY
dbg: [script] [14] [S] [KeepTrying] true
dbg: [script] [14] [S] [tick2] 17953
dbg: [script] [14] [S] [InIndustries] INSTANCE
dbg: [script] [14] [S] [@ITERATOR@] 1
dbg: [script] [14] [S] [CargoNo] 3
dbg: [script] [14] [S] [@INDEX@] 0
dbg: [script] [14] [S] [MyCargos] ARRAY
dbg: [script] [14] [S] [Produced] INSTANCE
dbg: [script] [14] [S] [MyIndustries] INSTANCE
dbg: [script] [14] [S] [tick] 17003
dbg: [script] [14] [S] [this] INSTANCE
dbg: [script] [14] [S] [Time] 16572
dbg: [script] [14] [S] [HQTown] 172
dbg: [script] [14] [S] [Debug_1] "/* v.13, r.121231 // r.27029 // 1961-9-4 start // 2048x2048 map - 1536 towns */"
dbg: [script] [14] [S] [Debug_2] "/* Settings: 0-0 - dl3 // OpDOT: 1 - 100 - 50 - 2 - 1 // OpHibernia: 1 */"
dbg: [script] [14] [S] [this] INSTANCE
dbg: [script] The script died unexpectedly.
That's the error I got.

This is with OpenTTD 1.4.4.

Please let me know if you need any more information.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

Thanks wodencafe. I'll look into it. It seems that WmDOT was trying to build a ship route and something failed...
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
trainrover
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 29 Nov 2014 23:23

Re: WmDOT v13 [2014-03-10]

Post by trainrover »

It's taken me forever to learn how to activate an ai. Wmdot interests me but none of the 4's worth (replicates) I've loaded is working, e.g., no construction cost appears within their balance sheets (the oldest ai's now 2 years old). The ai script debug panel indicates each of their listed libraries and attributes(?) as being loaded and linked up. What might I be doing wrong? Having read the readme when configuring the settings, what is a "DOT State", it makes no sense to me? No Atlas Size setting appeared, have the settings been revised in a subsequent update? Screenshot of one of their (identical) parameters panels shared here.
Attachments
aiprmtrs.png
aiprmtrs.png (47.62 KiB) Viewed 5109 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: WmDOT v13 [2014-03-10]

Post by Zuu »

May not be much of help, but when create a new random game with wmDOT AI (version 13), it will build as you see in its economy window. My wmDOT settings only differ from you in that it has operation Hibernia enabled. (that causes it to build a few money makers to not get bankrupt)

All settings except the first one (days to wait before AI starts) is custom settings provided by the AI. If it is not explained in the AI readme or in this thread, you will have to wait for the AI author to explain or you can dig into the source code of wmDOT.

Our difference can be explained by different OpenTTD settings, NewGRFs in use and even world generation parameters. I would recommend taking out any NewGRF you have active to see if it works better without. If you are still out of luck, post a save of a game you created here, which will then contain used settings except "client settings" (eg. GUI, your nickname, passwords etc.)
Attachments
Unnamed, 2nd Feb 1950.png
(71.47 KiB) Downloaded 3 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
trainrover
Transport Coordinator
Transport Coordinator
Posts: 283
Joined: 29 Nov 2014 23:23

Re: WmDOT v13 [2014-03-10]

Post by trainrover »

Plenty of newgrfs indeed plus I loaded the 4 mid-game. I'll see what its author might have to relate, plus I'd feel silly having somebody fuss over some savegame when..errrr..not yet having tried the ai out in a fresh game myself, thank you.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

@trainrover : first thanks you for your interest. Based on what you posted, I think WmDOT is still working through the start up phases, which can take a while, especially on bigger maps. When this is finished, it will display a line "The Great Link Up is Compete!" If a couple of game years go by and still nothing more has showed up on the debug screen, then something is probably stuck.

As for 'DOT State', those setting just change the AI's name in-game. WmDOT take inspiration (for naming anyway) from the American States' highway departments. They are usually called [state name] Department of Transportation, and abbreviated to [state abbreviation]DOT. So the Utah Department of Transportation becomes 'UDOT', the Alabama Department of Transportation becomes 'ALDOT', and so on.

The Atlas size setting will only show up if you have the Developer Tools turned on, but you probably would never need to change it, so no worries here.

'The minimal size of towns to connect' is the population threshold at which WmDOT considers towns 'important enough' to be connected. How many towns on your map have a population of over 500? If the answer is less than 2, then WmDOT thinks there is nothing to do at the moment. Try setting this to '0' and see if WmDOT will build some roads.

If you still can't get it to work, please feel free to post a savegame. They can provide a wealth of information to help figure out why something might not be working!

@Zuu : thanks for responding while I was on vacation. Glad to hear WmDOT is working well for you!
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
dol422
Transport Coordinator
Transport Coordinator
Posts: 310
Joined: 29 Dec 2015 20:06
Location: England

Re: WmDOT v13 [2014-03-10]

Post by dol422 »

When I use WmDOT, it only builds a road between two medium sized towns and doesn't do anything else. I don"'t know if it will do this with the setting operating Hibernia off, so will try and see if it works. I think it sidetracks for a few years to make some money.

Also, would cheating to give the AI money mean it doesn't do this, or will that have no effect on the AI at all?
Take a look at: http://www.tt-forums.net/viewtopic.php?f=47&t=74993
Why do it tomorrow when you can do it today
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

@dol422: If you were to upload your savegame here, I could give you a better answer. There could be a number of things at play.
  • How big are your other towns? WmDOT will only connect towns above a certain population (I think that lower limit defaults to a population of 100).
  • Are the big towns on different islands? WmDOT has a limit to how long a bridge it will build, and pathfinding between towns on seperate islands often takes longer. WmDOT will eventually timeout, but it won't do much in the meantime.
  • WmDOT might have run out of money, but this is unlikely. WmDOT won't keep much cash on hand, but you can look up WmDOT's finances and see if it's out of loan room.
  • Operation Hibernia might have hit a snag with the pathfinding between water industries. It's not very small about catching these issues. Eventually, WmDOT should go bankrupt, although that might take a very long time.
Do any of those sound like reasonable explanations to what you're seeing?
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
dol422
Transport Coordinator
Transport Coordinator
Posts: 310
Joined: 29 Dec 2015 20:06
Location: England

Re: WmDOT v13 [2014-03-10]

Post by dol422 »

They sound reasonable enough for my situation.
Attachments
WmDOT.sav
As far as I can see, it hasn't built anything yet (apart from it's HQ in Knutton). The map I am playing on is one big island with lots of water. The setting Operation Hibernia is on, though.
(11.23 MiB) Downloaded 116 times
Take a look at: http://www.tt-forums.net/viewtopic.php?f=47&t=74993
Why do it tomorrow when you can do it today
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: WmDOT v13 [2014-03-10]

Post by Sylf »

On a huge map with huge number of towns and industries, some AIs will take a long time to initialize. And some scripts need to re-initialize again when you resume the game from the .sav file later.
dol422
Transport Coordinator
Transport Coordinator
Posts: 310
Joined: 29 Dec 2015 20:06
Location: England

Re: WmDOT v13 [2014-03-10]

Post by dol422 »

Thanks for the quick reply. I'll try it on a smaller map size and see if its performance increases.
Take a look at: http://www.tt-forums.net/viewtopic.php?f=47&t=74993
Why do it tomorrow when you can do it today
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: WmDOT v13 [2014-03-10]

Post by MinchinWeb »

Sylf, you have basically found the issue. In my test, I downloaded dol422's savegame and started it on my computer. WmDOT eventually started building roads, but it took about 4 (in-game) years. As Sylf also points out, WmDOT 're-initializes' when you reload the savegame.

As well, the map you are playing on (2048x4096, about 10,000 towns) is HUGE. By way of comparison, the original Transport Tycoon had a map size of 256x256 (or 1/128 the size). WmDOT deals with large maps by picking the closest 30-50 towns and largely ignoring the rest of the map. Because of this, you could start about 200 instances of WmDOT and they would each play in their own little 'sandbox', and thus get roads all over the map (that said, OpenTTD only allows 15 AI's active at a time).

So keep playing, and in time, WmDOT will start making roads :)
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
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 12 guests