How can I watch a Starcraft 2 game?

I am interested in creating a parser for my own pleasure using PHP. What do i need to know? What suggestions do you have for me? How can I open a re-launch of Starcraft 2 using PHP?

+7
php parsing
source share
3 answers

The SC play file is an MPQ archive file. This MPQ archive contains several different files (for example, a .zip file).

Inside this archive are separate files for each data type in the MPQ archive. (For example, there is one file for game events, another for user interface events).

There are many documents on the Internet on how to handle MPQ files. Separate files in MPQ are now a little more complicated.

If you want to get information from the replay (who the players were and on which map they played), you can use these tools. (I assume a Unix-like web server).

1) Download and create libmpq and mpq-tools ( https://libmpq.org/ )

2) Run the following scripts

You can start them from the system () call, and then run several divided teams to get players and race.

Save this as info.sh. Run it as a command shell and pass it to the playback file as an argument.

#!/bin/bash # Save this file as info.sh # This extracts the individual files from the MPQ archive (the replay # file) mpq-extract -e $1 > /dev/null cat file000000.xxx | strings | ruby info.rb 

Here is a ruby ​​script. Save it as info.rb

 # This *kinda* extracts the file info from a header file. I don't # really know how it works yet, so I'm just extracting strings. # # Save this file as info.rb lines = STDIN.readlines puts "%s:%s|%s:%s" % [(lines[0].strip), (lines[1].strip), (lines[2].strip), (lines[3].strip)] 

Hope this helps!

+12
source share

Take a look at http://code.google.com/p/phpsc2replay/

I think this may be exactly what you are looking for. Of course, I would like for me to find it a month ago.

+2
source share

How do I open Starcraft 2 using PHP?

With any PHP file system features http://us.php.net/manual/en/ref.filesystem.php

Since most SC2 repeats seem rather small in size, you could leave with file_get_contents() to extract the entire file as a string.

+1
source share

All Articles