home | faq | all articles | discord | join | vote | downloadsNew!
Vanilla Extract Logo

Vanilla Extract. We take Minecraft super cereal.

What is the lagpickle?

by Syntaxvgm on May 2, 2023

The lagpickle



TL;DR The lagpickle is a way for you to read the server's lag with redstone. You can use it to shut off things when the server struggles.

The concept

During a winter storm last December, I got a text from my power company asking me to voluntarily reduce power usage to avoid a grid failure. Having natural gas heat and water, I mostly ignored it as I use a fraction of the power to keep my house warm compared to people with resistive electric heat or even heat pumps. However, when I powered on a single stove burner to cook my dinner to my surprise I received a reminder (threat) in real time!

It turns out that the new meter I was forced to install had the ability to read power usage down to 15 minute intervals. (It can also shut people off remotely) This is what gave me the idea for the lagpickle- no not the SMS to bully you in real time about your minecraft farms. I had remembered the way some other power companies had started to handle this in the summer.

Some companies offer customers discounts for installing free Nest smart thermostats they control. If they're at risk of losing the grid on a hot summer day, they have the option of turning a few air conditioners to a higher temperature to defer them running before they have to risk shutting individual customers or sections of the grid off. Along that concept I thought it would be really cool if we could assign priority to our high amperage circuits- cause fuck you power company, shut off electric water heaters and turn electric furnaces down before you threaten me over my pan of sausage!

The lagpickle

The lagpickle is a similar concept- smart load shedding. Instead of kicking you, we just control what appliances you're running...actually you control it!

Item frames can be read with a comparator and provide a signal strength of 1-8 depending on their rotation. The lagpickle system takes advantage of that. The laggier the server, the more it rotates.

It's not a direct TPS adjustment, the decision on where it places the pickle is more complex, but you don't have to worry about that. Below are the "targets", where, if left alone at certain TPS for a long time the lagpickle will settle. Use this to decide what level to set your farms on.

Rough TPS targets for each state

1 lagpickle state 1 TPS over 20 and less than 10 players
2 lagpickle state 2 TPS over 20
3 lagpickle state 3 TPS between 17 and 19
4 lagpickle state 4 TPS between 15 and 16
5 lagpickle state 5 TPS between 12 and 14
6 lagpickle state 6 TPS between 10 and 12
7 lagpickle state 7 TPS between 8 and 10
8 lagpickle state 8 TPS 7 or lower

Please note that you may see a TPS that doesn't match the current lagpickle state. That's fine! It takes several minutes or longer for the lagpickle to move, and that's intentional.

Imagine you had a really bad farm set to only run above 15 TPS. The server gets knocked below 15tps, and the farm turns off at 14 tps. The act of turning the farm off sends the tps back up to 16 TPS. The farm turns back on. We now have a feedback loop!

feedback loop

How to use the lagpickle

Place a block with an item frame on a side face of the block and a comparator on the opposite face. This will read a signal from the item frame.
Rename a sea pickle to "lagpickle" and place it in the item frame.
(no caps no spaces)

The comparator will now output a signal strength based on the lagpickle's rotation. You can put maybe a piston or repeater somewhere along this line to shut off your farm.

Item frame signal strength

A cleaner way to handle this is to send a signal into the side of your comparator, the strength of which will be the minimum you want to pass.

Send a signal into the side of a comparator to only get a signal out when the input is stronger

Composters are convenient as they read signal strength 1-8 depending on fill level.

Any signal strength lower than the signal sent on the side is ignored

Alternatively, you can use another item frame! This allows you to easily adjust your shutoff threshold.

Another item frame can be used as your signal comparison!

A note about redstone dust

You may have heard talk about redstone dust being very laggy, especially in our case as we don't use any alternative redstone implementations to preserve vanilla functionality. This is true, but you should only worry about reducing dust that is frequently changed, like on clocks or auto farms.

A lever or something like that isn't a problem at all, as it's only changing when you change it. Same with the lagpickle- using long lines of dust to toggle a farm is ok as it wont change states except when your farm is powering up or down. For the lagpickle it is much better to use dust which is a hard signal vs say observers and rails which rely on momentary signals to toggle things. If you're not careful, that can get complicated with unloading.

Just a suggestion, use railstone if you want to live your life on the edge. Your choice.

When to use it, some examples

You probably shouldn't turn off minecarts of farms that cannot be shut off. It's more important to have a minecart and collect or destroy ground items than it is to not have a minecart running.

Flushing mob farms are the prime example of a farm that's a great idea to put a lagpickle on. They are very laggy and I see a lot of people just building them day one then never turning them off/forgetting about them. Unless you need extra mob drops right now, I'd suggest putting these on 2.

Crop farms

Most people don't need all that sugarcane or all those melons all the time! Unless you're saving up mass melons to trade with, it might be a good idea to put a lagpickle on the melon farm if all it's doing is making bone meal for you. These crops farms usually aren't that heavy, but every little bit shaved helps when we're starting to lag. Some farms, like melon farms with pistons on the top, are not really designed to be shut off easily. Other farms you can power all of the pistons to stop them. Make sure any circuit you use to shut off pistons with redstone dust isn't backfed by the farm when it's running. That's just extra flashing dust.

Tree farms

