• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 06:38
CET 12:38
KST 20:38
  • 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 Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !10Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies ComeBackTV's documentary on Byun's Career ! Micro Lags When Playing SC2? When will we find out if there are more tournament Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win
Tourneys
$100 Prize Pool - Winter Warp Gate Masters Showdow $5,000+ WardiTV 2025 Championship Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1 RSL Offline Finals Info - Dec 13 and 14!
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle soO on: FanTaSy's Potential Return to StarCraft BGH Auto Balance -> http://bghmmr.eu/ Anyone remember me from 2000s Bnet EAST server?
Tourneys
[Megathread] Daily Proleagues [BSL21] LB QuarterFinals - Sunday 21:00 CET Small VOD Thread 2.0 [BSL21] WB SEMIFINALS - Saturday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile General RTS Discussion 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
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
The (Hidden) Drug Problem in…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 958 users

pyreplib - Python library to read .rep files

Forum Index > BW General
Post a Reply
1 2 3 Next All
gnuvince
Profile Joined June 2007
Canada73 Posts
Last Edited: 2008-06-30 19:24:28
June 30 2008 19:21 GMT
#1
Hello everybody,

I've been working on a Python (the programming language) library for the past week to read .rep files. The project is aptly named pyreplib and is far from being complete. Nevertheless, I thought I'd post about the work I've done so far and get some input.


The library currently only reads the header information (map and players information, game engine, replay time, etc.) The game actions will be coming soon, of course. I intend to make the source code available via Google Code once I get unit tests (and clean up the trunk )

One feature I intend to implement is dumping a .rep file to the JSON, XML and YAML formats, 'cause those are way easier for developers to toy around with.

Here's a sample session with the Python interactive interpreter:


>>> import pyreplib

>>> rep = pyreplib.Replay('foo.rep')

>>> print rep.game_name
chosen

>>> print rep.map_name
| iCCup | Blue Storm 1.2

>>> print rep.map_width, rep.map_height
128 96

>>> print rep.date
2008-06-24 16:32:26

>>> for player in rep.players:
... print '%s:\t%s' % (player.name, player.race_name)
...

