WIP: Line of Sight Generator for Fantasy Grounds
https://geone.tv/FGU LoS Generator
NOTE: This requires you to have or create a mask for the walls of your map. A mask is a simple black and white image, where the walls (or non-walkable areas) are black and the rest of the map (the walkable areas) is white. Example: https://i.imgur.com/u6CbysY.jpg. This tool will not work correctly if you upload a regular coloured map or a map with a black and white filter. Some map makers provide these masks for you, but they are also quite simple to create in an image editing software. The mask image must be the same size as the image you are using in Fantasy Grounds.
Hello, all!
I finally got around to sitting down and writing my own generator for LoS/dynamic lighting definitions. The best part is that it's 100% free and works locally inside your browser! The images you upload aren't sent over the internet, and it isn't gated behind a paywall.
This tool is very WIP, I literally wrote it in a day and a half, and I haven't tested it very much. It can take a black & white image mask and generate an XML file containing occluders that can be used in Fantasy Grounds. If you've ever used Dungen.app you'll be familiar with the concept. You can change several variables like wall offset, expansion/contraction, accuracy, and you can even change the wall type of each polygon (wall, terrain, door, etc)! After you download the XML file, you just need to open your campaign database file, find the image record and layer you want to add the walls to, and copy/paste the occluders in. The UX still needs some polish, but I hope it helps some people.
The tool is hosted online at https://geone.tv/FGU LoS Generator
It uses PyScript because I know Python much better than JavaScript, so it can take a few seconds to load the virtual environment PyScript runs in when you first visit the page.
https://i.imgur.com/Lbkr99C.png
https://i.imgur.com/1KQk9tL.png
How to use the generated XML file
The XML file it generates will look something like this. Copy all of the text in the file.
Code:
<occluders>
<occluder>
<id>0</id>
<points>91,208,108,228,88,243,73,226</points>
<closed />
</occluder>
<occluder>
<id>1</id>
<points>-91,208,-75,230,-94,242,-108,219</points>
<closed />
</occluder>
<occluder>
<id>2</id>
<points>96,25,112,44,90,65,71,42</points>
<closed />
</occluder>
</occluders>
You need to locate the image record layer in your campaign's db.xml file and paste it in there
Code:
<images>
<image>
<id-00001>
<image type="image">
<uselos>on</uselos>
<uselighting>on</uselighting>
<layers>
<layer>
<name>Dungeon.jpg</name>
<id>0</id>
<parentid>10</parentid>
<type>image</type>
<bitmap>campaign/images/Dungeons/Dungeon.jpg</bitmap>
THIS IS WHERE YOU PASTE THE COPIED TEXT
</layer>
</layers>
</image>
<name type="string">Example Dungeon</name>
</id-00001>
<image>
</images>
The end result will look something like this
Code:
<images>
<image>
<id-00001>
<image type="image">
<uselos>on</uselos>
<uselighting>on</uselighting>
<layers>
<layer>
<name>Dungeon.jpg</name>
<id>0</id>
<parentid>10</parentid>
<type>image</type>
<bitmap>campaign/images/Dungeons/Dungeon.jpg</bitmap>
<occluders>
<occluder>
<id>0</id>
<points>91,208,108,228,88,243,73,226</points>
<closed />
</occluder>
<occluder>
<id>1</id>
<points>-91,208,-75,230,-94,242,-108,219</points>
<closed />
</occluder>
<occluder>
<id>2</id>
<points>96,25,112,44,90,65,71,42</points>
<closed />
</occluder>
</occluders>
</layer>
</layers>
</image>
<name type="string">Example Dungeon</name>
</id-00001>
<image>
</images>
EDIT: First round of bug fixing is done. If you tried it before and encountered an issue, give it another try and see if it's been fixed.
EDIT 2: More bug fixes and added additional visualization features like vertex points that match FGU's style.