trouble with pickDroidStructLocation

For AI and campaign script related discussions and questions
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

trouble with pickDroidStructLocation

Post 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).
Attachments
wz2100-20111202_165453-Blizzard-T1.jpg
mcrbot-0-3.wz
(28.62 KiB) Downloaded 235 times
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: trouble with pickDroidStructLocation

Post by lav_coyote25 »

your using flame for the map making?
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post by NoQ »

Yep.
Hmm. You think this might happen because of something similar to that issue? Or...?
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: trouble with pickDroidStructLocation

Post 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. :3 very annoying thing. back then i had to go in and correct about 8 of my maps... oh well... such is life.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post 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? :oops:
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: trouble with pickDroidStructLocation

Post 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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post 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? :hmm:
Attachments
wz2100-20111203_225821-Blizzard-T1.jpg
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: trouble with pickDroidStructLocation

Post 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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post 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
User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: trouble with pickDroidStructLocation

Post 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? :oops:
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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post by NoQ »

Like that? :)
Attachments

[The extension lnd has been deactivated and can no longer be displayed.]

User avatar
lav_coyote25
Professional
Professional
Posts: 3434
Joined: 08 Aug 2006, 23:18

Re: trouble with pickDroidStructLocation

Post by lav_coyote25 »

thanks
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post 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.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: trouble with pickDroidStructLocation

Post by NoQ »

It's different with cyborg factories though.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: trouble with pickDroidStructLocation

Post 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.
Post Reply