branchrust_reboot/main/terrain_ignore_gridcancel
12 Commits over 0 Days - ∞cph!
made CoarseQueryGrid structure safe to interact with after disposal
- logs errors if you somehow add trigger bounds to it after disposal, not happened yet
- silently ignores attempts to remove bounds
- any checks pass as if further physics checks are required, as a fallback
just split the coarse query grid to have a Check and CheckJob function to call from burst and managed contexts respectively
(not as cool as the previous solution, but doesn't rely on compiler shenanigans)
experimentally routing calls to queries from a non-burst context to run a burst compiled job on the main thread and calls from burst contexts to directly run the code
- uses a mixture of BurstDiscard and compiler hints to avoid compiling any branching into burst-compiled code
- twice as fast than just burst compiling the function calls and calling it directly from managed/non-managed contexts
- at least 10x faster for larger queries in worst cases (empty grid) and negligable difference for small queries
coarse query grid split into upper and lower slices, avoiding tunnels flooding the map
- trigger bounds that cross theshold are represented in both
- only queries that cross theshold query both grids
- using initial caves network visibility threshold to separate as eliminating tunnels from the main above-ground usage is the main goal here and this works well for that
- increased cell size again, more granularity isn't needed now
use world size for coarse grid sizes rather than arbitrary upper limit, reduced cell size for more precision
added editor tool to dump CoarseQueryGrid as an image (normalized R8)
- highlighted how much the train tunnels screw this optim
initial grid setup
- common job-friendly QueryGrid structure that also replaces the checks made in WaterVisibilityGrid, they would still need to be followed up by physics queries though
- needs cleanup