• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 20:13
CET 02:13
KST 10:13
  • 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
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge1[TLMC] Fall/Winter 2025 Ladder Map Rotation13Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45
StarCraft 2
General
RotterdaM "Serral is the GOAT, and it's not close" Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge [TLMC] Fall/Winter 2025 Ladder Map Rotation Mech is the composition that needs teleportation t RSL Season 3 - RO16 Groups C & D Preview
Tourneys
2025 RSL Offline Finals Dates + Ticket Sales! $5,000+ WardiTV 2025 Championship RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle What happened to TvZ on Retro? BGH Auto Balance -> http://bghmmr.eu/ SnOw's ASL S20 Finals Review BW General Discussion
Tourneys
[BSL21] GosuLeague T1 Ro16 - Tue & Thu 22:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET
Strategy
Current Meta How to stay on top of macro? PvZ map balance Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Clair Obscur - Expedition 33 Should offensive tower rushing be viable in RTS games? Path of Exile Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread The Games Industry And ATVI Things Aren’t Peaceful in Palestine About SC2SEA.COM
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2190 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 Ireland26058 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
Canada426 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 States10682 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 States10682 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
ChoboTeamLeague
01:00
S33 Finals FxB vs Chumpions
Discussion
Replay Cast
23:00
WardiTV Mondays #60
CranKy Ducklings122
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft459
Nina 59
Nathanias 13
trigger 3
StarCraft: Brood War
NaDa 58
Sexy 32
yabsab 6
Dota 2
monkeys_forever214
NeuroSwarm76
League of Legends
Cuddl3bear1
Super Smash Bros
hungrybox380
AZ_Axe69
PPMD23
Other Games
summit1g6695
Grubby3488
JimRising 359
C9.Mang0255
Maynarde154
Trikslyr38
ToD17
febbydoto4
Organizations
Other Games
gamesdonequick856
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 75
• davetesta12
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• HerbMon 43
• Azhi_Dahaki29
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21098
League of Legends
• Doublelift2690
• Scarra998
Other Games
• imaqtpie1181
Upcoming Events
WardiTV Korean Royale
10h 47m
BSL: GosuLeague
19h 47m
PiGosaur Cup
23h 47m
The PondCast
1d 8h
Replay Cast
1d 21h
RSL Revival
2 days
herO vs Zoun
Classic vs Reynor
Maru vs SHIN
MaxPax vs TriGGeR
BSL: GosuLeague
2 days
RSL Revival
3 days
WardiTV Korean Royale
3 days
RSL Revival
4 days
[ Show More ]
WardiTV Korean Royale
4 days
IPSL
4 days
Julia vs Artosis
JDConan vs DragOn
RSL Revival
5 days
Wardi Open
5 days
IPSL
5 days
StRyKeR vs OldBoy
Sziky vs Tarson
Replay Cast
5 days
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2025-11-14
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
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.