• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:18
CEST 13:18
KST 20:18
  • 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
Team TLMC #5 - Finalists & Open Tournaments0[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
BSL 2025 Warsaw LAN + Legends Showmatch0Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29
StarCraft 2
General
#1: Maru - Greatest Players of All Time Weekly Cups (Sept 8-14): herO & MaxPax split cups Team Liquid Map Contest #21 - Presented by Monster Energy SpeCial on The Tasteless Podcast Team TLMC #5 - Finalists & Open Tournaments
Tourneys
RSL: Revival, a new crowdfunded tournament series Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia WardiTV TL Team Map Contest #5 Tournaments
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
ASL20 General Discussion ASL TICKET LIVE help! :D Soulkey on ASL S20 BW General Discussion NaDa's Body
Tourneys
[ASL20] Ro16 Group D [ASL20] Ro16 Group C [Megathread] Daily Proleagues BSL 2025 Warsaw LAN + Legends Showmatch
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread UK Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
I <=> 9
KrillinFromwales
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1985 users

BWAPI, and an inside look into StarCraft's code

Forum Index > BW General
Post a Reply
1 2 Next All
Sonko
Profile Joined February 2019
154 Posts
Last Edited: 2019-11-14 14:46:20
October 18 2019 08:40 GMT
#1
Hi dear people of TL forums,

A while ago, I started working on Brood War bot development. During this endeavor, I decided to write a book about it - and one of the chapters of this will be dissecting the code of StarCraft itself. This is quite an undertaking, but I'm making progress with it. Don't let the title "Brood War API" fool you, if you're a gamer, you might still find it interesting!

Here are the posts I have so far. I plan to post updates in this forum in the future, as I publish the episodes:
(Last update: 2019-11-14)

Brood War API – The Comprehensive Guide (of time and space)
Brood War API – The Comprehensive Guide – Distances, high ground, and unit behavior
Brood War API – The Comprehensive Guide – Unit movement, and worker behavior
Brood War API – The Comprehensive Guide: Creating buildings, and everything about the creep
Brood War API – The Comprehensive Guide: Buildings, and placement
Brood War API – The Comprehensive Guide: Movement modifiers, and Terran units
Brood War API – The Comprehensive Guide: Terran units continued, and some Zerg ones


Feel free to ask questions, point out mistakes/typos! I have a pretty good plan how I want to proceed with the topics within the book, and I'd like to publish updates at least weekly.

Enjoy!
Sonko

A site about brood war AI: www.makingcomputerdothings.com
Turbovolver
Profile Blog Joined January 2009
Australia2394 Posts
October 18 2019 11:36 GMT
#2
Nice work! I had a skim through it and even that taught me some things. A question though, what is the deal with detectors and moving? I wasn't aware that moving had any effect on a detector's ability to detect? Or is this just about its "detection region" only being updated every so often, ala sight?
The original Bogus fan.
WombaT
Profile Blog Joined May 2010
Northern Ireland25665 Posts
October 18 2019 11:42 GMT
#3
Ah great, been looking for some light reading material!

Joking aside this is pretty cool, look forward to having a proper look later today.
'You'll always be the cuddly marsupial of my heart, despite the inherent flaws of your ancestry' - Squat
Sonko
Profile Joined February 2019
154 Posts
October 18 2019 11:51 GMT
#4
Thanks for the feedback!
. A question though, what is the deal with detectors and moving? I wasn't aware that moving had any effect on a detector's ability to detect?


I don't really get your question here Can you maybe quote the part that implies that?
A site about brood war AI: www.makingcomputerdothings.com
Turbovolver
Profile Blog Joined January 2009
Australia2394 Posts
Last Edited: 2019-10-18 13:05:20
October 18 2019 13:05 GMT
#5
[quote=Sonko]Detector: If the unit is immobile, it can detect cloaked units within its sight range. If it’ mobile, it’s not constant. Blinded, incomplete, or disabled units cannot detect, and neither do hallucinations.[/quote]
This was the text that I wasn't sure about. "If it's mobile, it's not constant".

I thought that meant moving units versus stopped units, but I'm guessing the distinction is between say, a missile turret and a science vessel? And you just mean that the region detected is not constant for a moving unit?

(which of course makes perfect sense)
The original Bogus fan.
Sonko
Profile Joined February 2019
154 Posts
October 18 2019 13:11 GMT
#6
Yes, you're correct Maybe I'll rephrase that to be more clear.
A site about brood war AI: www.makingcomputerdothings.com
tankgirl
Profile Blog Joined May 2016
Canada421 Posts
October 18 2019 21:21 GMT
#7
How did you get the SC source code?
https://tl.net/forum/brood-war/627255-progamer-settings
TL+ Member
Sonko
Profile Joined February 2019
154 Posts
October 18 2019 21:46 GMT
#8
The short answer is I didn't I use openBW, a decompiled source - see the first article
A site about brood war AI: www.makingcomputerdothings.com
TelecoM
Profile Blog Joined January 2010
United States10675 Posts
October 18 2019 23:25 GMT
#9
Wow this is really interesting stuff... thanks for sharing! The coding is crazy lol
AKA: TelecoM[WHITE] Protoss fighting
Sonko
Profile Joined February 2019
154 Posts
October 19 2019 10:09 GMT
#10
And the next part is here: About buildings, and unit placement. This has been one of the hardest to research so far. Enjoy, and don't hesitate to ask if anything is not clear!
https://makingcomputerdothings.com/brood-war-api-the-comprehensive-guide-buildings-and-placement/
A site about brood war AI: www.makingcomputerdothings.com
Freakling
Profile Joined October 2012
Germany1529 Posts
Last Edited: 2019-10-19 12:55:36
October 19 2019 12:41 GMT
#11
Hero defiler (Unclean One) also has a different collision box than a regular Defiler.

