UC Berkeley StarCraft Class, Week 5
We started out this week briefly talking about a problem from the homework about marines and medics. If H is the hit points of a marine, t is time, and B is the rate the marines take damage over time, then
H - Bt is the hit points of the marine. Set that = 0 for when the marines die and we can solve for t = H/B.
Meanwhile, let A be the rate at which medics heal marines. H - Bt + At is the equation for marine hit points in this case. Again set to 0 and solve for t to get t = H /(B-A).
The ratio of these two cases (marines only vs marines + medics) is proportional to B /(B-A). Looking at the limits, you can see that as A approaches B, the limit goes to infinity, meaning that marines never die. If A = 0.8B, a value reasonable to achieve in actual gameplay, then the limit shows that marines live five times longer. I think the non-math way of saying this is, "against Zerg, use marines + medics." Zerg units (because they have low hit points) can get rocked really bad by marines that live longer, and in some cases, can't even keep up with medic healing.
Economy
First consider an idealized form of the in-game economy, and the exponential growth it has. Imagine you build probes as fast as you can, and then build a new nexus at every earliest opportunity. You do this because building new nexuses (nexi?) is the only way to increase the rate you can produce probes.
If P(t) is the number of probes you have over time, then the rate of change, d/dt of P(t), is proportional to N*B, where N is the number of nexi and B is your rate of building probes. Also, d/dt of P(t) is proportional to P, the number of probes you have. Or at least I think that's what Professor Feng meant here. Solving these differential equations yields P(t) = A0eN*B*t, an exponential graph.
We then saw an example of of this in action on a ridiculous map called "fastest" which starts with your nexus so close to the mineral patch, that the probes have no travel time. By building only probes, then nexus, then probes, then more nexus, etc as fast as possible, you could see the explosive growth of the income. Of course, there are limits here. You can have only 200/200 supply, each mineral patch has limited number of minerals, lots of probes cannot simultaneously mine a mineral patch, etc. Also, you can't have fractions of a probe mine, and you can't spend 25 minerals to build only half a probe, so the idealized exponential graph is not exactly right, but we can start with it to approximate the real state of affairs.
And now for the disappointing inadequacy of this post. Professor Feng used many graphs to show how in-game actions affect the curve, but I don't have time to reproduce those graphs. In all cases, these are variations on standard exponential graphs that start low then curve up really high to the right. The x axis is time and the y axis is income. Income is the rate of change of minerals over time (d/dt of minerals). I thought this was strange at first (why not make the y axis actually be minerals), but I now see that it's kind of convenient to use the income rate instead. This is because the integral (the area under the curve) becomes minerals if the y-axis is the rate of change of minerals. Anyway, it's nice to be able to see the area under a curve and think of that as total minerals you've collected.
So what happens if you forget to build a probe for 30 seconds? How does the graph change? The answer is that you start off on your nice exponential curve, then for 30 seconds, you get a horizontal line, rather than an increasing one. Your rate of change of minerals is constant there. Then when you start building probes again, you continue where you left off, so that horizontal line curves up again, as if you cut and pasted part of the graph to the right. When you look at the area under the curve though, you realize something devastating. Of course you have less area under your curve during those 30 seconds than an opponent who kept building probes, but more terrifying is that the rest of your curve for the REST OF THE GAME is below the curve of the guy who kept building probes. That mistake echoes forward in time in a big way. If you are even one second late in building a probe, here and there, multiple times, this can add up to quite an economic disadvantage as the game goes on.
Then a note about Zerg. What if you're a few seconds late in building a drone? It's actually not bad at all. You simply build 2 drones at once when you remember because your hatchery has three larva to build from. So the missing area under your curve is only a brief zone for the few seconds you forgot to build. It does NOT echo forward through time to wreck you. That is, unless you forget for so long that you have all 3 larva sitting there, waiting. If you waited that long to build a drone (shame on you), then you will suffer the bad effects from the previous paragraph. You'll use up all your larva, then you won't be able to continue on your curve because you'll have to wait for larva to respawn.
This next subtopic I found very important to mention. What if you have to stop mining for a few seconds? Maybe some attackers show up at your base and you must move your probes away for a bit, then resume mining when it's safe. How bad is that for you? If you imagine that exponential curve that I'm not drawing for you, you'd remove the area under the curve during the time you weren't mining. Ok, that's kind of bad, but what about the rest of the curve, once you resume? The answer is that the rest of the curve is totally unaffected...as long as you kept building probes during that time. If you kept building probes, then the loss of minerals you suffered was only a loss during the actual time not spent mining. There is no ill effect that echoes forward in time.
I think that's a very important point because it's possible that your intuition is not attuned to it. When you see 20 probes or something that you have to move away from mining, it just FEELS horrible. It's painful to think about all those minerals there are not collecting during the battle. But it's not that bad, really. Losing probes would be much worse. And not building probes would be much worse. So don't be so stingy about moving probes to safety if it's necessary and whatever you do, don't stop building probes just because you had to temporarily stop mining.
Maynard Transfer
The next graph that I won't draw for you is one that starts high, but slopes down and to the right. That shows that as you have more and more probes at your base (that's the x-axis here), your efficiency per probe is going down and down (the y-axis). You need to build lots of probes of course, but the benefit from the 39th probe is very small compared to the benefit from the 3rd probe, for example.
This explains why it's good to transfer probes from your main base to an expansion. Just to make up a number here, imagine you had 20 probes at your main base. The first 10 of those probes add a lot more efficiency than the second 10. You still WANT the second 10 of course, it's not like they add nothing, but they don't contribute as much as the first 10 did because now your probes are spending some time waiting on each other and getting out of each other's way. But if you could take that second 10 and move them to an entirely new base, you'd be getting the first part of the graph out of them--the most efficient part.
For this reason, it can sometimes be smart to continue producing probes at your main base, even when you KNOW you have so many probes that each new one counts for almost nothing. It's because you know that moving half those probes to a new expansion will be a much bigger boost to your economy than waiting around for the new base to produce that many probes. The player Maynard popularized this move.
Professor Feng noted that in real pro matches, sometimes top players will send fewer than half their workers. There are other factors to consider, such a zerg player knowing that he will need some extra drones at his base to convert to sunken colonies, or a player expecting an attack that will make him lose a few workers at the main base. He guess that once you factor in all things, most pros actually do end up splitting their workers (the ones that don't die or get used up) half and half with a new base.
Economy, Buildings, Units
And now for another type of graph that I won't draw for you. This one starts out like the exponential one we're used to. It shows what it looks like when we invest all our money in economy, to increase our minerals / second. But then at some point, we build buildings. This means we take a chunk of our area under the curve (that's the total minerals we collect) and spend that chunk on making buildings (so we can make units later). To understand what this does to the graph, think of it this way. At some point on the graph, your income is X. Then you're going along, building more economy, going up that curve. Then you build a building and the chunk that removes from the area under the curve is basically the same thing as if you went back and time, to when your income was X again. So your at the moment you build buildings, your curve starts over just a bit, and you don't have quite the huge growth you would have had.
Then at an even later point, your graph becomes a horizontal line. This is because you invest all your minerals into units to make an army and none of your minerals into things that give you new minerals. This 3-part graph is something that will come up again and again in starcraft games. You gain an advantage by understanding where you are on that graph, and where your opponent is, at any given moment.
A more concrete example of this is imagine you are playing Protoss vs. Terran. It's early, you have hardly any units because you went mostly economy, and you see the opponent has tanks very early. Furthermore, you see he has siege mode on those tanks very early. That tells you what his curve looks like. Yeah you have to look out for tanks, but it tells you that your economy curve is much better than his. It's reasonable to press that advantage by going for expansion at this moment to get to 3 total nexi, so that your eventual economy advantage is huge. (Note that I'm only quoting what was presented in class, these strategies aren't from me.)
What to Attack?
Then we looked at graphs of economy (the upward curving exponentials) to graphs of how many buildings you have over time (none...then suddenly several) to how many units you have over time (roughly a straight line going up and to the right over time). What if you use your units to attack their units? You reduce the enemy's number of units, but that amounts to shifting their straight line (representing their units over time) down. It just rises back up again over time. Also you probably lost units doing this so your own line got shifted down too.
If you can attack their economy (killing workers), you're moving their exponential curve down, not just their straight line curve, so the effect is devastating. We all know this already of course. A worthwhile point though was that attacking buildings has an intermediate effect. While it's not quite as bad as crippling their workers, it still has big effect on their army. If you can destroy a protoss gateway, for example, and continue to build gateways of your own, each one pumping out units...then you have gained an army advantage. Your army will be bigger than their army even though you didn't kill any units. You just killed a gateway...which the opponent would need to be able to keep up with your own unit production.
Live Demo
Next Professor Feng showed a live demo of building quickly, hotkeying correctly, expanding, etc. He seemed unusually nervous to show us this, as if he would somehow be made fun of for any mistake, but he demonstrated many points here that you have to know to play StarCraft effectively.
First, don't stop building probes. We covered that. Next, don't cue up more than 1 probe (or any unit) if you can help it. While a production cue (setting a nexus to build 5 probes) does help with attention (it lets you do stuff elsewhere without having to remember to keep building probes), it's purely negative as far as in-game resources are concerned. You gain zero advantage in-game (attention is out-of-game) by cueing up that second probe. You pay for it, but get nothing out of it compared to simply building it when the first one is done.
Feng built probes, scouted, build gateways, started an expansion. I think he hotkeyed the probe that was scouting, his main base, and a gateway. When he really got going, he had I think 7 gateways. He showed that he build these gateways in a line. There 4 adjacent horizontally in one row, then 3 more adjacent in another row. Both rows fit on the screen at one time. This is specifically so he can click on all of them as fast as possible to build from them. It's infeasible to hotkey every gateway (you only have 10 hotkeys) so instead he only hotkeys the upper left one. Pressing that key twice will put the screen there (once selects, second press puts the screen there). When he has vision of the base, he can then mouse click on the 2nd gateway, build something, 3rd gateway, build something etc. He showed that the process of clicking on 7 gateways, and building one thing each (14 clicks) was blindingly fast for him.
He also showed that during these kinds of things, he could throw in extra clicks like "look at what scout is viewing" then "back to my base". He did this with such speed that the screen was flickering back and forth between 2 or 3 views. Sometimes it seemed that we could see 2 or 3 places at once because the flickering was so fast. Watching this, I thought of two things: 1) epilepsy and 2) that it looked like it would be more fun to play a game like this on multiple monitors. (Note SC2 intentionally does not support multiple monitors though.)
Feng was building many units very quickly out of all these gateways and made a point that you don't want all your guys standing around in between the gateways. They'd get in the way, they get all tangled up, it's just bad. He wanted to rally them so they all end up about a screen away from where he build them all. He showed the technique to do this. First, go to the place where you want all the units to end up. Then set a location hotkey (like F1, not the unit/building hotkeys like "1"). Then go to your base. At your base, you can either use another location hotkey, or a regular hotkey assigned to one of your gateways. I think the implication was that a location hotkey is slightly better here, but that either one can work. In any event, get your first gateway selected. Press F1 or whatever your location hotkey was. Then click to set the rally point there. Switch back to your base, select second gateway, switch view back to the rally area and set rally point. The idea is you aren't scrolling around with mouse here. You're going instantly back and forth between each gateway and the zone you want to rally to. This was another blinding fast epilepsy thing where you rally all the gateways in like 2 seconds.
We were reminded that real pros practice against themselves doing things like this for hours.
Examining A Match
Like last week, Lore showed us a replay of another match he played recently. His match was Zerg (him) vs Protoss. He talked about how one big difference with Zerg is the production buildings do not limit it you like they do with the other races. What if you want to build TONS of Zealots? You need tons of gateways. But what if Zerg wants to build tons of mutalisks? They only need one Spire, that's it. All their hatcheries, which they had anyway, can now build mutalisks. Lore said he thinks the ability to suddenly switch tech like this is one of the Zerg's greatest advantages, if not the greatest advantage.
In his match, he massed hydras. His enemy scouted him and saw that he was doing this. Lore made it a point to let the enemy see that Lore had several hatcheries, not upgrading to Lair. He intentionally let the opponent know that he was going with a low tech build of massing hydras. I forget exactly what the Protoss player did, but it was something that made some general sense against hydras.
Lore then mentioned how frustrating it can be that when you expand as Zerg, you can't protect the expansion like you can with the other races. Protoss an have like 8 cannons up before the nexus even builds...all from one probe! But Zerg have to use up one drone for each sunken colony, the sunken colonies kind of cost a lot and drag down your economy curve, and you can't even build them right away. You must wait for the creep to get big enough before you build. (Lurkers are good in this situation though.) He said all things together mean that what you really need to do is deny scouting. If you can't defend, at least keep the opponent blind to what you're doing. I think he meant finding and killing the opponent's scouting units, but of course keeping the opponent too busy to do anything also works. For example, send your mass of hydras at him.
He did send the hydras and there was a battle. If I remember right, Lore was pretty good at NOT micromanaging that battle much, but instead making sure he had a whole new set units building for the next battle. Somewhere in here, he did a tech switch to all mutalisks. This was really a great move because the Protoss base (which we easily saw all of from the hydra attack) was completely unprepared to deal with mutalisks. His mutas took some fairly heavy damage from an archon or two the Protoss player had, but Archons are big and hard to move around in your base. Overall, the mutas really raped this guy, killed tons of probes. The protoss player then sent his entire army to attack, pretty much, as you would expect.
The game went on for a while, but the Protoss player was never really able to recover from the disaster he suffered from that mutalisk tech switch. Eventually, Lore stomped him for the win with a set of Ultralisks + zerglings.
He also told us about what you can do given how many gas mines you have. With just 1 gas mine, you can sort of barely support hydralisks from 2 hatcheries, but not the upgrades. With 2 gas mines, you can do hydras right and really mass them with the upgrades. Another choice with 2 gas mines is lurkers + zerglings and a 3rd choice is 2 hatcheries with mutalisks. I didn't quite hear what you do with 3 gas mines. With 4, the optimum number to go into late game with, you can support ultralisk + zergling, which is pretty damn strong. With 5 gas mines, you can do anything you want.
As parting words, he emphasized how important it is to expand at the right moment. At first the advice was that it's usually the right moment right when you're attacking. Then the revised advice was that it's pretty much always the right moment right when you're attacking. An addendum was that if you're Zerg and they are Terran, every moment is the right time to expand. Then the joke was extended to include Protoss vs. Terran, it's always the right time to expand. "If they're Terran, just expand," ha.
Reader Comments (22)
Great summary. I really wish I could be there, but this is almost like I am there.
There's a lot of really great points that they make in the class. I'm actually never thought of the probe mining and mineral question as the integral under the graph. This really changes the way I look at building workers. I daresay that now I'll be much less likely to cut probes in order to gain a momentary advantage, and then think to myself "it won't matter much anyways."
I've lost a lot of games merely from not producing enough workers.
I really wish SC2 did support multiple monitors though. It could offer to split up the screen for people without dual monitors into two screens. It would really up the game to another level when it comes to macro/micro, though I guess most graphic cards wouldn't be able to handle it.
About the gateway question though, couldn't they just build 2 more gateways to replace the 1 they lost? It seems to be analogous to Zerg being able to produce 2 drones if they need to. Of course, producing the 2 gateways will take 300 minerals, which would be 3 zealots, but if he could continuously pump from them once they warp in, he could even himself up with his opponent in units, given a minute.
Where you mentioned the "location hotkeys" where he rallied the gateways really fast, watch the second part of this for the same thing:
http://www.youtube.com/watch?v=e18ancDxBUE
starting at about 0:35
I'm glad SC2 and other games won't support multiple monitors. Many people can't afford or don't have the computers to support a 2nd monitor. You'd basically be giving a game play advantage to people with that extra disposable income. You could split the screen on one monitor but each 'split' would be way too small on most monitors to do anything. Even sitting here on a 24" monitor wide screen I would think a split would be too small on each portion to play properly.
Response by Sirlin: yeah, yeah and that's why they aren't supporting it. What's sad though is that is also, the exact reason that starcrft1 did not support more than 640x480. That decision sucks for us now because everyone has access to more res than that. Likewise, this new decision will be very unfortunate a few years from now probably, but oh well.
The correct plural of nexus is nexus (with a long "u"), or alternatively assimilated into English nexuses. But definitely not nexi.
Very interesting articles. Keep up the good work!
I really like the sound of this class less and less the more i read about it..
Do you play Starcraft or do you just study it?
Oh and BTW, in PvT when the terran is doing FD with vulture harass, you DON'T "just expand", you can always overextend yourself, especially if these vultures catch your probes transferring, or worse, mining without the protection from cannons. Two vultures kill one probe in a single volley. That is FAST. It's just three volleys, and the vultures more than paid for themselves.
Response by Sirlin: You seem unable to detect that it was a joke by the people running the class. Also, my advice to you would be to stop reading about the class. Now everyone's happy!
Thank you so very very much for these writeups. They are so detailed and it really feels like im there sitting in class ( i watched the first class video so it stuck in my head).
I'm very thankful that you decided to give us all this opportunity.
Best regards.
Again great writeup, really appreciate it. I like that they get into real theory here, otherwise the class would've been boring (i don't know what Dane was expecting, that they teach the same basic stuff that you can read at every SC forum?).
If your economy is truly growing exponentially, then _any_ source of mineral loss has a compund effect. For example:
. If you forget to build a drone for 30 seconds, you lose a few minerals. Those lost minerals mean a delay in your next hatchery, which in turn means fewer drones, etc....
. if you run your probes around for a few seconds, that means you lose minerals, your next nexus is delayed, and so forth,
basically, the qualitative effect is exactly the same as if you had really stopped building peons for a while. (although it might not be quantitatively as great)
This is an idealization of course, and the qualitative behavior of a realistic situation will not be as dramatic, but I'm very much of the opinion that if you're going to discuss an idealization, you should get it right. :(
I had no idea that Starcraft didn't support higher monitor resolutions for such an archaic reason. What strikes me as weird is that Starcraft still has patch support, and it's mostly for little things like this. It seems like something they ought to have suppoerted by now, or at the very least, Blizzard could give Windows users the useless, distracting windowed mode that the Macintosh version has.
I think the series that just happened between Bisu and Jaedong are all good examples of a small mistake or failed attack leading to a small economic advantage which leads the snowballing effect described above. You can actually see the advantage getting stronger and stronger and they're excellent high-level games as well.
It's here at the GOMTV site for those who don't know: http://www.gomtv.net/videos/
Okay, not EVERY game in the series is a good example of this. But I'm avoiding spoilers here.
Hurkyl, But your capacity to extract minerals is not diminished, so that just creates a gap in the graph, it doesn't slow the exponential growth. Delaying getting your next Nexus up by 30 seconds shifts the graph to the right by 30 seconds, and no more. As long as no probes are lost (and you continue building), the curve continues as per normal.
These exponential curves remind me of Total Annihilation, an RTS contemporary of Starcraft that takes exponential resources to their logical conclusion. Here's how it works:
Mineral patches are never exhausted, probes never get in each other's way, and probes can usefully help build other probes as well as offensive units. But only one probe can work a mineral patch - until the top of the tech tree, where a building can create minerals out of thin air. As a result, you are constantly worried about your rate of economic acceleration, not just rate of growth - the UI will actually tell you, "Your net production is -5 minerals/second", to help you get your head around it.
As a result, a player in the end game must juggle his rate of probe production, mineral production, and unit production, and a raid on your probes will cause your resources to overflow rather than run out. It really focuses the mind on the high-level Yomi decisions of a strategy game, because the time required to build the units for a certain plan rapidly approaches zero.
Amazingly insightful series. I have done a little research into the interactions and responses of units in some of the other older RTS games (like Dark Reign), but I've never really seen the science put to it like this. While there is always the problem of human error in any system, understanding the core interaction is very intriguing.
Keep up the great work.
Nice examination on how each race tends to their economy.
Have you played Dawn of War II?
There is really no economy in the game (The designers called it "dirt farming") and in my opinion, plays like a TCG. You have a set limited number of units that get upgrades.
The game is great.
Great write up Sirlin...just wondering though, how exactly did you get into the Starcraft class and did you guys have midterms yet? Also is the class ever going to involve any classmates playing against eachother and analyzing the match?
Response by Sirlin: I'm just an observer. Students who take the class for credit do have to turn in homework, play each other in matches, and submit a final paper that extends the research of the game in some way.
Eolirin: In the idealized case, yes your ability to extract minerals _is_ diminished. Your _rate_ of mineral intake is exactly proportional to the total amount of minerals you've mined over the entire game -- any loss of minerals means a decrease in the rate you're mining.
Making things slightly less idealistic, if you delay your nexus by 30 game-seconds, that means you have 1.5 fewer probes than your opponent; you could get the exact same effect by building your nexus at the normal time, but then declining to build any probes (out of both nexuses) for 15 seconds.
And, of course, if your nexus was delayed for 30 seconds because you had to stop mining, then that continues along: your next nexus will also be delayed by those 30 seconds, _plus_ whatever delay is caused by mining with 1.5 fewer probes than your opponent.
And so forth....
In a much more realistic case (e.g. you are capping out at one base for strategic reasons), things would be different -- but that's a different case.
"I didn't quite hear what you do with 3 gas mines"
Generally a 3rd gas allows you to support defilers + whatever else you were previously producing.
@Sambakza
While some people will VERY MUCH DISAGREE with the term, Dawn of War ll is an RTT: Real time tactical.
That's BECAUSE there's no economy or base building, eliminating the majority of the strategy in it.
This is great for those of us who can't attend the class. Being a phd in training who enjoys the chance to teach courses, and a gamer who likes to break down and analyze games, this is a treat. Its great to see how one of the most complex games in existence can be scientifically processed.
I think that when not building a new nexus, resource growth is actually quadratic instead of exponential. The increase of resource growth scales with number of probes, but a lot of the time you will be building probes at a constant rate; just how much the nexus can handle. It is exponential when the build time can be ignored (so when you wouldn't build faster, limited by cost, even if there would be no probe build-time).