Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 9 10 [11] 12 13 ... 17

Author Topic: Dwarf Fortress for the BLind: Advice sought  (Read 57072 times)

Sanctume

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #150 on: April 13, 2016, 04:57:42 pm »

Some high level concepts, idea.

DF announces "a vile force of darkness has arrived."

App 1, call it "Make Log Source."  Voice command: Make Log Source.  This would be an executable that queries information via dfhack.
Some example function, unit screen for those marked with "Invader" title.
The initial siege will have at least 1 enemy on the map. 
Or a more simple example is when a FB shows up. 
Normally, I can zoom into the announcement.  k over the enemy, and see the description. 
If a script in dfhack can do that and append to an external file with: x, y, z position, name, description. 
Let's call this external file "Log Source"

App 2, call it "Parse Log Source." Voice command: Parse Log Source.  This will be dfhack dependent with its own database.
This will read the info from the file "Log Source" and add to or update its database.

Example:
Urist, title militia commander, last known location is x,y,z = at room 2 bedroom.  Latest position is at the wagon. 
Bax, title goblin bowman, new entry, location is 1,1,1 = top left of map?
So doing it this way, you don't need to read / interpret the df screen when you probably pick and choose which entity you are interested in that shows up in the unit screen. 
In this case an invader or Uninvited guest.




zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #151 on: April 13, 2016, 05:03:31 pm »

Yeah, something like tail -f was what I was thinking too. I admit that piping it through a separate audio command hadn't occurred to me, though it makes sense. :)

Thanks for looking into this.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #152 on: April 13, 2016, 05:18:55 pm »

I think mifki has already done some of this abstraction already while creating the iOS remote.  My understanding is that it re-creates the content that would show up on screen from DFHack-like sources, rather than reading the screen.  This is very different from mifki's other, better known tool called Text Will Be Text which does impressive feats with the on-screen graphics.

Dwarf Fortress's on-screen cursor is normally not persistent, putting an invalid value in the coordinates when there is no need for a mark on the screen.  But a DFHack plugin called stable-cursor remembers where the cursor was and puts it back there the next time an on-screen cursor is needed, assuming you have not scrolled away from that part of the map.

A simplified version of stable-cursor could keep the on-screen cursor centered on the screen at all times, maintaining a "cursor" position even when the cursor would not normally be displayed.  Keeping things centered would help with any future rendering tools that come later, whether they are audible or Braille.  It also allows for simple terminal commands like "where am I" and "jump to" and "bookmark".  The bookmarks could be hotkey locations or notes; I'm not sure which would work better.

where am i
25, 45, 105. Open space.
go to 25 45 104
where am i
25, 45, 104. Granite floor.
bookmark 5
go to bookmark 2
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #153 on: April 13, 2016, 05:23:19 pm »

Ahh, I wondered what exactly Stable Cursor did. :) Thanks for clarifying that. I've occasionally seen an X, somewhere on screen. I take it that's DF's indicator for something.

I think the mini-map just confuses things, because I can't tell where the main one ends and the mini-map starts. So I'm going to probably want to get rid of it using Tab, I imagine.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #154 on: April 13, 2016, 08:07:58 pm »

Yeah, the "X" is DF's cursor. Dirst, the issue is that the terminal cursor (the one that's used when typing commands in the terminal) jumps around in PRINT_MODE:TEXT, depending on where the last character was drawn to the screen.

Also, I could be wrong, but I'm pretty sure mifki's iOS remote is just streaming (part of) the map data. Of course, all of the menus are obtaining data through DFHack, but that's generally pretty easy to do with DFHack (an interface is harder).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #155 on: April 13, 2016, 08:15:04 pm »

A "Really Stable Cursor" is little more than an array of three integers.  Keeping the map centered on the virtual cursor is the hard part.  Sounds like the terminal cursor whips around like mad when the map scrolls, but (re)printing the center character after each update will force the terminal cursor to stay where it is expected.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

lethosor

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #156 on: April 13, 2016, 09:59:22 pm »

To be more clear, the terminal cursor follows the last changed character drawn to the screen. Redrawing the same character won't move it, and that character that the cursor doesn't even have to be on the map - it just has to have changed since the last frame. In my case, it's often the FPS counter.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #157 on: April 13, 2016, 10:04:04 pm »

To further confuse this issue, ncurses, the library text-mode DF uses, is designed to optimize redraws so the screen isn't totally redrawn unnecessarily. Only parts of the screen which change are redrawn. The downside to this is that my screen reader doesn't read anything which is "identical," between frames. That's why I run into trouble using the default Look command, because often the same tile information is present and isn't properly read.

