Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6

Author Topic: DF Auto Site Locator  (Read 7732 times)

Haven

  • Bay Watcher
  • Studiously Avoidant
    • View Profile
Re: DF Auto Site Locator
« Reply #45 on: June 24, 2008, 12:45:44 pm »

Hm... Is it possible to have the program draw off the font/tileset in use for it's matching? Might be a useful feature.
Logged

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #46 on: June 24, 2008, 03:31:40 pm »

Hm... Is it possible to have the program draw off the font/tileset in use for it's matching? Might be a useful feature.
You mean, the current pattern it is trying to match? I'm not sure...it could be possible, but the matching on one region is actually pretty fast, so I'm not sure if human eyes could even follow it.
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #47 on: June 29, 2008, 11:49:35 am »

New version lets you search for any magma (magma vent OR magma pool) and any cave water (cave river OR cave lake). You can also specify the old behaviour (that tries to find both).

http://www.geocities.com/qrphome/df_asl_v0.4.6.zip

It got a bit slower, because it can't just skip to the next tile if there is no magma vent anymore. I also tried to optimize it so that if you specify mountain-only features, it skips all non-mountaineous tiles. But there is no quick way of determining if a world map tile has a mountain on it or not. I first thought the "Mountain" region description would work, but if a majority of the tiles in the embark rectangle is non-mountaineous, the description changes to "Badlands", "Temperate Conifer Forest" or whatever tiles form the major part.

Next big thing I'll start is scanning for stone layers. Before this, I might include scanning for river tiles on the region map.

There is a small bug in DF, which can place the default embark rectangle over dwarven cities, and thus my skript might skip such world tiles without evaluating them, because the default embark rectangle is unembarkable in this case (which is normally a guarantee, that the whole region is unembarkable).
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Haven

  • Bay Watcher
  • Studiously Avoidant
    • View Profile
Re: DF Auto Site Locator
« Reply #48 on: June 29, 2008, 02:04:57 pm »

Hm... Is it possible to have the program draw off the font/tileset in use for it's matching? Might be a useful feature.
You mean, the current pattern it is trying to match? I'm not sure...it could be possible, but the matching on one region is actually pretty fast, so I'm not sure if human eyes could even follow it.

I didn't mean to draw it on the screen (though that would be fun). I meant that it would parse the specified image in order to find the images used to display certain features in different tilesets, thus elminating the original-tileset only restriction. Though, given that the utility is only for world-stage selection, you could just use an alt-install of DF with the regular set.
Logged

Logical2u

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #49 on: June 29, 2008, 02:28:01 pm »

I can't get this to work.

Followed the instructions to the letter, even tried everything being in one folder and everything being in seperate folders in the DF installation.

Working on a 17x17 pocket world, with only Adamantine set to yes and everything else set to ignore. Gave the script world dimensions of 15x15, with embark dimensions of max area 256, length 16.

The script is enlarging the window, and it's going through all 15x15 world tiles that it's supposed to... but it's not even enlarging the embark window at all, and it's definitely not writing anything to the locations.txt folder (which is getting larger on spaces and line-breaks alone)

I also just checked it on both magmas yes, but allow either magma (this world seems to have a lot of magma) and it again returned no locations.

Edit: Changed the init settings to a default embark window of 15x15, and changed the YES back to adamantine, still no writing to the locations folder except spaces (and there are at least 10 embarkable mountain tiles, with adamantine, on the map).
« Last Edit: June 29, 2008, 02:38:51 pm by Logical2u »
Logged
This account is defunct - please contact me through other means.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #50 on: June 29, 2008, 03:19:51 pm »

@ Haven: I see what you mean. But yeah, as you mentioned, just use a second DF install.

@ Logical2u: You should not change the embark window. Could you please post your folder structure and your settings for the global script values?
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Logical2u

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #51 on: June 29, 2008, 03:40:37 pm »

Well, I just reset everything to default settings.

There's a DF folder named "Autodwarf Test" (on my desktop if that matters). Inside this is all the stuff DF needs to run. There's the regional prospector folder in there, with source code and the .exe of prospector in that folder. Also in the DF folder is the hotkey script folder, with script and its files (I think they're bmps or something according to your script? Which says to me, bitmaps, but they're not showing up as image files...).

Working on a 17x17 world, with script's world dimensions set to those values, adamantium set to yes, all other features set to ignore.

Not turning up anything in the locations folder.
Logged
This account is defunct - please contact me through other means.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #52 on: June 29, 2008, 05:04:30 pm »

