Larva Usage Factor, or Why You Might Be Macroing Wrong

Introduction


In the 101 post on Larva Economy we looked at larva production and spending larva with some round numbers.

In this post we will take a harder look and use more exact numbers.  I started writing this as part of the 101 series on production-income matching, and then I fell down a Nydus Wurm and when I came back up it was clearly not 101 material anymore.  I also want to note for anyone who doesn't know that Ctrl-Mousescroll or Ctrl +/- will change the zoom level on most browsers so you can see the graphs better.

The big punchlines if you don't want to read all of this are:

  1. Stacking injects is really important if your queen is building up energy.
  2. It is better to spend your larva separately from your inject cycle but it is okay to do it all in one shot while you are learning.
  3. If both are available to be done, it is better to spend larva first and then inject.


The zerg macro cycle is really more complicated than 30 second cycles.  It takes pretty close to 32 seconds for a queen to generate 25 energy, so that is the length of the inject cycle.  Injects themselves take 29 seconds to process and then the animation appears to be around 1.3* seconds before the larva hit the ground.  Natural larva production operates every 11 seconds so a natural length to view it at is 33 seconds to produce 3 larva.

(*The time to generate 25 energy is actually 31.74s and these other decimal times I have given are based on very sloppy measurement from replays.  I used slower game speed to magnify the times so they would be easier to check, but these numbers are not going to be exactly correct.  Everything we are about to examine should still hold true even if the impact is slightly weaker or stronger than stated.)

Larva Usage Factor


We will define a Larva Usage Factor (LU) as a ratio of the larva you actually get per second to the ideal rate, expressed as a percentage.

Simplified Macro Cycle


In what I will call the Simplified Macro Cycle the player spends larva only after injecting.  This is commonly recommended to new players as a easy to remember and convenient to execute macro cycle.  Even if executed perfectly this creates some dead time because there are 3 larva on the ground after the inject animation completes and natural larva production stops at that point, but we are not yet ready to conduct another macro cycle because the queen is not yet at 25 energy again.

It's worth looking at that timeline:
Zooming is better than squinting.

At a perfect time 0 our hatchery has been injected and has also just started an 11-second timer to produce a larvae naturally.  We get 1 at 11 seconds, 1 at 22, and then 3 at once when the inject pops off (there is a very slight delay between each larva landing.)  At that point natural larva production stops, because there are 3 larva or more on the ground.  Because the inject produces 3 at once, natural larva production always stops when an inject pops off until larva are spent and fewer than 3 remain on the ground for that hatchery.  We will call this the Pop Pause. This does not reset progress on the 11 second timer, it merely pauses it.  If we don't spend our larva until the 32 second mark (Simplified Macro Cycle) then there is a 1.7 second gap in natural production this cycle.   Not a big impact so far.

During the next inject cycle the hatchery already has 8.3 seconds of progress toward the next larva so that one will finish at 2.7 seconds and then at 24.7 seconds there will be 3 larva on the ground from natural production and natural production will cease.  We will call this the Natural Pause.  Our dead time in this second cycle is 9.3 seconds.

Larvae interruptus.


The astute reader will note that these 2 dead times add up to 11 seconds meaning we have lost an entire larva, which is why only 5 are seen on the combined natural production lines of these two macro cycles.  The following cycle will start fresh again and this will repeat, giving us another 2 macro cycles with these same timings.  This is an inherent flaw in the Simplified Macro Cycle and being super fast and on-time with your inject and then spending quickly cannot fix it because the problem is created by the Pop Pause and Natural Pause that happen in the middle of the inject cycle. Even executed with superhuman perfection this method only has an LU of 93%.

Spending Delay


If we add a spending delay, meaning the player injects at time 32 but does not spend the larva on the ground until some seconds later, this changes further.  If the player takes a 1 second spending delay after inject, then natural production does not begin until 1 second into the next timeline because time 0 is the time of the previous inject.  This has the effect of shortening the available window for natural production by 1 second from 30.3s to 29.3s.

Because we sometimes run into the Pop Pause and we sometimes run into the Natural Pause depending on how this natural larva cycle is rotating around within the inject cycle, I made a spreadsheet to model this behavior so that the efficiency could be assessed.  Each spending delay tends to create a different stable rotation of 4 or so (sometimes more or fewer) different timelines, and I've identified those and taken an average to show the approximate impact of a spending delay on an average larva cycle.  These are rounded to the 2nd decimal.

  1. second spending delay: 2.5 larva per cycle from natural production
  2. second spending delay: 2.42 larva/cycle
  3. second spending delay: 2.37 larva/cycle
  4. second spending delay: 2.35 larva/cycle
  5. second spending delay: 2.27 larva/cycle
And so on. It will approach zero.

So a player that performs the Simplfied Macro Cycle with perfect injects and take 5 seconds to spend their larva after the inject (which includes the time they spend performing the injects) is getting about 89% efficiency.
The "4.5 for the price of 5" deal was not a big seller.


So when we lay out a perfect match between production and income on paper and then you go into game to execute it with a Simple Macro Cycle and execute pretty well but still slowly float some money, this is why.  Your injects are great but your larva production as a whole isn't.

Inject Delay


The other delay we need to consider is the inject delay.  The is mercifully easy to calculate, because if in a Simplified Macro Cycle the player injects every 38 seconds instead of every 32 then the larva production is identical per cycle, the cycle just takes longer and has more dead time.  We're making the same larva in more time.

Adding a 5 second inject delay to the Simplified Macro Cycle in addition to the 5 second spending delay now means that we are generating 2.27 larva from natural production and 3 larva from inject production in a period of 37 seconds.  That's an LU of about 75%, although we are assuming that the player never notices a lot of energy on the queens and starts stacking injects to minimize the damage.  Stacking changes this and we will examine it soon.  We are also not considering the impact on a mixture of injected and uninjected hatcheries.

The graph below shows the LU of a player who is doing a Simplified Macro Cycle with no spending delay.  The left side of the graph is injecting perfectly at 25 energy, and as we move to the right the start of the macro cycle is later and the LU gets worse.
I hope you like graphs.


I'm not aware of any tools that measure and display LU or something like it but it's still conceptually useful.  The lower your LU the more additional macro hatches and/or queens you will need to have enough larva.  If a player is running production that ideally only requires 3 injected hatcheries to produce enough larva, and their efficiency is 75%, then they actually need 4 injected hatcheries to have enough larva.  Other thresholds are shown below, again with 3 injected hatches as the baseline.
I cut the graph off at 40% so we could keep this G rated.

If your play is at LU 75% and you need that macro hatch and queen then the 450 minerals you need to get them will build up over time because your degraded production capacity will not be able to spend your income.  Because these minerals are building up by larva that are not being produced and then morphed, that 75% LEF also represents a deficit of 9 drones at the point in time where the 450 minerals are available.  This is a potentially game-deciding advantage that has been surrendered.  Building the additional larva production is better than letting your money pile up but needing that extraneous larva production in the first place is not Good™.

The next graph shows three different lines to display the impact of Spending Delay.  So for example the entire green line represents a player taking 3 seconds after performing an inject to spend their larva, and this is in addition to how late the inject is (horizontal axis).
Fun fact: larva squirm because remaining unmorphed causes them pain.

So what if the player does not perform a simplified cycle?  What if the player de-couples spending larva from injecting, and spends larva all the time as they are available and then, separately, injects when that is possible?  I'm calling this an Asynchronous Macro Cycle, and it's noticeably better.  There is still some Pop Pause depending on how long the player waits after an inject falls off to spend larva, but a Natural Pause never happens unless the Asynchronous Macro Cycle gets significantly neglected.  Because of this natural larva production is mostly continuous.

A pair of macro cycles with a small Pop Pause might now look like this:
This should look familiar.
This one is New and Improved.
The first timeline looks very similar, but the second timeline contains additional larva progress from natural production.  This gain can be increased further by spending larva ASAP after an inject pops and thereby reducing the Pop Pause.  Let's compare the two methods:

That graph title is way too long.  Who writes this crap?

The red line is perfect larva spending, and the top left side of it is also perfect injects, which is why the LU is 100% there.

The async cycles are headed towards around 75% because with a 30-seconds-late cycle inject production is about halved but natural production is almost 100% (minus some spending delay).

The simplified cycles are headed towards around 50% because delaying injects is also delaying spending so both types of production have been roughly halved.  There's something of an irony to the advice given to new players because the later you are on your injects the more important it is to be doing an Asynchronous Macro Cycle.  That's not to say that the Simplified Cycle is bad advice for new players, but I think it should be understood to be training wheels and not "how Zerg is played."  The difference will be reduced when we consider inject stacking, but it is still there.


Stacking Injects

Let's consider a different aspect of the inject mechanic.  Our player is 10 seconds late on their inject so that about 33 energy are on the queen instead of 25 at inject time, and that macro cycle is 42 seconds long instead of the normal 32.  Let's look at the inject cycle following that one:
The early bird gets the larvae.

Because the Queen started this cycle with (about) 8 energy instead of 0, she can inject at 22 seconds instead of 32.  And if she injects at 32 then this will look like a normal inject cycle with perfect injects, so that provides a 10 second grace period.  Our 10 seconds of inject production was lost during the last cycle, but now we experience that as a 10 second grace period beyond 25 energy.  If we inject exactly at 32s, she will have 8 extra energy again.  But there is also a window to do better than a normal inject cycle.  The cycle length of 32s is determined by Queen energy, but if injects are stacked the next one will begin as soon as this one pops off and without waiting for the animation delay, so the length of the inject cycle can be shortened to 29 seconds, about a 10% reduction.  We can accomplish this by injecting anytime within the Early Bird Window, and this gains us 3 seconds of inject production and reduces our Grace Period and our Early Bird Window in the next cycle by those same 3 seconds.  If we continue being extremely prompt like this we will gain back all of the lost inject production time and have no spare energy remaining on our Queen and no stacked inject.  Of course losing a larva now so that you can recover it 4-ish cycles from now is still a bad deal, but what I said in the 101 post about never getting that production back is not quite true in the case of inject production.

