gummby8 26 Report post Posted June 23, 2016 I am working with schematics to attempt to procedural generate dungeons as a player makes their way through them. The rooms for the dungeons fit into 64x64x64 cubes. Obviously trying to generate rooms of that size all in 1 tick will crush a server. So I have an entity that checks how many blocks are in the schematic and makes the changes X amount of blocks per tick. So I am reaching out to see what others have found in their own evil experiments. Or if Java itself has some general rules about how many objects should be changed in X amount of time Obviously server hardware plays a large role here and the better the server the more block changes can take place before any noticeable impact. Thoughts? Share this post Link to post Share on other sites
Draco18s 1928 Report post Posted June 23, 2016 You should be able to get away with doing it on a chunk-by-chunk basis, i.e. only generating 16x15x64 any given tick. Share this post Link to post Share on other sites
Ernio 595 Report post Posted June 23, 2016 Problem with placing blocks is not the amount, but the background stuff that happens there. First and most important is light update, which can be easily passed. But then you have all other shit that is more server-sided, and that is mainly problem. Everytime i see such post I always propose direct access to block storages. Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ); for (ExtendedBlockStorage storage : chunk.getBlockStorageArray()) { // for (x,y,z) and storage.get/set(x, y, z) Problem with this approach is that you probably have to take care of other shit like tiles (I think). Well - tbh it is all very damn theoretical (My code that did that is seriously outdated and a lot changed in MC) but maybe worth looking into. Said that - generally you would want to make massive replacement and then instead of sending singular update packets you would resend whole Chunk packet (for every chunk that changed) - just like MC does when client gets chunks from server - and this is quite fast if you ask me (I mean, just look at world loading/syncing process on joining) Again - above and #setBlockState flags are worth looking into, but if you want direct answer - tick is 50ms, vanilla takes next to nothing from this process - if you would take 10ms from each tick for e.g 10 sec - that is performance HIT, but not a constant one. generally - if user/server can't feel it and it is not constant (remember that with other mods you will use more MS of tick) - you are quite safe. Do some benchmarks and remember not every server has super processing power (maybe make config). Share this post Link to post Share on other sites