Hmmm, should be alright. Can you post the seed, so I can test it tomorrow? Also, I guess you don't have any custom tilesets installed, right? Can you post a screenshot of the embark screen showing a region with adamantium?
The image files are 32bit bitmaps of the single tiles, without the bitmap header information. You can open them with a hex editor (set bytes per line on 320, then you can see the pattern in the ascii output).
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Logical2u

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #53 on: June 29, 2008, 05:28:29 pm »

No custom tilesets, fresh install, of course, I'll edit this post with a screen shot and the seed tomorrow.


Edit: The world is in the spoiler.
Spoiler (click to show/hide)

Any chance the error is due to the native resolution of the monitor stretching the pixels?
« Last Edit: June 30, 2008, 06:11:26 pm by Logical2u »
Logged
This account is defunct - please contact me through other means.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #54 on: July 01, 2008, 12:54:03 am »

No, the screenshot is taken before the image is sent to the monitor. If you have regular 800x600 as DF fullscreen settings and the standard font, then it should work.
I have no idea what could be wrong. I'll see if I can check the world on my computer in approx 4 hours.
Oh, are you using Vista? Because I have only tested it on XP so far, and IIRC, someone else already mentioned it doesn't work on Vista. Probably has to do with how the screenshots are taken.
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #55 on: July 01, 2008, 01:34:01 pm »

Sorry, it took me a bit longer than 4 hours. I couldn't go home at noon, but I went to my parent's home this evening, and they also got a computer ;).

Ok, I've checked your world on my father's computer. The script wouldn't work well, at first. It did find adamantium, but the coordinates were all wrong, and you could see it sometimes skip a tile during the scan.
So, I've also placed the step_delay BEFORE sending the right/left/down arrow keys, and now it works. If you still notice wrong coordinates, just increase the step_delay, and it should work. I had to set it at 50ms on a P4 2.4 GHz.
This is the output when scanning for adamantium:
Code: [Select]
1 14 / 1
2 14 / 2
3 14 / 3
4 15 / 4
5 14 / 4
6 15 / 5
7 15 / 6
8 14 / 7
9 15 / 7
10 14 / 8
11 13 / 9
12 14 / 9
13 13 / 10
14 13 / 11
15 13 / 12
16 13 / 13
17 13 / 14
18 14 / 15
19 14 / 16
20 14 / 17
As you can see, it finds all tiles containing adamantium, except the one with a dwarven city on it (13/15). This has to do with a bug in DF, that places the standard embark rectangle on cities, sometimes (which are not embarkable).

If you still can't find ANY adamantium with the script, I have no idea how to help you further.

This should already contain the right values for you (maybe you have to increase the step delay, if you have a slower processor): http://www.geocities.com/qrphome/df_asl_v0.4.7.zip
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Logical2u

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #56 on: July 01, 2008, 01:58:15 pm »

XP Service pack three on a Core 2 Duo E6400.

The latest version still failed to work...

 I can think of three possible explanations: either it's writing the data incorrectly to locations.txt, it's getting the wrong symbols for the hidden stuff, or it's not screen capturing properly.

I still am having no luck getting it to properly run, I even attempted compiling it and running that to no success.
Logged
This account is defunct - please contact me through other means.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #57 on: July 01, 2008, 03:12:56 pm »

