PlanarAlly icon indicating copy to clipboard operation
PlanarAlly copied to clipboard

[FEAT] Tool to autogenerate FOW walls

Open FuzzySadist opened this issue 2 years ago • 7 comments

Most 'walls' and such on battlemaps are a single color. So I suggest a tool... that I can set: "color" to pick the stroke/fill color "Tolerance" (how close the color has to match) "Width" (how many pixels the color has to be be filled ... this is like grid lines could be ignored) "Blocks" (Movement/Vision/Both)

Then treats it as a 'paint tool' to fill the FOW layer with the color chosen.

FuzzySadist avatar Aug 15 '22 21:08 FuzzySadist

If I understand you correctly, you want a tool that selects all Shapes of a certain colour (+/- tolerance) and copies them over to the fow-layer?

Is it really worth the effort? These Shapes can be (drag)selected, copied and pasted to the fow-layer manually. If drawn with the polygon tool, walls of entire rooms will be selected with one click. And there are the Ctrl+C / Ctrl+V shortcuts.

Or are you talking about analysing images that are dropped as a battlemap instead of a map drawn with PA's tools? In this case: DungeonDraft-VTT files are supported, i.e. these maps do already have the tool you're looking for. But these files come with structured metadata. Image-selection used as "paint" for the fow layer are problematic. To my knowledge, vision is – by far – the most computation-intensive aspect of PA. The tool you ask for is prone to generate a plethora of items that all have to be taken into account for creating a line of sight. Meaning: The 'wrong' map for this tool will probably break PA.

I'm not saying it's impossible (I'm not saying it's possible, either). Yet I'd go for creating polygons to both reduce impact on computation and boost post-creation useability. Yet, creating Polygon Shapes off an image just by colour codes probably won't be too easy…

dthv avatar Aug 15 '22 22:08 dthv

Example

FuzzySadist avatar Aug 15 '22 23:08 FuzzySadist

I get it... I guess I was just hoping to make this map easier to FOW :)

FuzzySadist avatar Aug 15 '22 23:08 FuzzySadist

Ah, thx, I now see what you meant. Would be cool, yet I don't know how hard it will be. :)

dthv avatar Aug 16 '22 07:08 dthv

FuzzySadist: With a little extra workflow outside of PlanarAlly, you should be able to accomplish this using the existing SVG walls/fow implimentation. The general outline would be:

  1. Open your map in a decent image editor (gimp, paint.net, etc...)
  2. Select all the things that are NOT walls (or select all wall/wall-colored+-tolerance and then invert selection) and delete them.
  3. save out a copy of this "walls-only" image to a BMP, 1 bpp black and white.
  4. use potrace.exe to create an SVG from that walls-only bmp.
  5. Profit!

I've gone through the process of how to use potrace to create SVGs from BMPs in the following two bug/feature requests: https://github.com/Kruptein/PlanarAlly/issues/641 https://github.com/Kruptein/PlanarAlly/issues/732

Potrace can be found here: http://potrace.sourceforge.net/

PalasX avatar Aug 23 '22 13:08 PalasX

FuzzySadist: With a little extra workflow outside of PlanarAlly, you should be able to accomplish this using the existing SVG walls/fow implimentation. The general outline would be:

1. Open your map in a decent image editor (gimp, paint.net, etc...)

2. Select all the things that are NOT walls (or select all wall/wall-colored+-tolerance and then invert selection) and delete them.

3. save out a copy of this "walls-only" image to a BMP, 1 bpp black and white.

4. use potrace.exe to create an SVG from that walls-only bmp.

5. Profit!

I've gone through the process of how to use potrace to create SVGs from BMPs in the following two bug/feature requests: #641 #732

Potrace can be found here: http://potrace.sourceforge.net/

Just a note here. I have actually submitted a pull request to planarally-docs for a tutorial of how to do this with examples.

You can find it here

Edit: had to remove the preview as it is no longer an .md extension.

develroo avatar Nov 30 '23 01:11 develroo

Example

FWIW if you had a copy of that map without the grid lines it would be pretty trivial to make walls for it. The trouble is the grid lines mess up the colour selection because it changes colour going over the underlying elements.

Just FYI

develroo avatar Dec 11 '23 23:12 develroo