如何查看《星际争霸 2》重播?
我有兴趣使用 PHP 构建一个解析器供我自己享受。我需要知道什么?您对我有什么建议?如何使用 PHP 打开《星际争霸 2》重播?
I am interested in building a parser for my own enjoyment using PHP. What do I need to know? What suggestions would you have for me? How do I even open a Starcraft 2 replay using PHP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
SC重放文件实际上是MPQ存档文件。此 MPQ 存档包含一些不同的文件(如 .zip 文件)。
该存档中包含 MPQ 存档中每种数据类型的单独文件。
(例如,有一个文件用于游戏事件,另一个文件用于 UI 事件)。
网上有大量关于如何处理 MPQ 文件的文档。现在,MPQ 中的各个文件有点棘手。
如果您想从重播中获取信息(玩家是谁以及他们玩的地图),您可以使用这些工具。 (我假设有一个类似 Unix 的网络服务器)。
1) 下载并构建 libmpq 和 mpq-tools (https://libmpq.org/ )
2) 运行以下脚本
您可以通过 system() 调用运行这些命令,然后运行一些拆分命令来获取玩家和比赛。
将其保存为 info.sh。像命令 shell 一样运行它,并将重播文件作为参数传递。
这是一个 ruby 脚本。将其另存为 info.rb
希望这有帮助!
The SC replay file is actually an MPQ archive file. This MPQ archive contains a few different files (like a .zip file).
Inside this archive are separate files for each of the types of data in the MPQ archive.
(For example there is one file for game events and another for UI events).
There is a fair amount of documentation online about how to deal with MPQ files. Now, the individual files within the MPQ is a bit trickier.
If you want to get the information from the replay (who the players were and what map they played on) you can use these tools. (I'm assuming a Unix like web server).
1) Download and build libmpq and mpq-tools (https://libmpq.org/ )
2) Run the following scripts
You can run these from a system() call and then run a few split commands to get the players and the race.
Save this as info.sh. Run it like a command shell and pass in the replay file as an argument.
Here is a ruby script. Save this as info.rb
Hope this helps!
看看 http://code.google.com/p/phpsc2replay/
我想它可能正是您正在寻找的。我当然希望我一个月前就找到了它。
Take a look at http://code.google.com/p/phpsc2replay/
I think it may be exactly what you are looking for. I certainly wish I had found it a month ago.
使用任何 PHP 文件系统函数 http://us.php.net/manual/en /ref.filesystem.php
由于大多数 SC2 重播的大小似乎相当小,您可能可以使用
file_get_contents()
将整个文件作为字符串检索。With any of PHP's filesystem functions http://us.php.net/manual/en/ref.filesystem.php
Since most SC2 replays seem to be fairly small in size you could probably get away with
file_get_contents()
to retrieve the entire file as a string.