• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 08:20
CET 14:20
KST 22:20
  • 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
ComeBackTV's documentary on Byun's Career !1Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win1Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
ComeBackTV's documentary on Byun's Career ! Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win Did they add GM to 2v2? RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship StarCraft2.fi 15th Anniversary Cup RSL Offline Finals Info - Dec 13 and 14! Tenacious Turtle Tussle
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle How Rain Became ProGamer in Just 3 Months [BSL21] RO8 Bracket & Prediction Contest BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] RO8 - Day 2 - Sunday 21:00 CET [ASL20] Grand Finals [BSL21] RO8 - Day 1 - Saturday 21:00 CET
Strategy
Current Meta Simple Questions, Simple Answers Game Theory for Starcraft Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV ZeroSpace Megathread The 2048 Game Path of Exile
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 Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine YouTube Thread European Politico-economics QA Mega-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
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
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: 1681 users

I Made A Replay Syncer

Blogs > sztanpet
Post a Reply
sztanpet
Profile Blog Joined April 2010
Hungary44 Posts
May 13 2011 23:47 GMT
#1
I was a bit bored, and thought would make a very simple replay syncer and in the process learn about windows system programming.
This is the result:
[image loading]

Very simplistic, there is no NAT traversal or anything, you punch in the port you want to make the server on, and you punch in the IP and port if you want to connect. If your computer is not directly accessible from the internet, you will have to set up port-forwarding or configure your firewall correctly.
It uses UDP as its protocol.

How does it do its thing?
You set up the server, clients connect and every 200 miliseconds we send everyone a message with a timestamp, who then send it back. We now know our ping towards that connection.
When receiving the start command, a 5 second delay will start after which the application sends the Starcraft II window the "p" button press. The delay takes the ping into account to achieve as exact of a synchronization as possible.
No install, just a single executable.

What do you need to run the code?
.Net framework version 4 (that limits it to XP sp2 and up I think)

There must be countless bugs in the code I'm sure, and I'm new to this, so be gentle with your criticism. The code is open source and available at https://github.com/sztanpet/SC2ReplaySync I plan to license it as GPLv2 but was too lazy to add the necessary things as of yet.

The binary can be downloaded from here.

Customization features will be the most requested feature I'm guessing, but I do not have much time to work on this, but it's in the works. Also the way we detect the SC2 window is english specific so I'm guessing it wont work on non-english clients.

Hope someone finds it usefull

*****
sztanpet
Profile Blog Joined April 2010
Hungary44 Posts
May 13 2011 23:50 GMT
#2
Currently known things about the code include: because UDP is a "stateless" protocol we don't actually check if the other end of the connection is still there or not, so even after a client disconnects, the server sends pings. Not a biggie I think.
frogmelter
Profile Blog Joined April 2009
United States971 Posts
May 14 2011 00:17 GMT
#3
Wow this is a pretty amazing tool

Thanks for making it

Slight desyncs in replays are pretty frustrating
TL+ Member
Gonff
Profile Joined May 2010
United States686 Posts
May 14 2011 02:42 GMT
#4
On May 14 2011 09:17 frogmelter wrote:
Wow this is a pretty amazing tool

Thanks for making it

Slight desyncs in replays are pretty frustrating

Agreed. I get really annoyed when casters' replays aren't synched. Hopefully they start using this tool to save us and themselves from further frustration.
Maliris
Profile Blog Joined April 2011
Northern Ireland2557 Posts
Last Edited: 2011-05-14 04:00:34
May 14 2011 03:13 GMT
#5
wow, nice tool, certainly very helpful for casting. hope more people use this so we don't get instances like clash of the titans (T_T)
"Religion is something left over from the infancy of our intelligence, it will fade away as we adopt reason and science as our guidelines."
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
May 14 2011 03:39 GMT
#6
So what's going on, you both connect to the server which syncs the two systems and then tries to unpause the replay at the same time? And since you are using UDP, what do you do if the unpause packet doesn't reach one or more sides? Though I assume you probably manually doing something at the application level that tries to do packet acknowledgement? Or is this working completely differently from what I think D:

