TransWikia.com

Is there a way to optimize this?

Arqade Asked by AaronKanaron on December 24, 2020

I have a flickering effect in my adventure map. Is there a way to make them less laggy? Current method: every tick a score is added to a scoreboard(using a data pack–tick.mcfunction). It resets when it hits 80. If it is 50..55, it executes at an armor stand (in the lights) at replaces the block with coal block. If it is 56, It turns back to a sea lantern. When I have about 20 of them, I get lag spikes every time they place a block.

Is it light updates that are causing the lag and is /schedule a more efficient method than scoreboards?

Thanks in advance.

One Answer

Technically the answer to your question is "yes, /schedule is more efficient than your scoreboard method". But that won't solve your lag problems, because they are actually caused by light updates.

The bad news: You can't really solve the issue of light updates causing lag. I've experimented with a few different things, like having the roof be transparent and making it night, placing the lamps differently, etc., but it all causes similar amounts of lighting lag.

The good news: You can fake it. Here is a video showcasing a concept that lights up and darkens a long tunnel very quickly without much lag:

The trick: Every change from dark to light is not actually a lighting change, but a change from a darker to a lighter texture from a resource pack. If your flickering is very regular, you can simply do this with an animated texture, that is the best for performance. But if it's less regular, you need to replace the blocks in the tunnel. To make the lighting consistent, you would need a light and a dark variant of all the textures used in your tunnel and change them all. Alternatively, you could also teleport the player between two tunnels, but that might cause slight issues with walking. Experiment with it and check what works best for you.

Here are the two textures I used, I simply replaced the textures of stone and dirt with them and replaced the entire tunnel with the other type using /fill … replace:

             

The left one used the colours #808080 and #FFFFFF, the right one #000000 and #808080. For normal textures, you need an image editor that can increase and decrease the brightness of an image.

Answered by Fabian Röling on December 24, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP