SnipG
Not related but.
What Nepeo said
"VERY high spikes when you cross a loading threshold"
This is pretty awful, sometime it feels like there is small spike(1-2 tick) but it somehow overflows into ~0.2sec. Not sure what causes it.
Yeah as I said it's just kind of how that game works, I based the logic on a similar project I've been working on in my spare time (Voxelcraft) which has a similar issue. Ideally the work would be broken up or done on a different thread so as to not hinder the framerate.
On the procedural terrain demo when you cross a loading threshold it has to:
- break the tilemap up into "chunks"
- serialise each chunk, and store it in the dictionary
- update the world position
- for each chunk either generate world data or deserialise from the dictionary and place the data in the tiles
So there is an awful lot of looping, serialisation, deserialisation, noise generation and tile updates. All of that has to somehow happen during a frame, and it normally does! Performance can be tweaked by changing the size of chunks and blocks, to reduce the number of loops and iterations ( loops cost more than iterations ). Also persistence can be ditched to remove the need to serialise the world. One idea I did toy with is to use multiple tilemaps and move them around, it's more complicated but would reduce the amount of work significantly.