The window can also grow.  If you have a 10 second Grace Period but are 10 seconds later than that then you lose another 10 seconds of production and your Grace Period is now 20 seconds.

What does this mean?  If you are 10 seconds late on an inject that will cost you about 1 larvae from lost inject production, and if you are thereafter consistently injecting exactly at the end of the Grace Period then your LU from that point onward will be equivalent to injecting perfectly on time.  You are still down by 1 larvae from the slip. What percentage LU that averages out to depends on how many cycles you want to average that loss out over, and it's probably more meaningful to say that it cost you an early drone relative to injecting perfectly.  

It's counter-intuitive, but inject delay becomes meaningless when looking at your long-term average larva production because early losses either turn into grace period or get recovered unless you fail to stack injects when your queen energy builds.  The later you tend to be the larger your grace period gets.  You still lose out on crucial early game growth and it's still bad but your larva output as an average across the middle portions of the game is no longer damaged once injects are happening within the Grace Period.

So let's look at LU while ignoring inject delays, and focus instead on spending delays which are always, totally and completely, unforgiven by Starcraft II's game mechanics.

Here are the impacts of Spending Delay within the context of a perfect 32-second inject cycle:
You made it.  This is the last graph.  If you're stacking injects when late it's probably the one to care about.


I've only shown out to 20 seconds, but as the spending delay approaches being long enough that spending happens right before the next inject pops and blocks natural production again, both lines will approach 50%.

The wobbly bit on the Simple Cycle line happens because at shorter spending delays the impact of the Natural Pause is large and as the spending delay gets longer there isn't enough natural production time remaining for this to happen anyway, so one of the major detriments of the Simple Cycle falls away as we head towards 5 seconds delay.  There is still a gap between the two lines because the Simple Cycle does not even start the timer on spending larva until it is time to inject, and the Async Cycle starts from when the larva are on the ground.

But perhaps more importantly we can see that the impact of Spending Delay is rather large.  Comparing these to our original graphs without inject stacking, it is clearly larger than the impact of Inject Delay in our Asynchronous Cycle, and the only reason the Simple Cycle appears to be more impacted by Inject Delay is because in a Simple Cycle the Inject Delay is also a spending delay.

Priority: Spending>Injecting

I think, given what we just said about stacked injects, that it is fair to consider injects that are late in a reasonably consistent way as only having a temporary impact on larva output.  (The ripple effects of missing early drones can still be quite large, of course.)  In some cases lost inject production can actually be recovered and in these situations larva output can be thought of as delayed rather than lost.  In contrast, lost natural production is genuinely lost.  Given that inject production can be recovered and builds a Grace Period and that Spending Delays have a somewhat larger impact, I think it makes sense to prioritize spending larva over performing injects.  Ideally do both promptly but if there are larva on the ground and queens with energy I think you should spend the larva and then inject, contrary to the typical description of a Zerg macro cycle.  This is further aided by the fact that in an on-time cycle, larva will be on the ground before there is enough energy to inject anyway.

Injecting and then spending might feel convenient but it is not optimal.

Extra-Credit: Double Stacking

If a second queen is brought over to add a stacked inject then the inject cycle contracts to 29 seconds for about the next 10 cycles, assuming that normal injects are otherwise on time or at least within the Early Bird Window.  This will raise perfect production from 100% to 105%.  The increased output will last for a bit over 5 minutes and you will gain an additional 3 larva over that time period, a rate of about 1 every 1.5-2 minutes.  This also provides a significant Grace Period/Early Bird Window particularly in the early part.  Again this does nothing to solve decreases in natural production due to spending delays.

Another way to view this is that a single queen can only access about 90% of a hatchery's actual inject production potential.

Whether that is worth 25 energy or at what point in the game it might become worthwhile I will leave to better players.  I do not sufficiently comprehend the defensive and creep tradeoffs of this decision.

If you are Double Stacking and let injects fall off completely then that inject time is lost forever and cannot be recovered relative to Double Stacked max production.  The recovery of inject production discussed above is based on the larva cycle completing faster than energy for a new one can be generated, and this is not the case if a hatchery's injects are being supplemented by a second queen.  In that case we can view this as your hatchery either having an inject processing at all times or not.

Comments

Popular posts from this blog

Adrenal for your keyrate

Inject Methods