For what they are, they are quite laggy, but it's not a problem overall when really the ones where you plant the sapling are the only one of its kind you are running at a time. Fully afk ones are covered by our one TNT duper at a time per base rule. In these farms, it's mostly about items and flashing dust. They don't make a ton of items, but a lot of them have very long chains of redstone dust or in general complex redstone. I'd recommend putting the ones you have to plant saplings on a 7 or 8, and ones you fully afk to like a 4 or 5. Gracefully shutting these farms down is better than being kicked. The commonly paired source of the bonemeal is an even bigger source of lag- moss farms.

Moss Farms

These are some of the laggiest farms you can make in the game. For what you get they're not too bad, if you were to compare the bonemeal per hour to say a massive ass melon farm that would give the same amount, the lag isn't bad at all. But they're deceptively small, fast to build, and some people feel the need to make more than a hopper’s rate of bone meal at once... These farms can have like 150,000 items an hour in water per module and have some amount of flushing water too. A lot of people hook them up to their tree farm to run them at the same time as the tree farm, but some people just plain run them for the hell of it. I'd put them on the same shutoff signal as your tree farm if you are running it together, or a lagpickle at 2 or 3 if you are running it on its own. These are also prone to break via unloading and can be a pain to fix, where properly shutting them off prevents that. So even if you refuse to be cool and shut them off early, you still should consider one at 7 or 8 when we're approaching completely unplayable cause it's better than a kick while it's running.

Isolated farms/farms that cannot be shut off

Hey you read the rules and saw the recommendation to build your heavy farm isolated!
Congrats, I notice and appreciate this when I see it. Still, you might be worried about starting up your massive dumbass gold farm or something at 20 TPS late at night and waking up in the morning to 30 people on and less than 10 tps. I've had a lot of people say they don't know when to afk certain things and even some that asked me or a self auto kick/sleep timer command to solve this.

With the lagpickle, you can afk in a minecart and send yourself out of loading distance or even back to your base automatically!

Using a lagpickle with a minecart

If you're thinking ahead and realized you can also put a lagpickle on the other end of the rail to send you back when conditions improve, I'd remind you that the lagpickle may take time to update when you first load it and if you don't delay it, it might send you right back. Use a detector rail, a full hopper based pulse extender, and a piston to break the connection with the powered rail from the lagpickle on both sides if you plan for a system that moves you back and forth.

Your entire base

In the above story about the power company load shedding, while I don't appreciate the threats about my sausage I would want to be cut off entirely before my neighbors in the winter. I have backup batteries, propane, and a generator, I'll be fine.

In a similar vein, if you just feel your overall base is heavy and you want to not feel bad about just leaving yourself logged in overnight, the lagpickle minecart trick mentioned above is the perfect solution as well.

Anything else

Overall anything on your base that can be turned off and won't be sorely missed is a farm that deserves a lagpickle. Over the coming weeks I will be adding tutorials about how to optimize certain farms, or how to make them lagpickle friendly.

What about people not using the lagpickle?

Anyone who uses it helps the server. Just because some people aren't using it doesn't mean it wont help. Similarly, just because a farm isn't too heavy doesn't mean it's not worth a lagpickle. Anything not important and easy to shut off helps give more room to the server.

I've found that when we give tools for people to check or improve their own lag contribution they like to use them without being told they need to. People here want to reduce their lag impact, and as soon as they learn new ways to do it they evolve the way they make redstone. Truly understanding lag reduction is a complicated subject that depends on many factors including some unique to our configuration. No one is an expert overnight, and many people just want to make that thing from youtube and move on. The lagpickle is a tool anyone can use without having to memorize redstone lore from the past decade, and I expect a lot of people will welcome using it.

Please do not witch hunt people not using a lagpickle. Give people time to learn how things work here and they will build better next time. Using them is not a rule, only a guideline. Only staff can require it and we'll only require it on a case by case basis.

More on how the lagpickle works

The lagpickle has a different scoring system for every state, and it decides whether to upgrade or downgrade the state based on the continuing conditions over time. It will not skip states without manual intervention. It takes less time for it to downgrade than it does to upgrade, and the lower TPS states are kind of a cliff. The speed at which it moves is based on the differential between the current state of the lagpickle and how many levels away it would score at with the current TPS. Think of it like an airplane adjusting pitch on a line graph-nose down too hard and it's dive bombing really fast, nose up and it takes a bit longer to climb back up. That's how it works in general, or will work depending on how good my current implementation is- I will be tuning it over time after seeing it in real world action. The exact behavior is subject to change.

You also may notice that your personal lagpickles may not move to the correct state immediately or at the same time. This is also normal. There's a daemon that checks for lagpickles in the wrong state and corrects them, but it does it such that it intentionally spreads it out over time. This also means your lagpickle for the most part will never short pulse you. The only possible way for it to change signals fast is if you deload a lagpickle right after it changes states, then reload it some time later when the server is back in the first state.

Use the command
/lagpickle
To get the current state. Or look at your nearest lagpickle.

You should not spam lagpickles like some kinda art deco thing. Since daemon that adjusts lagpickles to the current state intentionally spaces out when they are adjusted, spamming a ton of pickles makes this slower. I will be summoned and be very displeased. Use them to control something or just for reference. Don't wallpaper your bedroom with them.

Do not place anything to occupy the same block as the item frame like buttons, levers, torches, etc. This won't break anything on the server's end, it just will prevent the lagpickle from working properly for you.



Tags

If you were a block, I'd put you on my shelf and cherish you like I cherish all of our blocks.