[Guide] Optimize your redstone builds to help the server AND yourself!

Discussion in 'Empire Help & Support' started by ShelLuser, Nov 19, 2015.

  1. Hi gang!

    Do you like to tinker with redstone? If so then this article is meant for you. And don't worry: this applies to everyone who likes to mess with redstone sometimes. It doesn't matter if you're into building giant redstone contraptions or circuits which use one lever to open up a door on the other side of a room.

    Now, I know that what I'm sharing here is probably common knowledge amongst veteran redstone users. Even so: there are plenty of players new to Minecraft and to our server so I think this is important enough to share.

    I want to talk about block updates. In particular when it comes to light levels ("light level block update") and redstone charges ("redstone charge block update").

    Redstone circuits

    I've mentioned this many times before, I'll probably continue doing that: Redstone is what got me interested in Minecraft. I think the kind of stuff which you can do and automate, even in vanilla, is plain out amazing. Unfortunately all of this awesomeness comes at a prize: server performance. If you 'make' Minecraft 'do' something you're basically telling the server you're on: "ok, do this for me". Which means that you're using server resources and that can cause (some) lag.

    Welcome to my world ;)

    Every little bit helps

    There are many rumors and myths going around about redstone circuitry when it comes to causing lag. I'm not going to dive into all that, simply because some issues are proven facts while others could be open to discussion. Which is not my intend here, I want to give you two important tips which can optimize your redstone builds so that it'll cause less lag on the server and because of that it can also speed up your builds as well (that obviously depends on your circuit of course).

    And before you start: I know, I know: "Surely my meager redstone circuit doesn't cause that much lag on the server? So what's the point?". The point is that by keeping 2 simple things in mind you can actually help reduce lag. And while your circuit may not use that much server resources a collection of several circuits combined might. So simply put: every little bit helps, even yours.

    So what is this all about?

    Light it up!

    Have you ever done cave exploration in the wastelands? You enter a dark cave and you suddenly spot a light source in the distance. Probably lava. You walk towards it and for sure: you end up seeing plenty of lava, which emits light, yet there are still plenty of dark patches in the cave. This is usually caused by delayed (or lack of) light updates.

    Plenty of lava around yet the cave is still dark...

    Make no mistake here: a lava block emits the same amount of light as glowstone, a sea lantarn, a redstone lamp and even a beacon. These all emit a light level of 15, which is the maximum. So what is happening here? Well... When a block starts or stops emitting light then Minecraft has to calculate the effects on the surrounding blocks. And depending on the area this can take up a bit of time. Sometimes the update(s) get delayed as a whole.

    Don't take my word for it: just see for yourself by following the steps below.

    Demonstrating the effect of Light Level Updates

    Create a new world, set its mode to creative and customize it to make it a superflat world. If you don't fully know how to do this then you can follow the instructions from this guide. The main difference is that you don't have to change the world options, just creating the flat world is enough.

    After the world is created and loaded you can simply follow these steps:
    • Press F3 and make sure you're facing North (the red line in the cross hair points towards the right, the blue line will point towards you).
    • Double tap space to enter fly mode.
    • Teleport yourself 100 - 150 blocks into the air: /tp ~ ~150 ~.
    • Now create a 51 x 51 platform: /fill ~ ~-1 ~ ~-50 ~-1 ~-50 dirt.
    Notice anything strange?

    Most likely you'll notice that nothing seems to happen after you issued the /fill command; it'll take a while for Minecraft to respond but eventually you'll be standing on a dirt platform.

    Created a 50x50 51x51 dirt platform.

    So where's that delay coming from? Is it possible that your computer can't cope too well with this /fill command? Maybe you need buy yourself a faster one? Not to worry: this is by design. And I can show you... Drop down to the ground, optionally you can teleport away to another area, and then use the same /fill command as above. You'll notice that the dirt area now appears pretty much instantly.

    So what's the difference? Well, simple: in the first situation you made a sky platform, which means that there were dozens of (air) blocks below you. When you made the platform you also blocked the light and that caused Minecraft to calculate the new light levels for basically every position below you, which created a big amount of delay. In the second example there was no open space below you, so also nothing to re-calculate. As such things appeared instantaneously.

    Redstone components & light updates

    So what does this have to do with redstone you wonder? Everything. If you're creating a redstone circuit then chances are high that you'll be using some blocks which also cause those light updates as well: the repeater and the comparator.

    Redstone repeater (foreground) and comparator (background).

    Every time the circuit gets toggled (turned on or off) these blocks trigger a light update, and that will cause Minecraft to perform calculations on the surrounding blocks to determine the visual status. And that creates some lag. Lag which you can actually help prevent.

    First tip: light it up!

    Adding a simple torch or maybe better: glowstone (or anything else which sends out light at level 15) will reduce or nullify the updating effect. Simply because even though the state of the redstone block changed the state of the light levels did not.

    Second tip: cover it up!

    If you place a torch in a huge hallway then the light will emit to all sides and that will cause Minecraft to calculate the new light levels for every surrounding block. So if you close it up a little to reduce the amount of the surrounding open space you'll also reduce the amount of required calculations.

    Remember that sky platform we made and the different effect it had when we placed it on the ground?

    This is no different. So if possible you can also try to cover up the redstone blocks best as you can.

    I added a torch above the comparator and sealed in the repeater.

    End of part 1
  2. Part 2: Redstone dust & block updates

    Redstone dust can be used to transport a redstone signal to another location. But a side effect of redstone dust is that it will also power the blocks it's on and/or surrounds. And when a block gets a redstone charge it will cause Minecraft to calculate the effects this could have for the other surrounding blocks. So even if you're only after transporting a signal from one area to another you'll still be generating block updates.

    Fortunately for us there are also blocks available which can't hold a redstone charge. These are transparent or opaque blocks. Do note that not every block is usable. Glass can't hold a redstone charge but you also can't place any redstone dust on it. Therefor the most commonly used transparent blocks are slabs. These can be used with redstone dust but cannot hold a charge themselves, and that results in this effect:


    The redstone torch creates a signal which is picked up by the redstone dust. The signal is then transported from right to left. In the background I've placed the dust on sandstone blocks. And as a result these blocks get a redstone charge as well. And because of that the redstone lamps besides them light up. And of course: once the redstone signal is turned off then so do the lamps. So the blocks (all of them) are updated whenever the signal changes. A good thing if you need those lamps to turn on, but if all you want is to transport a signal then this is a waste of resources.

    An alternative way can be seen on the foreground: here I replaced the sandstone blocks with sandstone slabs. Because slabs are transparent they cannot hold a redstone charge, and because of that the lamps stay off. So this means that there are also no block updates to worry about. No block updates, no cause for extra lag.

    But there's more...


    Using slabs also means that you'll need less blocks to cover the same distance(s). As you can see above I can craft 6 slabs out of only 3 blocks: effectively doubling the amount of space I can cover. So not only will you help the server with reducing lag, you'll also help yourself by reducing the requirement amount of blocks.

    Conclusion: It may not be much, but it will help!

    Please note that I'm not claiming that by following my tips you'll suddenly double the performance of your contraptions. At most you may notice a small difference in response time, but most likely you won't notice anything different. But trust me when I say that this will help the server, and that will eventually also help you. In fact; reducing the amount of lag will help all of us.

    So please try to remember this the next time you're building something with redstone. Light it up or cover it up and use those slabs!
    TomvanWijnen and Kytula like this.
  3. Will these go together with your other guides to the blog? I think they are great and it would be easier to retrieve from there. Alternatively, have a restricted guides section on the forums. It would be a shame if the info here and in your other threads would get lost in the noise of the forums.
  4. This will eventually find its way to my journal but I'm not sure about the blog, I assume you refer to the EMC blog?

    To be honest I've so far always considered the forum and blog somewhat of two opposites, never considered to use both so far. Well, could be food for thought for me, I'll think about it and if I applicable I suppose I can send in some suggestions.

    True, and a good point. It's also why I created a journal with an overview of all my guides. Even so.. I'll think about your suggestion, could be a good idea I guess.