For what it's worth, Cataclysm, another roguelike I've managed to get some accessibility into recently, decided to force redraw the entire screen each turn. That helped quite a bit all on its own. :)
Logged

zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #158 on: April 14, 2016, 12:49:05 pm »

Sorry for the double post. :)

I decided to try DFHack under OS X today, and the probe command has proven helpful, if more than a bit verbose. I was using standard print_mode for a change, and only able to do anything because I memorized key sequences. This isn't all that different from the way some blind gamers play fighting games, I gather.

I think I understand now that the game only really has a selected tile in certain modes. The thing which text mode could theoretically give me that standard can't yet is a sense of what's happening when I'm not in one of them. I think a lot of the appeal seems to come from the combination of watching the little dwarves and the text announcements? :) At any rate, it's been interesting thus far, if nothing else.
Logged

Sanctume

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #159 on: April 14, 2016, 01:23:02 pm »

The ASCII graphics plus that announcements and battle reports try to convey that story unfolding. 

I would see a goblin ascii character in one spot, then an arrow moving towards a dwarf, and the arrow disappears in the dwarf's spot. 
There may be some sound effect to that. Looking at it, gives a general picture of a goblin shooting a dwarf with an arrow and it seems to hit the dwarf. 

Pressing R will open the report, and I still have to find the battle report for the goblin shooting an arrow; or the battle report for the dwarf being shot by the arrow. 
Pressing enter on the report will give a verbose text of the battle.  If the arrow punctures the liver.  If the dwarf pulls out the arrow out, and falls unconscious.

The issue of following the battle of many units is figuring out who attack whom. 

All Goblin Bowman will be describes as Goblin Bowman. 
But Bax the Goblin Bowman will have a battle report from his perspective. 

Likewise, the default titles for dwarves show up.  Urist the Recruit will be in the reports as Goblin Bowman strikes the Recruit in the lower body, piercing the liver.
Without custom titles, it gets hard following the battle reports after the fight. 

zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #160 on: April 14, 2016, 06:29:40 pm »

So I made a couple of interesting discoveries today, at least one of which is semi-related to DF accessibility.

If I set Speakup, my text-mode Linux screen reader, to "highlight tracking," one of a few ways it can handle the cursor, it seems to keep relatively close to the position of the selected tile when doing look/designate/whatever. Knowing that selected tile is indicated by an "X," helps. It's not quite enough to be confident in what I'm doing, but it's better than it was.

I've also discovered a  way to send things to the speech synthesizer directly, bypassing Speakup's character handling. If you write Unicode into /sys/accessibility/speakup/synth_direct, it will be spoken by the synthesizer, even if it's outside of the 0 .. 255 range. This isn't as helpful as it could be, if only because I don't know of a way to use this direct processing all the time.

Of course, this is only tangentially related to DF, per se. Still, I figured it was worth mentioning here because, say, a DFHack script might be able to send log text directly to the synthesizer someday. I don't know. :)
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #161 on: April 14, 2016, 06:37:05 pm »

Maybe if you wrote to the file on the fly?
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

zkline

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #162 on: April 15, 2016, 01:14:36 pm »

That sounds good in theory. It strikes me that we don't necessarily need to write the Unicode characters themselves so much as what they represent. If anything, writing "smiley face," would require me to remember that a smiley face is a dwarf.

I imagine the log file aspect lethosor is looking into would probably work similarly, getting as much of the underlying data as possible via DFHack. THere's no right way to tackle something like this. My day job is accessibility and usability testing, but I'm afraid the Web Content Accessibility Guidelines aren't super helpful here. ;)
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #163 on: April 16, 2016, 02:25:28 am »

Hi zkline, I went ahead and built that Where-Am-I and bookmark thing I described.  This post is the instructions, and the next post has the Lua scripts inside "code" blocks.
The first block of code should be saved in your DF folder under /raw/scripts/bookmark.lua
The second one in /raw/scripts/goto.lua
The third one in /raw/scripts/whereami.lua
Please let me know if there is a more convenient way to get the scripts to you.  If this works and is helpful, I'll package it as a proper mod or ask the DFHack devs if they want to include these in the core distribution.

bookmark.lua
This script defines, updates and deletes persistent bookmarks on the map.  A bookmark may have almost any single-word string as its name, but numbers are not recommended.  Bookmark also includes a calibration command because I was unable to find a way to reliably read the dimensions of the on-screen map.

