TileMap2D awfull performance on Chunkloading
Hey there, first of let me explain my situation: okay so basically about 5 days ago i decided to drop a projekt i have been working on because it was not really improving my copding skills and I started with a projekt in the generall direction of starbound/terraria, I made myself a nice worldgen and after a little struggeling i implemented that for a runtime tilemap2d, at first i've only been able to generate world of a size of 1000x1000 blocks, then i wrote a code for a simple chunkloading concept which now allows me to generate world that are 30'000x30'000 within ~30 seconds where 25 seconds are world surface smoothing.
However as you could tell by the title, my problem now is chunkloading, when the chunkloading function is called it causes 500ms - 1Kms spikes and as it turns out the cause is not my foreach loops when loading nor the tilemap.settile() its just straight up physics
which is kind of saddening because im not even sure if i can do much about that, however because starbound/terraria/minecraft can chunkload without us noticing most times there must be ways to improve this rigth?
well i tried my best thinking about it and i guess i dont have enougth experiece for thinking of a solution.
does anyone have any deep knowledge of how to improve this? or maybe there is actually a simple way that im not seeing?
If there are questions regarding code/similar feel free to ask so i can clarify