• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:09
CEST 08:09
KST 15:09
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Code S Season 1 - RO8 Preview4[ASL21] Ro8 Preview Pt2: Progenitors8Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10
Community News
Maestros of The Game 2 announcement and schedule !7Weekly Cups (April 27-May 4): Clem takes triple0RSL Revival: Season 5 - Qualifiers and Main Event12Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25
StarCraft 2
General
Code S Season 1 - RO8 Preview Behind the Blue - Team Liquid History Book Weekly Cups (April 27-May 4): Clem takes triple Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Code S Season 1 (2026) - RO12 Results
Tourneys
Maestros of The Game 2 announcement and schedule ! GSL Code S Season 1 (2026) Sea Duckling Open (Global, Bronze-Diamond) RSL Revival: Season 5 - Qualifiers and Main Event Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
RepMastered™: replay sharing and analyzer site Quality of life changes in BW that you will like ? Tulbo's ASL S21 Ro8 Post-Review Why there arent any 256x256 pro maps? Do we have a pimpest plays list?
Tourneys
[ASL21] Ro8 Day 4 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2 Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Daigo vs Menard Best of 10 Path of Exile Nintendo Switch Thread OutLive 25 (RTS Game)
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread UK Politics Mega-thread The Letting Off Steam Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
How EEG Data Can Predict Gam…
TrAiDoS
ramps on octagon
StaticNine
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1499 users

Improving mineral gathering rate in SC2

Forum Index > SC2 General
Post a Reply
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
Last Edited: 2017-12-05 04:58:20
December 04 2017 03:46 GMT
#1
[image loading]
The mineral gathering algorithm(s) in action

Improving mineral gathering rate in StarCraft 2 (using the bot API)
EDIT: turns out that I set the experiment on RealTime mode (thus giving inaccurate frame count). New data below

