-
September 6th, 2023, 09:31 #1
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.


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.
You need to locate the image record layer in your campaign's db.xml file and paste it in thereCode:<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>
The end result will look something like thisCode:<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>
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.Last edited by GEONE; September 11th, 2023 at 16:26.
-
September 6th, 2023, 15:21 #2
Nice. I will take a look this weekend!
-
September 6th, 2023, 17:56 #3
Thanks for sharing. Glad to see you have an accuracy setting. Personally I keep my segments on caves to be at least one grid in length. Helps with performance,
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
June 3rd, 2025, 14:22 #4
Nice job.
Instead of copying and pasting it directly into the db.xml, you can also create what we call a side-load XML file. Just match the image name and change the extension to .xml and place it next to the image file. When you drag it in fro the assets folder, it will automatically apply that to the image record in FG.
If you set the walls directly on the wall edges, you can set a peek-through setting of 0.2 or 0.3 and it will show a little bit behind the lines for 20% of a grid square or 30% of a grid square depending on what peek-through setting you used.
To create an example file to reference,
1. open any map in FG and unlock it.
2. right-click on the layer with LOS and choose Export Metadata
-
June 6th, 2025, 13:05 #5
This is amazing.
Your image shows a png image map. However, when I tried with a png, it froze. The same image as a jpg worked in about 1 second.
-
June 6th, 2025, 17:13 #6
-
June 13th, 2025, 11:52 #7
I was using this website. It was really working well for me. However, now it no longer loads. It gets stuck on downloading pyodide-dev. Please fix! Please please please!!!
-
June 14th, 2025, 00:07 #8
-
June 14th, 2025, 01:13 #9
I tried to test it with my old maps (not the B&W ones program accepts I think) but I have zero understanding of image stuff, and failed. This was when you first posted it.
I tried it now with the image you provided in OP and it gave me this error:
losgen-error.png
Settings are exactly like the image in OP.
Hope it helps.I scribble Solo RPG methods and reviews for Resources in my All Things Solo blog.
Now with Solo Builds for DnD 5E. And All Solo Modules for FGU WIP.
LIST OF ALL FREE FGU STUFF
//Design with Systems, not Custom Solutions!
-
June 14th, 2025, 01:18 #10
There's gonna be a lot of errors and weirdness because I'm messing around with the live build right now.
I think I fixed it by downgrading PyScript to a 2022 version. No idea why the version I was using suddenly stopped working, especially since it's a local version of PyScript that's being served by my website.
Polygon index selection appears to be broken now though.Last edited by GEONE; June 14th, 2025 at 01:20.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)

Reply With Quote


Bookmarks