-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to control chunk loading? #115
Comments
What is the goal to be accomplished? The process of chunk loading is pretty complex, since there are several asynchronous steps involved, and a lot of edge cases (e.g. a chunk moves out of draw range after it's initialized but before it's finished meshing, etc.). So directly messing around with the chunk queues is really likely to cause bugs, or to break with future versions. It would make more sense to have the engine expose a hook where you can change what you want to change. Are you wanting to change the order in which chunks are requested, or the size/shape of the area within which chunks get drawn, or what are you trying to do? |
I'm trying to make a Minecraft client, and usually the server controls chunk loading in the vanilla game, so I'm trying to replicate that. |
Gotcha, right. Hmm. Can you imagine what kind of API would let you do this right? E.g.: // boolean - when true, the engine doesn't check for chunks to load/unload
noa.world.manuallyControlChunkLoading
noa.world.manuallyLoadChunk(x, y, z) // arguments are world coords within the chunk
noa.world.manuallyUnloadChunk(x, y, z) // arguments are world coords within the chunk Or something? To minimize impact, these should probably work within the current queueing system - so when you called Does that make sense or can you think of a better API for this? |
Yes, something like that would be perfect, thank you. I do need to load chunks immediately but I can store data until it's needed. |
Hi, I have pushed these to #develop, as described above. They function correctly for me, but can you check and confirm whether they cover your use case? One note: if you test manually loading and unloading single chunks, you may see strange behavior due to the edge cases in how the engine meshes the edges of a chunk whose neighbor doesn't exist yet. But in an actual project where most of the chunks around the player are being requested, any weirdness should only be visible on the edges of distant chunks. |
Yay, thank you! I'll try that soon. |
Hmm, I'm not sure. First thought is to change the order you're requesting things - maybe something is funky with the order being different from usual. Note that the x,y,z coords are world coords, so loading (0,0,0) is the same as loading (10, 10, 10) - just specify any coordinate within the chunk you need. Other note is, keep in mind that the engine freezes most stuff if the player's current chunk isn't loaded, so if you're not able to move around then that's why. Other ideas... if the chunks aren't loading at all, I'm not sure, but it might be that they're getting loaded but not meshed, or not meshed in a way you can see. To check, you could try changing voxels in a chunk that should be loaded, since changing a voxel would trigger a remesh, which might fix things and give a clue what's wrong... |
Closing as this is likely no longer current, but please reopen if needed. |
What's the best way to control chunk loading manually rather than having noa request and auto-unload chunks? At the moment I mess with noa's array to force it to request the chunk like this:
I can't actually tell whether that works or not, though.
I'm trying to unload chunks like this, but it doesn't seem to work:
Is there a better way? Should I let noa handle it? Should I fork noa and add it?
Thank you
The text was updated successfully, but these errors were encountered: