Closed XeonG closed 7 years ago
I added an ability to set a range of blocks to a specific value along with some performance optimization here: 96ef4b62d42adf6e84a507d4c66c0c48bfe722c5
I should have updated this, the WE plugin I started here is prtty close to feature complete with what the original MC WE plugin does, I did end up fixing the performance problems not too long ago, and looking at your code looks like you found the same bottleneck to comment out 🗡
but I currently still use setblock with some minor modifications to the core for when doing WE stuff, but unlike MC with its mcr region stuff, where you can import/export huge areas (albeit slow) in this framework there doesn't seem to be way to have the engine loadup a chunk internally (that perhaps isn't loaded because its not in the view distance range the player is in) and have it make a modification or getblock info from that chunk that is out of view?..such as a server would do.. or maybe it stores the setblocks changes that need to be made to chunks out of view, for later when they are eventually loaded up when in range?
if you know what I mean, for now it hasn't bothered me as the way I'm using it only on loaded chunks, but it is definitely an area I haven't really looked into or tested actually but I do wonder what changes might be needed in the core engine to support something like that?
my last todo for it was adding support for loading/saving mcedit schematics, so far I have been able to find a c# framework that already has suppport for the mcedit format so its helped with getting things started, loading up mcedit schematics just have the converting it maybe some block table lookup conversion for importing some mc schematics.
In order to modify chunks which are not loaded you would have to write your own loading script (just like LoadChunks or LoasChunksSimple) and modify world level setBlock operations to load the new chunk if not there.
I have not thought about implementing this, yet. However, I can tell that for non-persistent worlds, this could be a potential source of memory issues (until there is a compression implemented that is). One step at a time :)
As for SetRange/ModifyRange, when setting a range of blocks, they are always more efficient then separate calls to SetBlock/ModifyBlock. Each chunk is looked up once and there is only a single info added to the block queue instead of thousands.
One of the reasons why there is no support for loading stuff from Minecraft is because I do not care about Minecraft :) Maybe I will have added some baaic support for loading its world if a need for that arises (e.g. performance testing of complicated worlds, widening the userbase etc.), but for now everything that these two project have in common ia that they are voxel based.
"One of the reasons why there is no support for loading stuff from Minecraft is because I do not care about Minecraft :) "
yeah you've said before how much you don't care about minecraft. For me the value of adding support ((myself)) for mcedit schematics opens up far more useful areas to utilize the standard format in my game as its not just used in minecraftby worldedit.
"As for SetRange/ModifyRange, when setting a range of blocks, they are always more efficient then separate calls to SetBlock/ModifyBlock. Each chunk is looked up once and there is only a single info added to the block queue instead of thousands."
I think an additional function that can be fed in array of vec3 positions along with differing block types for those positions, would be useful for edit operations that are not just the same block type.
I'm wondering if a similar getRange implementation would have any benefit for collecting block pos and block data?.. compared to how I just use getblock now in anycase I'll probably switch over to using setrange for set block changes that are purely a single block type change for now.
In order to modify chunks which are not loaded you would have to write your own loading script (just like LoadChunks or LoasChunksSimple) and modify world level setBlock operations to load the new chunk if not there.
It would def be something needed to import and paste very large schematics so if you ever do support it it already has a use case..
do you have a roadmap of things you're likely to be working on?
So I've started working on console commands for doing WE type stuff (using this library https://github.com/gzuidhof/GConsole , its pretty decent for adding custom commands,)
Commands so far are just selection stuff http://wiki.sk89q.com/wiki/WorldEdit/Selection#Selecting_cuboids
and /set ..which bases the cuboid selection on /pos1 and /pos2
Here http://pastebin.com/jh8Ad7aQ
Obviously a lot more stuff WE supports that I'd like to get see working in VoxelMetric as way for worldbuilding without having to code fancy procedural worldgen stuff (actually some guides on just basic setup for VoxelMetric on doing worldgen would be great.. even a flatplains world :D )
If anyone wants to help me with doing this contact me (xeon.g8@gmail.com) Personally not sure I'm ready to handle a really good worldedit implementation myself.. is a lot it does that I wouldn't know where to begin with doing efficiently. Ie supporting undo/redo stuff, cut selection rotating/flipping etc I'll figure it out eventually.
Anyway just some testing with what I have done I've noticed some problems with how I'm doing stuff isn't exactly fast.
ie setting 2 positions that cover 58k blocks using Code.Voxelmetric.SetBlock is problematic.. I get a delay of about 9,200ms in LoadCHunksSimple.Update() and EventSystem.Update() took 29ms and 2.5mb GC .. before the block changes are updated on screen. My point of comparison is Minecraft and worldedit managed this stuff alot faster so must be better way to do to this I'm not doing.
Maybe there could be a way of passing an array of positions/blocks types.. all at once so its not repeating itself?
Also another thing was setting block in a chunk that is not loaded (like maybe the engine can keep a list of block changes that it needs to change when those chunks are loaded... or perhaps it loads the unloaded chunk itself to apply those changes? .... another thing is maybe if setblock could return an error if the block changes couldn't be done because the chunk was not loaded?)
Its common thing worldedit handles though not sure technically how, but it seems to apply the block changes when the terrain is loaded in view..or it loads chunks that are not visible to apply its changes.
Also I think it would be really good if mcedit schematic was supported for import/export with a translation list the user could edit for minecraft blocks to voxel blocks... Having a ran a mc server the amount of schematics I've got saved and things I'd like to bring in from my server worlds would be nice to see again.