Starfinder Playlist
  1. #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.
    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.
    Last edited by GEONE; September 11th, 2023 at 16:26.

  2. #2
    Nice. I will take a look this weekend!

  3. #3
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,272
    Blog Entries
    9
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in