Bay 12 Games Forum

Please login or register.

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

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

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #15 on: April 22, 2008, 11:21:00 am »

Have you found out anything useful about world.dat during your examinations thereof?
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!

Derakon

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #16 on: April 22, 2008, 11:56:00 am »

Since I never got anything usefully uncompressed, no. There's a fair amount of information here which should still be accurate, though.
Logged
Jetblade - an open-source Metroid/Castlevania game with procedurally-generated levels

Goblin Dragoon 085

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #17 on: April 22, 2008, 04:28:00 pm »

I just run a view tests with $map_size = x

And it does currently not work for any value, except 257.
What happens is, that the script starts scanning and then stops at the first region, of the last horizontal line. The script terminates and no output is created.

So when I want to scan 17x17 it goes to 1x17 as expected and then terminates.

Logged

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #18 on: April 22, 2008, 04:51:00 pm »

Not here...I successfully tested it on any map size this afternoon. There was a small bug that it didn't scan the last line, but I will upload a new version tomorrow, where this is fixed.
I have no idea why it stopped...could you post the seed so I can try it too?
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!

Goblin Dragoon 085

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #19 on: April 22, 2008, 05:42:00 pm »

I upped the whole thing with the last map I tested. http://rapidshare.de/files/39202534/df_27_176_38c.rar.html

Anyway. I just realized, that it might be possible that the locator did not find any suitable regions because there are non on the tested maps (yep I tested it on 3 pocket maps, but maybe I just got unlucky). As far as I can grasp the script it does not check for embarkability and regions with magma and underground caves/rivers should be detected. So I am not sure if the scripted worked as intended or not.

By termination I meant, that the script just ends. I dont get any stop errors or any error message that you defined, for that matter. The script just executes and then ends, leaving no output.

Logged

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #20 on: April 23, 2008, 10:54:00 am »

I noticed a problem with the screenshot dll. It seems to take screenshots of empty (full back) or party drawn (just the tile background) screens sometimes. This means the tool will currently not find everything it should. I'm trying to circumvent the issue by taking multiple shots in a quick series to try and isolate any faulty shots.
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!

Ziusudra

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #21 on: April 23, 2008, 01:50:00 pm »

Wow, that is a huge amount of file access. Have you thought of running the script from a RAM drive? That should speed it up quite a bit.

Is there no way to check for a pattern without the screen shot?

Edit: Oh, and its bug 000656 □ [dwarf mode][interface][embark](Report) large default selection area confuses embark selector

[ April 23, 2008: Message edited by: Ziusudra ]

Logged
Ironblood didn't use an axe because he needed it. He used it to be kind. And right now he wasn't being kind.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #22 on: April 24, 2008, 04:10:00 am »

Good idea, Ziusudra...might try this out tomorrow. I have other problems now, though, because even with my 10-screenshot-average-workaround, the script still returns an inconsistent number of found locations...
Checking for the pattern without the screenshot is only possible, if you access and analyse world.dat (or the graphics buffer) directly. This is beyond my knowledge.

[ April 24, 2008: Message edited by: zagibu ]

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!

Goblin Dragoon 085

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #23 on: April 24, 2008, 08:47:00 am »

Hmm, I tested the current version a little bit more and found out that it does not run under 64bit vista. 32bitxp works fine though. Unforunately I cannot make out whether its vista or 64bit thats causing the troubles ^^
Logged

Ziusudra

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #24 on: April 24, 2008, 02:26:00 pm »

quote:
Originally posted by zagibu:
<STRONG>Checking for the pattern without the screenshot is only possible, if you access and analyse world.dat (or the graphics buffer) directly.</STRONG>
Actually, AutoHotKey scripts can pattern match without a screen shot. But using a RAM drive with AutoIt should be almost as fast.

It sounds like its taking the shot before DF has finished drawing the screen.

AutoIt3 claims Vista and 64bit support, so its probably captdll.

Logged
Ironblood didn't use an axe because he needed it. He used it to be kind. And right now he wasn't being kind.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #25 on: April 25, 2008, 05:06:00 am »

