Jump to content

Oddly specific API feature request: "PeekChunkColumn", but for an entire region


Recommended Posts

Posted

While working on my mod Farseer I have been looking into ways to optimize the "generation" of regions outside the player's view distance. At the moment I use the PeekChunkColumn() function of IWorldManagerAPI. I do this for every single chunk in one region at a time, so 256 chunks at once. It's quite slow! Looking at the engine internals, it seems like the chunk peeking feature has a lot of overhead; every peeked chunk generates an entirely new region map, chunk map and so on. It's nice that it can be configured to stop at a specific worldgen pass (I set it to stop at Terrain) but really I would also like to be able to stop even eariler, as I don't need it to generate caves, strata and so on, that's just wasted processing power.

I did some experiments with basically "stealing" some of the deeper engine code for chunk peeking and doing it for an entire region at once in a big two-dimensional loop. The performance improvement is drastical, maybe 5-10x faster than before. However, due to my lack of understanding of how the chunk gen engine works, it also completely breaks when "normal" chunks are generated at the same time as these "peeked" chunks, likely because of multithreading issues, I would guess my custom peek thread and the normal worldgen thread use some shared data that then gets corrupted.

So my humble request, a "PeekChunkColumn" but for an entire region at once. Or something like that, maybe more control of the worldgen systems as a modder? It seems they are very tightly coupled and hard to access without doing Harmony patches..

Now, this is a very specific use case, and a bit rambly, so I don't expect this to happen tomorrow or anything, just putting it out there :)

  • Like 3
  • 7 months later...
Posted

Hi - I know its an old post - but i want to gen a chuck outside the player's view. Your post indicates it's possible.
Is that correct? I'm being told that it's not. Just looking to confirm

Posted

I'd upvote anything and everything to support our modders! With the limited player-base, and with that, limited income from mods, the last thing they need to struggle with is a limiting API.

Posted

I think the ultimate solution for things like rivers will basically be found in abandoning chunk based generation in favor of "continent" or "world"-based generation; (frontloaded beforehand like DF) 

  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.