fenomas / noa

Experimental voxel game engine.
MIT License
616 stars 91 forks source link

Reset chunks #9

Closed andrewtheone closed 7 years ago

andrewtheone commented 8 years ago

Hey!

I'm about to install portals, and I'm interested in if I can reset the whole world/chunk/block data thing? like pressing f5 in the browser, which methods should I call in what order?

fenomas commented 8 years ago

This is another feature that's on the schedule but not done yet. Basically what's needed is to change the source of world data and then unload/reload all the local world chunks. Eventually the engine needs a built-in way of doing this, but for now the quick and easy way would probably be to just move the player a few hundred voxels away - that way, the current chunk handling code will see that the current chunks have moved out of draw range, ditch them, and emit events asking for new data. I haven't tried this though!

andrewtheone commented 8 years ago

I've tried it works perceftly, but was curious if I could just kill the chunks :D

fenomas commented 8 years ago

No built-in way yet. You could set the chunk add distance to 0, wait a second for stuff to depopulate, then change the world data provider and change the distance back to normal, but that would leave the center-most chunk in memory until the player moves over a chunk boundary.

A proper method is on the to-do list!

fenomas commented 7 years ago

(Update: now supported, see #13 )