• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 09:07
CET 15:07
KST 23:07
  • 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
Greatest Players of All Time: Addendum - Dark15Team Liquid Map Contest #2312[ASL22] Finals Preview: Sweet Victory!12[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5
Community News
[BSL23] ProLeague RO83Serral wins 2026 RSL Season Finals12Weekly Cups (Nov 16-22): MaxPax doubles, Dark heats up0BSL 2v2 ProLeague Season 44Weekly Cups (Nov 9-15): Clem and herO take over6
StarCraft 2
General
Best SC2 Parody Song about 2v2? Greatest Players of All Time: Addendum - Dark Serral wins 2026 RSL Season Finals How do you feel about the mass reverts in the 5.0.17 PTR? Weekly Cups (Nov 16-22): MaxPax doubles, Dark heats up
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Kung Fu Cup - 2026 Grand Finals (Nov 24-29) RSL goes to London! 2026 Offline Finals Nov 21-22 soO & FanTaSy return! SC2 Kevin Scrim 4v4 (Nov 16) ISSL:Premier#2 Announcement
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[G] How to playtest arcade maps Starcraft 2 Advance [D] the control group Simple Questions/Answers
External Content
Mutation # 553 Undermined The PondCast: SC2 News & Results Mutation # 552 Secret Storm Mutation # 551 Robotic Revival
Brood War
General
List of top players active on ShieldBattery AI, Entropy & Exhaustion..any for 1.16.1 server? New ASL23 Maps BW General Discussion Fantasy Interview 2: Internal Rankings,SC2 swap
Tourneys
2v2v2v2 Tournament Stage 2: Players [BSL23] ProLeague RO8 BSL 2v2 ProLeague Season 4 Ultimate Battle Event
Strategy
Request - 3-factory/fast timings as Terran Pluto's TvP 5Marine 2Medic Push Simple Questions, Simple Answers Infested Terran strategies in 2026
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread The PlayStation 5 Warcraft III: The Frozen Throne Free Space RTS Game, optimised f. Phone/Tablet etc
Dota 2
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Artificial Intelligence Thread The Chess Thread The Games Industry And ATVI
Fan Clubs
INnoVation Fan Club Fan Club Resource Thread
Media & Entertainment
Anime Discussion Thread Movie Discussion!
Sports
Football (Soccer) Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
[Kickstarter] The Roman E…
LUCKY_NOOB
On Parallel Lives in Fascis…
p4NDemik
The time I organised my…
AssyrianKing
Why I built Repalyzer (1.1.…
BlueStar
Innovate or Game Over?
TrAiDoS
ShieldBattery on Mac
Kraekkling
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 754 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
Netherlands7032 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
Japan1927 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 5h 53m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 96
EnDerr 1
StarCraft: Brood War
Shuttle 6169
Horang2 1323
Soulkey 547
Mini 327
firebathero 303
Rush 199
Light 184
Hyun 151
Last 117
Snow 91
[ Show more ]
Pusan 83
Sea.KH 59
sorry 30
sSak 29
ToSsGirL 25
Rock 17
Sacsri 14
Bishop 13
Icarus 7
Dota 2
Gorgc8828
Dendi845
XaKoH 299
XcaliburYe136
Counter-Strike
x6flipin630
Heroes of the Storm
Khaldor273
Other Games
singsing1755
B2W.Neo1232
PiGStarcraft299
RotterdaM267
Fuzer 254
DeMusliM173
crisheroes134
Beastyqt116
Rex47
Railgan12
Liquid`RaSZi0
Organizations
Other Games
EGCTV234
BasetradeTV138
StarCraft: Brood War
lovetv 10
[ Show 11 non-featured ]
StarCraft 2
• Adnapsc2 21
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV466
League of Legends
• Stunt561
Upcoming Events
BSL
5h 53m
Kyrie vs JDConan
Dewalt vs eOnzErG
Replay Cast
8h 53m
WardiTV Weekly
21h 53m
Ultimate Battle
21h 53m
Monday Night Weeklies
1d 2h
Sparkling Tuna Cup
1d 19h
PiGosaur Cup
2 days
The PondCast
3 days
KCM Race Survival
3 days
Replay Cast
4 days
[ Show More ]
CranKy Ducklings
5 days
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Sijosae Cup
RSL Offline Finals
Underdog Cup 2026 Div 2-3

Ongoing

Acropolis #5
KCM Race Survival 2026 Season 4
International ShieldBattery League
BSL Season 23
IPSL Winter 2026-27
CSL Season 23: Qualifier 1
Sector 591
CSL Season 23: Qualifier 2
Calamity Cup Div. A Season 8
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
PGL Masters Bucharest 2026
Stake Ranked Episode 5
1win Private Club #2
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026

Upcoming

YSL S4
SC4ALL II: Brood War
CSL 2026 Winter (S23) - 3v3
CSL 2026 Winter (S23)
NBSL 2026 Xiamen LAN
BSL 23: Non-Korean Championship
BSL 2v2 Season 4
HSC XXX
Stellar Fest 2: Lunar Cup
StarCraft2 Weekly Open Tournament 2026 Grand Finals
SC4ALL II: StarCraft II
PGL Cluj-Napoca 2027
IEM Kraków 2027
PGL Bucharest 2027
BLAST Bounty Winter 2027
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.