Minecraft server implementation - How to update chunks?

Discussion in 'Programming' started by TheMode911, Sep 11, 2019.

  1. I am working on my own server implementation located here: https://github.com/TheMode/Minestom
    Now I want to create my own chunk updater (which will update every block in it), but since my implementation isn't a replacement to spigot either Minecraft vanilla I do not have to keep vanilla behavior. (which then I hope, can give me some performance improvement)

    So my question is, what is your solution to optimize all that? To have the less of blocks to update?
    Redstone is also in my TODO-list and I do not plan to necessary keep the same behavior, I would certainly change everything if it can benefit block update performance in any way.

    Some information:
    - My blocks system currently have 2 kinds of block: visual one (which do not update at all) and custom one (which have an optional update method included)
    - Even "air blocks" can be updated (if it is registered as a custom block)
  2. My current ideas are:
    - Having event calling per chunk, for example calling the event "grow" in a chunk will trigger every block which has been registered as a listener for this specific event. However, it will probably still be inefficient and cost some memory
    - Having update condition (when a specific block is placed next to it and such...)
    - Having to specify the update rate (some blocks will only need to be updated every 5 ticks where some will it to be at each tick)