I have a system that uses Raycast to determine If there can be a bridge between two points. The issue here is that these points and the possible obstructions are in ServerStorage, so raycasting doesn’t work.
The reason these structures are in ServerStorage is that there are 1600 of them, and I plan to switch to using procedural generation soon instead of preloading a grid pattern and applying models.
If I were to do this outside of ServerStorage, it would be significantly less performant.
A current issue with bridges that check for the nearest candidate it can connect in a procedural generation system is that when generating it will sometimes not have enough candidates to search for and fail, which at that point many more issues arise.
The map is entirely made of floating islands over an abyss, which ends your game if you fall into it, so bridges here are important, but I don’t have a valid way to actually bridge between the islands in my head here.
Can you either create an invisible “test part” to raycast between or have preset data for the size and stuff of the islands and just use math to figure it out? I’m not exactly sure what you’re trying to do though.
Transparency doesn’t “un-render” anything. When a large amount of objects are being rendered in a short period of time it begins to lag. That is the whole point of loading models in ServerStorage slots instead.
Procedural generation is a solution to the problem, as I stated in the original post.
Generating models along a 2D theoretical grid should give way to easy generation, and I now have a function that searches for the nearest island in Workspace to bridge to.
I decided to default load around 100 islands total as a base and procedurally generate beyond that point.
Still of course there will be preset coordinates to spawn special islands, such as Arbor Corruptionis.
Simply check if the player is in range of spawning a new island on the grid, and if so spawn one.
Also, create a system that unloads chunks/islands when they exit the player’s range.
The function that searches for the nearest bridge can act on its own and automatically perform that action on any newly loaded chunks/islands because it checks if the island is in Workspace and therefore rays can be used to determine if the currently selected candidate is valid for bridging.
(Rays have barely any cost to performance, so don’t worry about that)
Theoretical grids can be created by simply using a format such as
_table[x][z]
This game uses FogEnd, meaning I can seamlessly unload and load chunks/islands without having any visual issues. Loading small amounts of islands at once should not cause lag as the client can handle it.
I am posting what is now extremely obvious to me here for anyone searching in the future.