quote:
Originally posted by Ziusudra:
<STRONG>Actually, AutoHotKey scripts can pattern match without a screen shot.</STRONG>

What are they matching against? The graphic buffer? That would indeed speed things up. Do you have an example of the technique?
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!

Ziusudra

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #26 on: April 26, 2008, 01:36:00 am »

It compares BMP files to the active window buffer.
code:
    FindImage(ImageX, ImageY
           , LocalRight, LayersBottom, RegionRight, BiomesBottom
           , "Embark.bmp")

That looks for Embark.bmp in the region bounded by the values on the second line and returns the coordinates where found in the variables on the first line.  (All coordinates are relative to the absolute top-left of the window, including any border.)

My script here only works in windowed mode, though I didn't bother trying to find out why it doesn't work in fullscreen.

Note that I GPLed my script, so you can use any part of it.  I've enough free time right now to either play DF or update the script and lately I've chosen to play. (Edit: Of course, the longer I choose to play, the more updating the script will need if and when I get around to it.)

FindImage is actually my own wrapper function to handle errors, debugging and differences in window borders:

code:
FindImage(ByRef X, ByRef Y, Left, Top, Right, Bottom, File)
{
 global Debug, XOffset, YOffset, SearchErrorMessage
 ImageSearch, X, Y
            , Left + XOffset, Top + YOffset
            , Right + XOffset, Bottom + YOffset, %File%
 If ErrorLevel = 2
 { ; The image may be missing or corrupt.
   MsgBox %SearchErrorMessage% %File%.
   FileAppend, Could not conduct search for %File%`
               , exited script.`n`n
             , log.txt
   If Debug
     FileAppend, %X%`,%Y%`,%Left%`,%Top%`,%Right%`,%Bottom%`,%File%`
                 ,Offsets:%XOffset%`,%YOffset%.`n`n
               , debug.txt
   ExitApp
 }
; The rest of this is for emergency debug only because it
; floods.
; Else If ErrorLevel = 1
; {
;   If Debug ; TMI
;     FileAppend, Exiting FindImage with ErrorLevel 1 for %File%.`n
;               , debug.txt
;   ErrorLevel = 1 ; This is only needed with the debug lines.
;   Return
; }
;     Searched but did not find image.  The DF window also might
;     have lost focus or the image file doesn't match.
; If Debug ; TMI
;   FileAppend, Exiting FindImage with %X%`,%Y% for %File%.`n
;             , debug.txt
; ErrorLevel = 0 ; This is only needed with the debug lines.
 Return ; The X & Y variables passed in now
}        ; contain the pixel coordinates we found.

[ April 26, 2008: Message edited by: Ziusudra ]

Logged
Ironblood didn't use an axe because he needed it. He used it to be kind. And right now he wasn't being kind.

zagibu

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #27 on: April 26, 2008, 03:43:00 am »

Heh, damn it, I should have given a better look at AutoHotKey. Would have saved me a lot of time. Oh, well...time to learn yet another scripting language.
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 #28 on: May 25, 2008, 11:57:00 am »

I've finally implemented an algorithm that checks if the found features are within an embark rectangle of user-definable size: http://www.geocities.com/qrphome/df_asl_v0.4.zip

The next thing I'll try to implement is embarkability-check.

BTW: The reason why I'm still using AutoIt rather than AutoHotkey is because the latter has no proper support for arrays and is generally less powerful than AutoIt. Also, in my testing, the FindImage function wasn't 100% reliable...the number of found sites was very inconsistent on larger maps (5% error margin).

[ May 25, 2008: Message edited by: zagibu ]

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!

Axle Gear

  • Bay Watcher
    • View Profile
Re: DF Auto Site Locator
« Reply #29 on: May 25, 2008, 06:32:00 pm »

I'm getting tired of having to install .NET and AutoIt and so many other tools.

Why can't people make bloody executeables anymore!?

Logged
Pages: 1 [2] 3 4 ... 6