For presenting tile/subtile grids you should better use screenshots from SCMDraft with walkability flag overlay.

People less versed in the OpenBW code, or coding in general, would probably like it if you would explain variable types and other definitions a bit.

The switching into additional terrain flags (cover, terrain level) also comes a bit sudden. You probably should write a more elaborate introduction to terrain flags first (you brush on all of it a bit, but I don't think it is very comprendable without prior knowledge).

The relationship between walkability and buildability is actually… a bit complicated… (Partially) unwalkable, but buildable tiles have some very interesting and useful effects.
PVJ
Profile Blog Joined July 2012
Hungary5221 Posts
October 21 2019 00:03 GMT
#12
Very interesting keep up the good work!
The heart's eternal vow
TelecoM
Profile Blog Joined January 2010
United States10675 Posts
October 21 2019 02:53 GMT
#13
Does APM / speed of hand / latency / ping affect how units work / attack / move or is that all in my head?
AKA: TelecoM[WHITE] Protoss fighting
Sonko
Profile Joined February 2019
154 Posts
October 21 2019 09:03 GMT
#14
"Does APM / speed of hand / latency / ping affect how units work / attack / move or is that all in my head?"

Latency is something you have to compensate for at some point, if you develop an AI. Other than that, they do, but not in the code
A site about brood war AI: www.makingcomputerdothings.com
Sonko
Profile Joined February 2019
154 Posts
October 21 2019 11:48 GMT
#15
And I missed one post:
Creating buildings, and everything about the creep - nipicking/proofreading/questioning of the things are always welcome!
A site about brood war AI: www.makingcomputerdothings.com
Akio
Profile Blog Joined January 2019
Finland1838 Posts
October 21 2019 12:51 GMT
#16
I know close to nothing about coding but this is super interesting! Thanks for sharing
Mine gas, build tanks.
Sonko
Profile Joined February 2019
154 Posts
October 22 2019 21:33 GMT
#17
You're welcome Also, if you want to get into programming, this is a great project. Many students have walked that path before
A site about brood war AI: www.makingcomputerdothings.com
Sonko
Profile Joined February 2019
154 Posts
October 24 2019 09:42 GMT
#18
Thanks everyone for the feedback! I corrected a few minor things, and rephrased stuff. I plan to release the next article soon!
A site about brood war AI: www.makingcomputerdothings.com
[UoN]Sentinel
Profile Blog Joined November 2009
United States11320 Posts
October 26 2019 03:44 GMT
#19
Really enjoyed your series on molesting crabs and such, looking forward to your newest deep dive!
Нас зовет дух отцов, память старых бойцов, дух Москвы и твердыня Полтавы
Sonko
Profile Joined February 2019
154 Posts
October 27 2019 09:23 GMT
#20
And the next part is here. It's a little all over the place, I extended and revised some of the earlier parts, and added stuff here. Anyway, it's about movement modifiers, and code behind Terran units.

Read it here!
A site about brood war AI: www.makingcomputerdothings.com
1 2 Next All
Please log in or register to reply.
Live Events Refresh
Map Test Tournament
11:00
$450 3v3 Open Cup
WardiTV79
LiquipediaDiscussion
RSL Revival
10:00
Season 2: Playoffs Day 5
Maru vs ReynorLIVE!
Cure vs TriGGeR
Tasteless925
Crank 659
IndyStarCraft 139
CranKy Ducklings96
3DClanTV 88
Rex87
IntoTheiNu 33
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Tasteless 925
Crank 659
IndyStarCraft 139
Rex 87
Lowko36
StarCraft: Brood War
Britney 11576
Calm 7955
Bisu 1323
Horang2 964
Hyuk 567
actioN 327
Stork 309
ZerO 265
Pusan 206
Mini 205
[ Show more ]
EffOrt 179
Snow 163
Hyun 156
Last 152
Light 127
Soma 123
Soulkey 73
Liquid`Ret 72
sorry 67
ggaemo 62
Mind 50
ToSsGirL 48
hero 46
HiyA 33
Rush 31
Free 27
Sharp 27
scan(afreeca) 20
JYJ13
Terrorterran 13
Sexy 11
SilentControl 11
sas.Sziky 10
Icarus 2
Dota 2
singsing2655
XcaliburYe160
Counter-Strike
olofmeister1692
shoxiejesuss599
x6flipin506
edward49
Other Games
B2W.Neo433
DeMusliM184
XaKoH 134
Pyrionflax103
NeuroSwarm47
Trikslyr6
Organizations
StarCraft: Brood War
Kim Chul Min (afreeca) 845
CasterMuse 15
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1670
Other Games
• WagamamaTV178
Upcoming Events
The PondCast
1h 42m
RSL Revival
22h 42m
Zoun vs Classic
Korean StarCraft League
1d 15h
BSL Open LAN 2025 - War…
1d 20h
RSL Revival
1d 22h
BSL Open LAN 2025 - War…
2 days
RSL Revival
2 days
Online Event
3 days
Wardi Open
3 days
Monday Night Weeklies
4 days
[ Show More ]
Sparkling Tuna Cup
4 days
LiuLi Cup
6 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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 © 2025 TLnet. All Rights Reserved.