If you know your way around scripting, you can comment out the first few for loops (it's already prepared...just remove the ; in front of the #comments-start and #comments-end) and "uncomment" the part where it says scan a single world tile (insert the ; in front of the #comments-start/end that enclose this block). Then on DF embark, go to a tile with adamantium and run the script. If it says "nothing" in the text file, then it couldn't find anything. We can then try to let it output it's screenshots and make it a bit more talkative to see what it does.
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!

Logical2u

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #58 on: July 01, 2008, 03:27:52 pm »

Well, I am now getting it to output nothing (which is better than blank lines)... but still no luck on detecting anything. I'm pleased it's actually saying something at this point though.
Logged
This account is defunct - please contact me through other means.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #59 on: July 02, 2008, 01:56:22 am »

Ok, keep the script this way, but replace the whole "Func scanMap()" block (it's long...make sure to replace everything until you see the first "EndFunc") with this one, then go again to a tile with adamantium and run the script:
Code: [Select]
Func scanMap()

;#comments-start

; Check for embarkability first

If Not checkPattern($embarkability, 200, 552, 210, 576) Then

notifyUser("Info", "Region is not embarkable")
Return False

EndIf

;#comments-end

; Now check for regional prospector tiles as selected in global settings

$pass = True

; Prepare the positional array

$pos = 0

; Look for adamantium

If Not($adamantium_feature = "ignore") AND ($pass = True) Then

notifyUser("Info", "Entered into adamantium check branch")
$found = findPattern($adamantium_pattern, $features_found, 1)

If $found > 0 Then

notifyUser("Info", "Adamantium found")
$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

If $adamantium_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

Return False

EndIf

Else

If $found > 0 Then

Return False

Else

$pass = True

EndIf

EndIf

EndIf

; Look for chasms

If Not($chasm_feature = "ignore") AND ($pass = True) Then

$found = findPattern($chasm_pattern, $features_found, 0)

If $found > 0 Then

$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

If $chasm_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

Return False

EndIf

Else

If $found > 0 Then

Return False

Else

$pass = True

EndIf

EndIf

EndIf

; Look for magma vents

If Not($magmavent_feature = "ignore") Then

$found = findPattern($magmavent_pattern, $features_found, 0)

If $found > 0 Then

$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

If $magmavent_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

$pass = False

EndIf

Else

If $found > 0 Then

$pass = False

Else

$pass = True

EndIf

EndIf

EndIf

; Look for magma pools

If Not($magmapool_feature = "ignore") AND Not(($magma_combination = "both") AND ($pass = False)) Then

; If we don't care what kind of magma we find, put found tiles of vents and pools in the same array (necessary because of recursive checkDistance function)

If ($magma_combination = "any") AND Not($magmavent_feature = "ignore") AND ($found > 0) Then

$last_found = $found

$last_features = $features_found

$found = findPattern($magmapool_pattern, $features_found, 0)

If $found > 0 Then

For $cell = 0 To $last_found - 1

$features_found[$found + $cell] = $last_features[$cell]

Next

$features_found[$found + $last_found] = -1

$positions[$pos - 1] = $features_found

EndIf

Else

$found = findPattern($magmapool_pattern, $features_found, 0)

If $found > 0 Then

$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

EndIf

If $magmapool_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

If ($magma_combination = "any") AND ($pass = True) Then

$pass = True

Else

Return False

EndIf

EndIf

Else

If $found > 0 Then

Return False

Else

$pass = True

EndIf

EndIf

EndIf

If $pass = False Then

return False

EndIf

; Look for cave lakes

If Not($cavelake_feature = "ignore") AND ($pass = True) Then

$found = findPattern($cavelake_pattern, $features_found, 0)

If $found > 0 Then

$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

If $cavelake_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

$pass = False

EndIf

Else

If $found > 0 Then

$pass = False

Else

$pass = True

EndIf

EndIf

EndIf

; Look for cave rivers

If Not($caveriver_feature = "ignore")  AND Not(($cavewater_combination = "both") AND ($pass = False)) Then

; If we don't care what kind of cavewater we find, put found tiles of lakes and rivers in the same array (necessary because of recursive checkDistance function)

If ($cavewater_combination = "any") AND Not($cavelake_feature = "ignore") AND ($found > 0) Then

$last_found = $found

$last_features = $features_found

$found = findPattern($caveriver_pattern, $features_found, 0)

If $found > 0 Then

For $cell = 0 To $last_found - 1

$features_found[$found + $cell] = $last_features[$cell]

Next

$features_found[$found + $last_found] = -1

$positions[$pos - 1] = $features_found

EndIf

Else

$found = findPattern($caveriver_pattern, $features_found, 0)

If $found > 0 Then

$features_found[$found] = -1

$positions[$pos] = $features_found

$pos += 1

EndIf

EndIf

If $caveriver_feature = "yes" Then

If $found > 0 Then

$pass = True

Else

If ($cavewater_combination = "any") AND ($pass = True) Then

$pass = True

Else

Return False

EndIf

EndIf

Else

If $found > 0 Then

Return False

Else

$pass = True

EndIf

EndIf

EndIf

; Set the end delimiter in the positional array

$positions[$pos] = -1

; Look for distance between tiles

If $pass = False Then

Return False

Else

Global $erX1 = 255

Global $erY1 = 255

Global $erX2 = -1

Global $erY2 = -1

;Return checkDistance(0)

Return True

EndIf

EndFunc
Logged
99 barrels of beer in the pile
99 barrels of beer!
If some dwarves know the way to the pile
0 barrels of beer in the pile!
Pages: 1 2 3 [4] 5 6