First of all, I’m new to defold and I want to try it out with my idea.
I want to create something like top-down fast paced shooter. I want to have a good dynamic vision system on my tilemap (map created by external editor Tiled). See gif (https://i.imgur.com/POVXxgE.gifv) - this is what I want to achieve. This gif is from my Unity implementation. I have translated this algorithm (https://github.com/legends2k/2d-fov) from javascript to C#.
For this algorithm to work I need to get all world geometry. The more polygons it has the slower everything becomes, that means world geometry must also be optimized (tile colliders merged wherever possible). My collisions are in tilesource.
To create the vision effect I have dynamically created a vision mesh based on algorithm’s output and applied custom shaders to the map and this mesh. Actual map is visible only through the vision mesh. Everything around it is a separate gray scale version of the map (dynamically created during map load).
My questions are:
- How to get the world geometry and optimize it for passing to the vision algorithm? I don’t need optimization algorithms (I have them in C#), I need to know how to handle that in Defold.
- How to organize the project? How exactly should I put these algorithms into defold? Best practices?
- How to build dynamic vision polygon at runtime?
- Is there an easier way to achieve the visual effect I desire?