Speeding up the process - Percentage Calculation
Speeding up the process - Percentage Calculation
As I am working on the conditions of a successful PLG creation I thought of a way to optimize the performance of the percentage calculation.
Below are a few thoughts and suggestions to me in order to speed up the process.
The Density percentage calculation. Initially I scanned the entire area after a set number of tiles to calculate the percentage. If the target density was not reached then we added another 10 tiles and recalculated. Later on I decided once the first scan was completed store only the points that hit nothing, and only scan them, the ones that now hit get removed from the list, So it would start slow and speed up as the percentage grew. This did have an improvement in speed and calculations. I now attempted something even more simple, since the tiles we are placing are premade, we can calculate it's Area and store it. That way every time we add a tile we add that tiles value to the TotalTileArea.
The best way to get A pieces the area is to calculate it using the colliders. At the moment the area value is just entered. Later on I could add a button in the dungeons piece custom editor that will calculate and store the colliders area.
In the Video you can see the area percentage from both methods
Density: is the desired value that we want.
Current Density: the current room density calculated by the sum of the dungeon pieces areas.
Current Density Dots: current room density calculated points and raycasts.
Below is an example without the Scanning function.
And here is another in steps of 400.
Comments
Post a Comment