Page 1 of 2
trouble with pickDroidStructLocation
Posted: 02 Dec 2011, 14:58
by NoQ
While proceeding with my AI experiments, i think i ran into a situation when
pickDroidStructLocation(...) returns an invalid location.
The exact thing that happens is that the AI bot attached below doesn't start doing anything when run on my "
Blizzard" map at position #2 (white), no bases mode, so i'm asking for a help in investigating this.
The AI works well on any other map i tested, and on any other position on this map. Also, slightly changing initial position of trucks makes the AI work again. I believe the reason is that
pickDroidStructLocation(...) function returns an invalid location of the research lab (this AI always starts with a research lab).
Nexus AI also behaves badly on this position: instead of building the base, it starts capturing oil derricks. But i forbid my AI to start capturing oil derricks so early, so it just hangs.
If in
grabTrucksAndBuild(...) function (which doesn't differ significantly from the one in Nexus AI) i replace
Code: Select all
pickDroidStructLocation(mydroid, bstats, ref bx, ref by, me, maxBlockingTiles)
with
Code: Select all
pickDroidStructLocation(mydroid, factory, ref bx, ref by, me, maxBlockingTiles)
(that is, "look for a place suitable for factory, but build a lab on this place instead"), it starts working again (even though it behaves weirdly later).
Re: trouble with pickDroidStructLocation
Posted: 02 Dec 2011, 23:11
by lav_coyote25
your using flame for the map making?
Re: trouble with pickDroidStructLocation
Posted: 02 Dec 2011, 23:25
by NoQ
Yep.
Hmm. You think this might happen because of something similar to
that issue? Or...?
Re: trouble with pickDroidStructLocation
Posted: 03 Dec 2011, 03:07
by lav_coyote25
NoQ wrote:Yep.
Hmm. You think this might happen because of something similar to
that issue? Or...?
yes. it showed up on the old original edit world way back when... i thought that was gone. seems to have surfaced again.

very annoying thing. back then i had to go in and correct about 8 of my maps... oh well... such is life.
Re: trouble with pickDroidStructLocation
Posted: 03 Dec 2011, 09:46
by NoQ
But this time, the symptoms are different, aren't they? (eg., no unbuildable oils are present). Have you actually checked this particular map? May i ask you to?

Re: trouble with pickDroidStructLocation
Posted: 03 Dec 2011, 19:50
by Per
I can't reproduce. It successfully builds 2 factories, 2 reslabs and 1 hq before running out capturing oil here.
I have added some warning messages to the log when such things happen, perhaps that can help us track down the offending bug.
Re: trouble with pickDroidStructLocation
Posted: 03 Dec 2011, 20:54
by NoQ
That's strange. 100% reproducible on my machine. Retried. I can make a video if necessary.
Are you sure you're picking exactly position 2 (white by default) of this particular map and exactly version 0.3 of the AI?
By the way, here is what i
sometimes get with v0.4, which tries different (random; that's why "sometimes") locations for the lab. It sometimes places the lab on top of a truck. This placement of the lab is still a result of the same pickDroidStructLocation call (with different bx and by though).
upd: Also, i'm using master-20111107 snapshot. Probably something has already been fixed since then?

Re: trouble with pickDroidStructLocation
Posted: 04 Dec 2011, 01:35
by Per
Yeah, put your AI ver 0.3 on pos 2, no problem. Video won't help - I don't doubt that it is happening
You can try with the next build of master, then it should dump some interesting things in the log, if you play with --debug=script.
Re: trouble with pickDroidStructLocation
Posted: 04 Dec 2011, 16:57
by NoQ
I've just tried warzone2100-master-20111203-194758-695fe5f nightly. That's all i get with --debug=script: (the AI still doesn't start)
Code: Select all
info |07:00:48: [main] mod_mp (mcrbot-0-3.wz) is enabled
script |07:01:02: [eventReset] 1 contexts still allocated at reset
script |07:01:02: [scriptSetStartPos] Setting start position 0 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 1 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 2 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 3 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 4 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 5 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 6 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 7 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 8 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 9 to (0, 0)
script |07:01:02: [scriptSetStartPos] Setting start position 10 to (0, 0)
script |07:01:24: [scriptSetStartPos] Setting start position 1 to (12480, 960)
script |07:01:24: [scriptSetStartPos] Setting start position 2 to (15296, 12480)
script |07:01:24: [scriptSetStartPos] Setting start position 3 to (3776, 15296)
script |07:01:24: [scriptSetStartPos] Setting start position 0 to (960, 3776)
script |07:01:24: [scriptSetStartPos] Setting start position 1 to (12416, 1152)
script |07:01:24: [scriptSetStartPos] Setting start position 2 to (15104, 12416)
script |07:01:24: [scriptSetStartPos] Setting start position 3 to (3840, 15104)
script |07:01:24: [scriptSetStartPos] Setting start position 0 to (1152, 3840)
script |07:01:24: [scrGetPlayer] Initialized player 2, starts at position (15104, 12416), max 4 players
script |07:01:24: [scrGetPlayer] Initialized player 0, starts at position (1152, 3840), max 4 players
Re: trouble with pickDroidStructLocation
Posted: 04 Dec 2011, 23:56
by lav_coyote25
NoQ wrote:But this time, the symptoms are different, aren't they? (eg., no unbuildable oils are present). Have you actually checked this particular map? May i ask you to?

could you do me a huge favor? please send me the .LND file of your map. if there are mistakes in it, editworld32beta will show them to me. i have tried to use flame - it just will not work for me. thanks.
Re: trouble with pickDroidStructLocation
Posted: 05 Dec 2011, 10:52
by NoQ
Like that?

Re: trouble with pickDroidStructLocation
Posted: 05 Dec 2011, 17:43
by lav_coyote25
thanks
Re: trouble with pickDroidStructLocation
Posted: 11 Jan 2012, 13:28
by NoQ
I think i found it. Both X and Y coordinates returned by pickDroidStructLocation must be increased by 1 map tile before passing to orderDroidStatsLoc.
Re: trouble with pickDroidStructLocation
Posted: 11 Jan 2012, 16:31
by NoQ
It's different with cyborg factories though.
Re: trouble with pickDroidStructLocation
Posted: 11 Jan 2012, 16:42
by Per
Because the values returned are not centered, but give you a corner? Or the other way around, but opposite of what the second function expects.
Just guessing. Don't have source at hand ATM.