Excello.ChOseN: Zerg
ToT)ClouD(: Protoss
Kachiun: Terran
Excello.DetO: Zerg
ToT)iNfeRnaL(: Protoss


Let me know what you think! (Pretty interested in Taiche's feedback)
chebychev
Profile Joined May 2008
United States4 Posts
June 30 2008 20:54 GMT
#2
This sounds awesome. Would love to get that code and have my IRC bot announce games as they occur ("<IRCBot> X has just beat Y in Starcraft on Blue Storm"). Could have a plugin for ChaosLauncher that uploads the replays automatically.

As for actions, it would be really nice to get APM too!
Taiche *
Profile Blog Joined December 2004
France1963 Posts
June 30 2008 21:05 GMT
#3
Wow nice ! I didn't think you'd do it so quickly. How did you handle the compression algorithm ?
Manifesto7 Uses ReXplorer, and so should you! : http://repasm.net/rx/
gnuvince
Profile Joined June 2007
Canada73 Posts
Last Edited: 2008-06-30 21:20:19
June 30 2008 21:17 GMT
#4
chebychev: What bot do you use? There's a Python bot that I really like, supybot and it has a plugin system, so it would definitely be feasible.

Taiche: I just used the Python C API to call jca's unpack_section() and return the value as a nice Python string. From then on, it was a piece of cake to use the struct module from Python's standard library to unpack the data.
Taiche *
Profile Blog Joined December 2004
France1963 Posts
June 30 2008 21:21 GMT
#5
Yeah, unpacking the whole stuff is the only big issue ; once you know what data does what, then it's easy.
Good job, keep it going
Manifesto7 Uses ReXplorer, and so should you! : http://repasm.net/rx/
chebychev
Profile Joined May 2008
United States4 Posts
June 30 2008 21:37 GMT
#6
I have a homegrown bot which has been my Python-learning platform the past few years It has a plugin architecture, though I'm sure it's not anywhere as advanced as supybot. Anyway, can't wait til your code is released. Let me know if I can help, test, whatever.
zatic
Profile Blog Joined September 2007
Zurich15358 Posts
June 30 2008 22:18 GMT
#7
Wow this is soo cool! Please let me know when there is code to play with!
ModeratorI know Teamliquid is known as a massive building
Goosey
Profile Blog Joined September 2005
United States695 Posts
June 30 2008 23:12 GMT
#8
Nice. Python is a really good language, would love to mess around with this.
#1 Shuttle Fan.
gnuvince
Profile Joined June 2007
Canada73 Posts
June 30 2008 23:14 GMT
#9
I'm very happy to see that there's interest here. I have tomorrow off (Canada's Day, eh!) so I'll work on the project more and hopefully have something to show by the weekend.
Raithed
Profile Blog Joined May 2007
China7078 Posts
June 30 2008 23:44 GMT
#10
thats the whole code? what the.
gnuvince
Profile Joined June 2007
Canada73 Posts
June 30 2008 23:51 GMT
#11
Raithed: that's not the whole code. That's a sample of how you'd use it. Of course, under the hood there's a lot more.
Archaic
Profile Blog Joined March 2008
United States4024 Posts
July 01 2008 00:16 GMT
#12
At first I thought this was literally a library for all python replays, but I was wrong.

Great work, btw.
anotak
Profile Blog Joined March 2008
United States1537 Posts
July 01 2008 01:26 GMT
#13
thank you very much, i've been hoping for something like this myself.

i'll be sure and download it once it's released
riptide
Profile Blog Joined July 2007
5673 Posts
July 01 2008 01:55 GMT
#14
I'm moderately skilled in py and would love to help you write an IRC bot plugin if needed. I've done that sorta thing before, so let me know. Good work mate.
AdministratorSKT T1 | Masters of the Universe
gravity
Profile Joined March 2004
Australia1988 Posts
Last Edited: 2008-07-01 04:48:45
July 01 2008 04:45 GMT
#15
Oh sweet, I was wondering if something like this existed, it could be very helpful for certain types of analysis. I don't actually know Python yet though but that's another issue .
gnuvince
Profile Joined June 2007
Canada73 Posts
Last Edited: 2008-07-02 16:56:07
July 02 2008 16:54 GMT
#16
On July 01 2008 13:45 gravity wrote:
Oh sweet, I was wondering if something like this existed, it could be very helpful for certain types of analysis. I don't actually know Python yet though but that's another issue .


There are TONS of good resources for learning it online. The official web page is one place. If you already know programming, the free book "Diving Into Python" is pretty good. If you're new to programming "Thinking Like a Computer Scientist in Python" is good choice too (free also.)

Edit: links:

http://diveintopython.org/toc/index.html
http://www.greenteapress.com/thinkpython/html/
CaucasianAsian
Profile Blog Joined September 2005
Korea (South)11587 Posts
July 02 2008 17:20 GMT
#17
i'm kinda confused what will be different between this and BWChart?
Calendar@ Fish Server: `iOps]..Stark
Raithed
Profile Blog Joined May 2007
China7078 Posts
July 02 2008 17:23 GMT
#18
py kinda resembles c or something alike, whats the different? more data, less junk?
overpool
Profile Joined April 2008
United States191 Posts
July 02 2008 17:28 GMT
#19
On July 01 2008 04:21 gnuvince wrote:
One feature I intend to implement is dumping a .rep file to the JSON, XML and YAML formats, 'cause those are way easier for developers to toy around with.

Awesome idea.

Although I must be the only person in the world who doesn't like python T_T
yay i love tl events
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
July 02 2008 17:31 GMT
#20
Ahh not sure if it's possible but is it possible to make a Starcraft screensaver that plays replays?
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
Next event in 23m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 273
DivinesiaTV 44
Rex 20
StarCraft: Brood War
Sea 16887
Aegong 2050
Horang2 1791
BeSt 660
Bisu 534
Hyun 443
Stork 329
actioN 298
Soma 295
Shuttle 245
[ Show more ]
firebathero 218
hero 141
Last 133
Mini 114
Larva 93
Rush 91
Snow 57
ToSsGirL 55
Barracks 51
Pusan 46
ggaemo 45
Killer 45
Mind 43
PianO 43
Sacsri 27
sorry 23
JYJ 21
soO 20
yabsab 20
zelot 20
Shinee 19
Movie 17
HiyA 16
GoRush 11
scan(afreeca) 11
SilentControl 8
JulyZerg 8
Icarus 4
Dota 2
XcaliburYe989
League of Legends
JimRising 392
C9.Mang0332
rGuardiaN78
Counter-Strike
zeus3428
x6flipin878
edward148
Super Smash Bros
Mew2King173
Other Games
B2W.Neo892
crisheroes212
mouzStarbuck190
Hui .98
BRAT_OK 26
Organizations
StarCraft: Brood War
lovetv 5
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• StrangeGG 86
• LUISG 41
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV1851
• Noizen29
League of Legends
• Jankos3729
• HappyZerGling119
Upcoming Events
WardiTV Invitational
23m
Gerald vs YoungYakov
Spirit vs MaNa
SHIN vs Percival
Creator vs Scarlett
IndyStarCraft 273
Replay Cast
21h 23m
WardiTV Invitational
1d
ByuN vs Solar
Clem vs Classic
Cure vs herO
Reynor vs MaxPax
Replay Cast
2 days
Sparkling Tuna Cup
3 days
Krystianer vs TBD
TriGGeR vs SKillous
Percival vs TBD
ByuN vs Nicoract
Replay Cast
4 days
Wardi Open
5 days
Liquipedia Results

Completed

Proleague 2025-12-22
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.