Hehe curious for more details ^^
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
May 14 2011 05:32 GMT
#7
Very cool, nice work. I don't want to take away from it at all, but I don't think this is the main issue with trying to do replays at the same time. The main issue is that SC2 actually plays back the game slightly faster or slower based on your computer. So even if you start at exactly the same time, you can get seconds apart over the course of a longer game (which we've seen recently in TSL for example). =\
Comprehensive strategic intention: DNE
Sermokala
Profile Blog Joined November 2010
United States14051 Posts
May 14 2011 06:09 GMT
#8
really surprised that this hasn't been created yet.

Very well done sir you should Have named it after youself I think its fitting for it.
A wise man will say that he knows nothing. We're gona party like its 2752 Hail Dark Brandon
sztanpet
Profile Blog Joined April 2010
Hungary44 Posts
May 14 2011 07:50 GMT
#9
On May 14 2011 12:39 EtherealDeath wrote:
So what's going on, you both connect to the server which syncs the two systems and then tries to unpause the replay at the same time? And since you are using UDP, what do you do if the unpause packet doesn't reach one or more sides? Though I assume you probably manually doing something at the application level that tries to do packet acknowledgement? Or is this working completely differently from what I think D:

Hehe curious for more details ^^


nope, no ack or anything, that might be a good idea now that you mention it tho
Raelcun
Profile Blog Joined March 2008
United States3747 Posts
May 14 2011 08:10 GMT
#10
The problem with this is starting the replay at the same time is not the issue when it comes to casting. Computers actually process the replays at different speeds and desync over time is the bigger issue.
Flavalanche
Profile Joined May 2010
United States164 Posts
May 14 2011 13:49 GMT
#11
Oh wow this is great. gj on making this, maybe blizzard will integrate it :D
Sup.
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
Last Edited: 2011-05-14 22:12:42
May 14 2011 22:00 GMT
#12
On May 14 2011 17:10 iCCup.Raelcun wrote:
The problem with this is starting the replay at the same time is not the issue when it comes to casting. Computers actually process the replays at different speeds and desync over time is the bigger issue.


Yea that's what I thought.

What I had thought this might/should be doing (and this would be dependent on how quickly it is possible to pause/unpause at the application level - one can imagine that if pause/unpause actually has negligible native latency of action, then one could play the replay at speeds such as 0.8x faster through throttling of pause/unpause, though from the user interface level it seems that there is nontrivial pause/unpause latency). But, assuming you could pause/unpause very quickly in order to create a smooth and throttle-able replay, then at the initial synchronization, you would use NTP to synchronize the clocks of the computers involved. Thereafter, each sync packet would contain both the current gametime and the current clocktime, and you would make some algorithm which works above the network layer of the application in order to determine how much you need to throttle the replay speed. This may involve saving state information, i.e. what the local gametime/clocktime data has been over the last minute or something. I'm not sure how often you would want to throttle in order to preserve a relatively stable replay speed with not much "slowdown" - maybe constant throttling? Might have to test empirically.

Maybe you would save state information every 250ms or so, so 4 states per second. It is kind of unfortunate that game seconds and real seconds don't match up - maybe instead you would use a frame time that corresponds to something like 1/4 a game second. Various variables to test out!

But, none of this would work very well if you can't pause/unpause smoothly at the application level.

I suppose, if you can't pause/unpause smoothly, then we could let there be some allowable desync - say, within 1.5 game seconds or something (but even that is probably too large, so maybe in practice it must be within 1 game second or even less). This would be done using the same gametime/clocktime pairs mentioned above. If one party gets ahead, then the party which is ahead serves as the client which initiates a 3-way handshake agreeing to pause the game at some gametime in the near future. The party which is behind then initiaties the unpause handshake (to unpause at some specified clocktime) once the pause has been done. Of course, in case of various reverse desyncing, in order to agree to unpause the party which previous was ahead must check that it actually has paused the game before handshaking. Once the handshake is complete, then we resume.

I'm not sure how annoying it would be to watch if the two computers kept desyncing like mad, since you might pause a lot, but in that case I suppose you'd be screwed for casting anyways. The smoothness I suppose would be a function of the desync window you allow, but then again, the length of the pause will be somewhat related to this as well - I don't think the combined delay inherent in handshaking would combine to be more than a second, so the desync window may be equal or even a couple times greater in temporal length. edit - On second thought you would probably have to set the unpause time a few seconds into the future in order to allow for possible network burps so you don't screw yourself over in terms of how many times you interpret a possible packet loss or something.

Whew that was a long post lol.
sztanpet
Profile Blog Joined April 2010
Hungary44 Posts
Last Edited: 2011-05-15 12:01:42
May 15 2011 12:00 GMT
#13
yea, thought about that, not even trying to implement some of the ideas in there, desync is a non-issue for me and "its good enough"
patches welcome though
kyarisan
Profile Joined May 2010
United States347 Posts
May 15 2011 14:07 GMT
#14
i have a question about the relative replay speed on different machines, to those who might understand the issue better:

if having relative replay speeds on different machines with identical replays and settings is what is preventing blizzard from implementing group replay watching, how is the game itself somehow magically synchronized between two players but this concept somehow does not forward into replays as well? very confusing double standard to someone who doesnt have it all figured out such as myself.
EtherealDeath
Profile Blog Joined July 2007
United States8366 Posts
May 15 2011 18:08 GMT
#15
On May 15 2011 23:07 kyarisan wrote:
i have a question about the relative replay speed on different machines, to those who might understand the issue better:

if having relative replay speeds on different machines with identical replays and settings is what is preventing blizzard from implementing group replay watching, how is the game itself somehow magically synchronized between two players but this concept somehow does not forward into replays as well? very confusing double standard to someone who doesnt have it all figured out such as myself.


It slows down gameplay if sync packets are not yet received - like, it literally pauses the game. Try throttling your available SC bandwidth in game, you'll see, once you make the packets queue up a lot.
Please log in or register to reply.
Live Events Refresh
WardiTV 2025
12:00
Playoffs
Rogue vs NiceLIVE!
Spirit vs TBD
Scarlett vs Reynor
TBD vs Clem
uThermal vs Shameless
WardiTV859
ComeBackTV 429
TaKeTV 226
Rex117
IndyStarCraft 110
LiquipediaDiscussion
Sparkling Tuna Cup
10:00
Weekly #115
Ryung vs KrystianerLIVE!
ByuN vs Percival
CranKy Ducklings97
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko261
RotterdaM 139
Rex 117
IndyStarCraft 110
BRAT_OK 78
StarCraft: Brood War
Sea 3785
Rain 3257
Bisu 1219
Jaedong 813
GuemChi 774
Soma 741
BeSt 461
Hyuk 416
actioN 383
Mini 356
[ Show more ]
Stork 260
Larva 249
EffOrt 240
firebathero 216
Rush 175
Light 146
Hyun 114
hero 96
Snow 91
JYJ 70
Sea.KH 63
Killer 59
Aegong 40
Terrorterran 27
Mind 26
sorry 26
Mong 20
scan(afreeca) 16
Icarus 16
Bale 13
GoRush 7
910 0
Dota 2
qojqva769
BananaSlamJamma448
420jenkins335
XcaliburYe182
capcasts54
League of Legends
C9.Mang0331
Counter-Strike
olofmeister1668
x6flipin626
byalli357
allub207
Other Games
B2W.Neo1519
Pyrionflax363
Fuzer 285
Hui .185
QueenE46
hiko36
ArmadaUGS34
Trikslyr28
Chillindude4
Organizations
StarCraft: Brood War
UltimateBattle 1412
lovetv 8
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
• HerbMon 2
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV778
League of Legends
• Jankos2671
Upcoming Events
PiGosaur Cup
11h 40m
WardiTV 2025
22h 40m
MaNa vs Gerald
TBD vs MaxPax
ByuN vs TBD
TBD vs ShoWTimE
OSC
1d 1h
YoungYakov vs Mixu
ForJumy vs TBD
Percival vs TBD
Shameless vs TBD
The PondCast
1d 20h
WardiTV 2025
1d 23h
Cure vs Creator
TBD vs Solar
WardiTV 2025
2 days
OSC
3 days
CranKy Ducklings
3 days
SC Evo League
3 days
Ladder Legends
4 days
[ Show More ]
BSL 21
4 days
Sparkling Tuna Cup
4 days
Ladder Legends
5 days
BSL 21
5 days
Replay Cast
5 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
META Madness #9
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
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 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.