bookmark help
Prints a short summary of bookmark commands.

bookmark calibrate
Issue this command while the cursor is in the middle of the screen.  The best time to do this is immediately upon loading the fort, and pressing 'k'.  This will let the mod translate between "top left corner of the screen" and "center of the screen."

bookmark list
Lists all current bookmarks, if any.

bookmark drop foo
Deletes a bookmark named foo.

bookmark clear all
Deletes ALL bookmarks.  Note the space between "clear" and "all" as a safety feature.

bookmark foo
Creates or updates the bookmark named "foo" at the current cursor location.  If the cursor is not present, and calibration has been performed, the bookmark will be set as the center of the on-screen map.

goto.lua
This script will move the map (and cursor if it is present) to a specific location.  Note that it cannot function unless "bookmark calibrate" has been performed.  The goto script has two modes: bookmark and coordinates.

goto help
Prints a short summary of the goto commands.

goto foo
Moves the map to the bookmark named foo, if it exists.

goto # # #
Moves the map to the specified X, Y, Z coordinates.

whereami.lua
This script reports your current location as X, Y, Z coordinates.  This always works if the cursor is present, otherwise it depends upon "bookmark calibrate" to determine the center of the on-screen map.  whereami will also report if the current location is recorded as a bookmark.

Known issues:
This version has minimal error checking.  For now, avoid jumping too close to the edge of the embark area.  I'm not sure if the graphical glitches are due to the core game, or to some other DFHack module I happen to be running.
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: Dwarf Fortress for the BLind: Advice sought
« Reply #164 on: April 16, 2016, 02:26:33 am »

Lua code:

Code: (bookmark.lua) [Select]
-- bookmark script v1.00
-- Set and clears persistent bookmarks on the fort map.
-- Enter "bookmark help" for a list of reserved names.

local args = {...}

local bookmarks = dfhack.persistent.get_all("BOOKMARK",true)
local calibration = dfhack.persistent.get("_BOOKMARK")

if args[1] == "help" then
print([[bookmark.lua
Enter "bookmark foo" to create a bookmark named "foo" at the current location.
Any one-word string may be used except the following reserved words:
"bookmark help" prints this command summary.
"bookmark calibrate" sets the cursor location as the center of the screen.
"bookmark list" prints a list of existing bookmarks.
"bookmark drop foo" erases the bookmark named "foo".
"bookmark clear all" erases all current bookmarks, note the space between "clear" and "all".
]])

elseif args[1] == "list" then
if bookmarks then
for _, bookmark in ipairs(bookmarks) do
print(bookmark.value .. ":  " .. bookmark.ints[1] .. "  " .. bookmark.ints[2] .. "  " .. bookmark.ints[3])
end
else
print("No bookmarks defined.")
end

elseif args[1] == "clear" and args[2] == "all" then
if bookmarks then
local count = #bookmarks
for _, bookmark in ipairs(bookmarks) do
bookmark:delete()
end
print("Deleted " .. count .. " bookmarks.")
else
print("No bookmarks are defined, so no action taken.")
end

elseif args[1] == "calibrate" and not args[2] then
local pos = {}
local offset_x
local offset_y
pos = copyall(df.global.cursor)
if pos.x == -30000 then
print("Cursor is not present.  Cannot calibrate.")
else
offset_x = pos.x - df.global.window_x
offset_y = pos.y - df.global.window_y
dfhack.persistent.save({key="_BOOKMARK",value="Calibration data",ints={offset_x,offset_y}})
print("Calibration complete.")
end

elseif args[1] == "drop" and args[2] then
if bookmarks then
local del = false
for _, bookmark in ipairs(bookmarks) do
if bookmark.value == args[2] then
bookmark:delete()
print("Bookmark " .. args[2] .. " deleted.")
del = true
end
end
if del == false then print("Bookmark " .. args[2] .. " not defined, so no action taken.") end
else
print("No bookmarks are defined, so no action taken.")
end