As some of you may know, the default behavior of worker units is not optimal. This is the case in BW ( http://www.teamliquid.net/forum/brood-war/484849-improving-mineral-gathering-rate-in-brood-war ), but it is also true for StarCraft 2.


So for Brood War I implemented some algorithms to improve the gathering rate. I implemented those in SC2 as well and I now have some preliminary results already. It was quite interesting to see that even in SC2 there was still much gain from optimizing the mineral gathering rate.

Details of the algorithms can be found in the TL link above, I will mainly discuss results here

The following algorithms are used:


- Built-In
- Mineral Lock
- Queue System
- Co-operative Pathfinding
- Co-operative Pathfinding + Queue System


The research setup is as follows:
All algorithms start at the top left start location of InterloperLE and play for 4000 frames. Each algorithms builds 2 SCVs, then 1 supply depot, then SCVs until it has 16 SCVs (the recommended #workers).



Built-In:

The Built-In algorithm basically lets the internal worker management do its thing. In SC2 the internal worker management works more like the Mineral Lock system. So unlike BW there is not much difference between this and the Mineral Lock

Mineral Lock

Essentially making sure that each worker unit stays assigned to a certain mineral field. The frantic switching of mineral field in BW only rarely occurs in SC2, thus making this almost the same as the Built-In

Queue System

After some testing, it turns out that I cannot get accurate enough data from the API. Especially when exactly worker units are mining (and how much time they still need). This makes the results of the queue system worse than the more standard mineral lock.

Either way, the queue system uses a greedy scheduler, so the result can still be improved

Co-operative Pathfinding

The Co-operative wasn't really needed in SC2 due to how unit collisions work in SC2 compared to BW (in BW units are more like solid blocks whereas in SC2 units behave like a fluid). The optimized movement to the mineral fields was thus the main focus here.

I was surprised that it improved the #minerals at all, but I soon saw that just like in BW the worker units slow down when approaching a mineral field (just like in BW). The effect isn't as profound as in BW though.

Co-operative Pathfinding + Queue System

Combining the 2 systems will give even better results (as expected, scheduling and the pathfinding are not that interdependent). unfortunately result in sub-optimal scheduling. Compensated by the better pathfinding it will get around the same #minerals as the Mineral-Lock , but as it stands right now you are better off just using the better pathfinding.

Github source code

The preliminary source code is currently up on the github for LetaBotSC2. Now updated to not use realtime mode.

https://github.com/MartinRooijackers/LetaBotSC2/tree/master/Research/MineralAlgorithms

It still needs a better setup for gathering results (mainly adding Protoss and Zerg as well), but it should work for those willing to try it out themselves. A compiled .exe is available as well if you just want to see it in action (currently only for Terran).

Raw Data

Raw data from some of the tests that I have run can be seen by clicking on the spoiler.
Updated for the non-realtime mode.

+ Show Spoiler +


TopLeft Interloper LE:

Taken at intervals of 250 frames
So the first result is frame 250 , the last one when the #frames was at 4000


BuildIn:

Current Frames: 250 Total Minerals: 70
Current Frames: 500 Total Minerals: 55
Current Frames: 750 Total Minerals: 135
Current Frames: 1000 Total Minerals: 220
Current Frames: 1250 Total Minerals: 385
Current Frames: 1500 Total Minerals: 540
Current Frames: 1750 Total Minerals: 710
Current Frames: 2000 Total Minerals: 885
Current Frames: 2250 Total Minerals: 1055
Current Frames: 2500 Total Minerals: 1225
Current Frames: 2750 Total Minerals: 1400
Current Frames: 3000 Total Minerals: 1565
Current Frames: 3250 Total Minerals: 1730
Current Frames: 3500 Total Minerals: 1905
Current Frames: 3750 Total Minerals: 2080
Current Frames: 4000 Total Minerals: 2250

EvenSplit:

Current Frames: 250 Total Minerals: 85
Current Frames: 500 Total Minerals: 65
Current Frames: 750 Total Minerals: 145
Current Frames: 1000 Total Minerals: 240
Current Frames: 1250 Total Minerals: 405
Current Frames: 1500 Total Minerals: 575
Current Frames: 1750 Total Minerals: 740
Current Frames: 2000 Total Minerals: 920
Current Frames: 2250 Total Minerals: 1090
Current Frames: 2500 Total Minerals: 1265
Current Frames: 2750 Total Minerals: 1430
Current Frames: 3000 Total Minerals: 1600
Current Frames: 3250 Total Minerals: 1770
Current Frames: 3500 Total Minerals: 1935
Current Frames: 3750 Total Minerals: 2115
Current Frames: 4000 Total Minerals: 2280



Queue:

Current Frames: 250 Total Minerals: 90
Current Frames: 500 Total Minerals: 65
Current Frames: 750 Total Minerals: 150
Current Frames: 1000 Total Minerals: 245
Current Frames: 1250 Total Minerals: 400
Current Frames: 1500 Total Minerals: 570
Current Frames: 1750 Total Minerals: 745
Current Frames: 2000 Total Minerals: 915
Current Frames: 2250 Total Minerals: 1075
Current Frames: 2500 Total Minerals: 1245
Current Frames: 2750 Total Minerals: 1405
Current Frames: 3000 Total Minerals: 1580
Current Frames: 3250 Total Minerals: 1745
Current Frames: 3500 Total Minerals: 1915
Current Frames: 3750 Total Minerals: 2085
Current Frames: 4000 Total Minerals: 2255



Path:

Current Frames: 250 Total Minerals: 95
Current Frames: 500 Total Minerals: 75
Current Frames: 750 Total Minerals: 155
Current Frames: 1000 Total Minerals: 255
Current Frames: 1250 Total Minerals: 415
Current Frames: 1500 Total Minerals: 580
Current Frames: 1750 Total Minerals: 745
Current Frames: 2000 Total Minerals: 925
Current Frames: 2250 Total Minerals: 1105
Current Frames: 2500 Total Minerals: 1280
Current Frames: 2750 Total Minerals: 1445
Current Frames: 3000 Total Minerals: 1625
Current Frames: 3250 Total Minerals: 1805
Current Frames: 3500 Total Minerals: 1970
Current Frames: 3750 Total Minerals: 2130
Current Frames: 4000 Total Minerals: 2315



Path+Queue:

Current Frames: 250 Total Minerals: 90
Current Frames: 500 Total Minerals: 70
Current Frames: 750 Total Minerals: 155
Current Frames: 1000 Total Minerals: 255
Current Frames: 1250 Total Minerals: 415
Current Frames: 1500 Total Minerals: 580
Current Frames: 1750 Total Minerals: 740
Current Frames: 2000 Total Minerals: 920
Current Frames: 2250 Total Minerals: 1090
Current Frames: 2500 Total Minerals: 1260
Current Frames: 2750 Total Minerals: 1430
Current Frames: 3000 Total Minerals: 1595
Current Frames: 3250 Total Minerals: 1775
Current Frames: 3500 Total Minerals: 1935
Current Frames: 3750 Total Minerals: 2115
Current Frames: 4000 Total Minerals: 2280

If you cannot win with 100 apm, win with 100 cpm.
DrDevice
Profile Joined December 2010
Canada132 Posts
December 04 2017 03:56 GMT
#2
This is interesting, very cool. Thanks for posting
Argonauta
Profile Joined July 2016
Spain4967 Posts
December 04 2017 05:14 GMT
#3
Math and SC2 PogChamp. Really nice read.

User was warned for this post
Rogue | Maru | Scarlett | Trap
TL+ Member
Hadronsbecrazy
Profile Joined September 2013
United Kingdom551 Posts
December 04 2017 10:03 GMT
#4
On December 04 2017 14:14 Argonauta wrote:
Math and SC2 PogChamp. Really nice read.

User was warned for this post



yea its pretty Kreygasm am i rite :D

User was temp banned for this post.
No need Build Orders, Only Micro,Favourite Players: Maru, Zest, soOjwa , CJherO
Ej_
Profile Blog Joined January 2013
47656 Posts
December 04 2017 10:38 GMT
#5
I'd like to see your results put against a casual player and a progamer. Oh and I would love to see it a map with 4 close mineral patches too (Echo, Overgrowth).
"Technically the dictionary has zero authority on the meaning or words" - Rodya
Grumbels
Profile Blog Joined May 2009
Netherlands7031 Posts
December 04 2017 11:15 GMT
#6
This actually seems like it would be a fun bachelor thesis project for CS students.
Well, now I tell you, I never seen good come o' goodness yet. Him as strikes first is my fancy; dead men don't bite; them's my views--amen, so be it.
-Kyo-
Profile Blog Joined August 2010
Japan1926 Posts
December 04 2017 11:59 GMT
#7
This is something that has been needed for a long time. I mean, who forgets the old red tier gas on some of the WoL maps? Where if you spawned in one loc in mirrior matches you were literally behind just by virtue of placements huehuhe
Anime is cuter than you. Legacy of the Void GM Protoss Gameplay: twitch.tv/kyo7763 youtube.com/user/KyoStarcraft/
TL+ Member
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
December 05 2017 04:57 GMT
#8
Turns out that I set the experiment up in Real-Time mode, which gives inaccurate frame counts. After re-running the experiment, it became clear that the queue system needs more accurate information than the API can currently provide. The new pathfinding does improve the #minerals a bit, but not so significant.

text above and github are updated.
If you cannot win with 100 apm, win with 100 cpm.
LDaVinci
Profile Joined May 2014
France130 Posts
December 05 2017 09:28 GMT
#9
It was known in WOL and HotS (not sure about LotV, never tried it) that you can slightly improve your mineral rate by right clicking your worker just before the mineral and shift clicking on the mineral. If you do that, you worker arrive a litle faster on the mineral and if you can repeat it each time, you can gain like a full cycle after 5 or 6 (or 10).
It is really apm demanding, and you need your mineral to be available, I guess that's why I've not heard about it in LotV with 12 SCV start.
Those who refuse to become better, already stop being good
LetaBot
Profile Blog Joined June 2014
Netherlands557 Posts
December 05 2017 15:20 GMT
#10
On December 05 2017 18:28 LDaVinci wrote:
It was known in WOL and HotS (not sure about LotV, never tried it) that you can slightly improve your mineral rate by right clicking your worker just before the mineral and shift clicking on the mineral. If you do that, you worker arrive a litle faster on the mineral and if you can repeat it each time, you can gain like a full cycle after 5 or 6 (or 10).
It is really apm demanding, and you need your mineral to be available, I guess that's why I've not heard about it in LotV with 12 SCV start.



My bot works on the same kind of principle. It has to do with worker units slowing down when approaching mineral field. Difference ofc being that with a computer you can calculate the right trajectory to take and having the apm to pull it off continuously.
If you cannot win with 100 apm, win with 100 cpm.
Please log in or register to reply.
Live Events Refresh
Next event in 3h 52m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 166
StarCraft: Brood War
Calm 7151
yabsab 61
ToSsGirL 49
910 30
Shine 25
PianO 21
JulyZerg 21
Horang2 20
GoRush 6
SilentControl 5
[ Show more ]
ZergMaN 5
Dota 2
NeuroSwarm270
League of Legends
JimRising 659
Counter-Strike
Doublelift1604
Stewie2K667
m0e_tv341
Super Smash Bros
hungrybox1004
Other Games
summit1g6490
monkeys_forever570
C9.Mang0519
WinterStarcraft487
Organizations
Counter-Strike
PGL8396
Other Games
gamesdonequick2277
StarCraft: Brood War
lovetv 6
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• Sammyuel 6
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki23
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota2617
League of Legends
• Lourlo1116
• Stunt471
Upcoming Events
CranKy Ducklings
3h 52m
RSL Revival
3h 52m
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
4h 52m
Krystianer vs TriGGeR
Cure vs Rogue
SC Evo League
6h 52m
uThermal 2v2 Circuit
8h 52m
BSL
12h 52m
Artosis vs TerrOr
spx vs StRyKeR
Replay Cast
17h 52m
Sparkling Tuna Cup
1d 3h
RSL Revival
1d 3h
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
1d 4h
[ Show More ]
BSL
1d 12h
Dewalt vs DragOn
Aether vs Jimin
GSL
2 days
Afreeca Starleague
2 days
Soma vs Leta
Wardi Open
2 days
Monday Night Weeklies
2 days
OSC
2 days
CranKy Ducklings
3 days
Afreeca Starleague
3 days
Light vs Flash
Replay Cast
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
5 days
RSL Revival
6 days
Korean StarCraft League
6 days
Liquipedia Results

Completed

Escore Tournament S2: W6
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
KK 2v2 League Season 1
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2

Upcoming

BSL 22 Non-Korean Championship
YSL S3
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
BLAST Bounty Summer 2026: Closed Qualifier
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.