Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Êrthur - Full zoomable embark map  (Read 5140 times)

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Êrthur - Full zoomable embark map
« on: June 18, 2020, 12:09:16 pm »

Êrthur is a dfhack tool that exports a full map of the world based on the embark screen, and makes it zoomable/pannable like Google Maps.

Here's an example!

Spoiler (click to show/hide)

I created this because I couldn't find any existing tool that did it, and I wanted a full-size world map using the same characters and colors as the embark screen, rather than using a single pixel per tile like the exported detailed map from legends mode. It's very much WIP, but it's working well for me. If others are interested in this tool I'd be happy to clean it up and make it more user-friendly!

The code is available on GitHub.
Logged

Salmeuk

  • Bay Watcher
    • View Profile
Re: Êrthur - Full zoomable embark map
« Reply #1 on: June 19, 2020, 12:54:47 am »

Awesome! This could finally be the utility that streamlines hunting for certain embarks. However, is there a way to export a world-map sized relative heightmap that you can access during embark? Or the cliff indicator display?
Logged

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Êrthur - Full zoomable embark map
« Reply #2 on: June 19, 2020, 10:57:30 am »

Hm... it might be possible but it'll be a bit of a different approach, because the relative heightmap changes scale as you move across the map in the embark UI. I tried it, and here's what I got:

Spoiler (click to show/hide)

Pretty, but not especially useful.

I think you could theoretically generate a global heightmap that uses the same color scale and characters as the relative heightmap in-game, but generate it based on the exported full heightmap that you can get from the game already, rather than what Êrthur does, which is pan across the embark map and pull characters off the screen.


It works OK for cliffs, though, since they're consistent across the map:

Spoiler (click to show/hide)
Logged

xzaxza

  • Bay Watcher
    • View Profile
Re: Êrthur - Full zoomable embark map
« Reply #3 on: June 23, 2020, 07:35:40 am »

Seems neat, but I ran into errors after running `node draw.js`

Quote
Parsing map...
Loading font...
Drawing chunk 0,0...
Writing chunk 4,0,0...
(node:23870) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, mkdir '/path/to/df_linux/erthur/tiles/4/0'

Should there be mkdir -p instead of just mkdir, or something?
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

xzaxza

  • Bay Watcher
    • View Profile
Re: Êrthur - Full zoomable embark map
« Reply #4 on: June 23, 2020, 07:41:28 am »

Also, installing 98 MiB of module dependencies is bit funny, but I guess that's nodejs for you.

Anyway, I did `mkdir -p tiles/4` and after that it ran a bit further, this time exiting like this:

Quote
Parsing map...
Loading font...
Drawing chunk 0,0...
Writing chunk 4,0,0...
Created /path/to/df_linux/erthur/tiles/4/0/0.png
Drawing chunk 1,0...
Writing chunk 4,1,0...
Created /path/to/df_linux/erthur/tiles/4/1/0.png
Drawing chunk 2,0...
Writing chunk 4,2,0...
Created /path/to/df_linux/erthur/tiles/4/2/0.png
Drawing chunk 3,0...
Writing chunk 4,3,0...
Created /path/to/df_linux/erthur/tiles/4/3/0.png
Drawing chunk 4,0...
Writing chunk 4,4,0...
Created /path/to/df_linux/erthur/tiles/4/4/0.png
Drawing chunk 5,0...
Writing chunk 4,5,0...
Created /path/to/df_linux/erthur/tiles/4/5/0.png
Drawing chunk 6,0...
Writing chunk 4,6,0...
Created /path/to/df_linux/erthur/tiles/4/6/0.png
Drawing chunk 7,0...
Writing chunk 4,7,0...
Created /path/to/df_linux/erthur/tiles/4/7/0.png
Drawing chunk 8,0...
Writing chunk 4,8,0...
Created /path/to/df_linux/erthur/tiles/4/8/0.png
Drawing chunk 0,1...
Writing chunk 4,0,1...
(node:24013) UnhandledPromiseRejectionWarning: Error: EEXIST: file already exists, mkdir '/path/to/df_linux/erthur/tiles/4/0'
    at Object.fs.mkdirSync (fs.js:885:18)
    at writeChunk (/path/to/df_linux/erthur/draw.js:63:8)
    at drawChunk (/path/to/df_linux/erthur/draw.js:100:11)
    at loadImage.then (/path/to/df_linux/erthur/draw.js:105:13)
    at <anonymous>
(node:24013) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)
(node:24013) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.



Aand looks like I fixed it by adding this to the beginning:

Code: [Select]
const mkdirp = require('mkdirp')
and then replacing

Code: [Select]
fs.mkdirSync(outDir, {recursive: true})
with

Code: [Select]
mkdirp.sync(outDir)
« Last Edit: June 23, 2020, 08:07:06 am by xzaxza »
Logged
Known issues
You may get a dwarf that likes bugged stockpiles.

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Êrthur - Full zoomable embark map
« Reply #5 on: June 23, 2020, 12:40:48 pm »

@xzaxza, thanks for the debugging! Feel like opening a PR on GitHub? :) I guess this is a windows/mac difference, as the code works fine on my mac.
Logged