elseif args[1] and not args[2] then
local pos = {}
pos = copyall(df.global.cursor)
local make_new = true
if pos.x == -30000 then
if calibration then
name = "Center:"
pos["x"] = df.global.window_x + calibration.ints[1]
pos["y"] = df.global.window_y + calibration.ints[2]
pos["z"] = df.global.window_z
else
print([[
Not calibrated.  Either use the cursor or "bookmark calibrate" with the cursor in the center of the screen.
]])
end
end
if bookmarks then
for _, bookmark in ipairs(bookmarks) do
if bookmark.value == args[1] then
bookmark.ints[1] = pos.x
bookmark.ints[2] = pos.y
bookmark.ints[3] = pos.z
bookmark:save()
print("Bookmark " .. args[1] .. " updated.")
make_new = false
end
end
if make_new == true then
dfhack.persistent.save({key="BOOKMARK/"..args[1],value=args[1],ints={pos.x,pos.y,pos.z}})
print("Bookmark " .. args[1] .. " created.")
end
else
dfhack.persistent.save({key="BOOKMARK/"..args[1],value=args[1],ints={pos.x,pos.y,pos.z}})
print("Bookmark " .. args[1] .. " created.")
end

else
print([[
Invalid command.  Use "bookmark help" for help.
]])
end

Code: (goto.lua) [Select]
-- goto script v1.00
-- Move the screen to a bookmark or a set of XYZ coordinates.
-- Enter "bookmark help" for a list of reserved names.

local args = {...}

local bookmarks = dfhack.persistent.get_all("BOOKMARK",true)
local calibration = dfhack.persistent.get("_BOOKMARK")

if args[1] == "help" then
print([[bookmark.lua
Enter "goto # # #" to move the screen to a set of XYZ coordinates.
Enter "goto foo" to move the screen to be centered on bookmark "foo".
"goto help" prints this command summary.
Note that goto cannot function unless "bookmark calibrate" has been performed.
]])

elseif args[1] and not args[2] then
if bookmarks then
if calibration then
local pos = {}
local xcoord = df.global.cursor.x
for _, bookmark in ipairs(bookmarks) do
if bookmark.value == args[1] then
pos["x"] = bookmark.ints[1]
pos["y"] = bookmark.ints[2]
pos["z"] = bookmark.ints[3]
end
end
if pos.x then
if xcoord ~= -30000 then df.global.cursor.x = pos.x end
df.global.cursor.y = pos.y
df.global.cursor.z = pos.z
df.global.window_x = pos.x - calibration.ints[1]
df.global.window_y = pos.y - calibration.ints[2]
df.global.window_z = pos.z
print("Now at " .. args[1])
else
print("Bookmark " .. args[1] .. " not defined.")
end
else
print([[
Not calibrated.  Use "bookmark calibrate" with the cursor in the center of the screen.
]])
end
else
print("No bookmarks defined.")
end

elseif args[1] and args[2] and args[3] then
if calibration then
local xcoord = df.global.cursor.x
if xcoord ~= -30000 then df.global.cursor.x = tonumber(args[1]) end
df.global.cursor.y = tonumber(args[2])
df.global.cursor.z = tonumber(args[3])
df.global.window_x = tonumber(args[1]) - calibration.ints[1]
df.global.window_y = df.global.cursor.y - calibration.ints[2]
df.global.window_z = df.global.cursor.z
print("Now at " .. args[1] .. "  " .. args[2] .. "  " .. args[3])
else
print([[
Not calibrated.  Use "bookmark calibrate" with the cursor in the center of the screen.
]])
end

else
print([[
Invalid command.  Use "goto help" for help.
]])
end

Code: (whereami.lua) [Select]
-- whereami script v1.00
-- Reports coordinates of the cursor if it is present, or the center of the screen if not.
-- Also lists any bookmarks set for these coordinates.

local bookmarks = dfhack.persistent.get_all("BOOKMARK",true)
local calibration = dfhack.persistent.get("_BOOKMARK")
local pos = {}
pos = copyall(df.global.cursor)
local valid_pos = true
local name = "Cursor:"
if pos.x == -30000 then
if calibration then
name = "Center:"
pos["x"] = df.global.window_x + calibration.ints[1]
pos["y"] = df.global.window_y + calibration.ints[2]
pos["z"] = df.global.window_z
else
print([[
Not calibrated.  Either use the cursor or "bookmark calibrate" with the cursor in the center of the screen.
]])
valid_pos = false
end
end
if valid_pos == true then
print(name .. "  " .. pos.x .. "  " .. pos.y .. "  " .. pos.z)
if bookmarks then
for _, bookmark in ipairs(bookmarks) do
if bookmark.ints[1] == pos.x and bookmark.ints[2] == pos.y and bookmark.ints[3] == pos.z then
print("Bookmarked as " .. bookmark.value)
end
end
end
end
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map
Pages: 1 ... 9 10 [11] 12 13 ... 17