gpt4 book ai didi

php - 我如何查看星际争霸 2 重播?

转载 作者:可可西里 更新时间:2023-11-01 12:47:16 25 4
gpt4 key购买 nike

我有兴趣使用 PHP 构建一个解析器来享受我的乐趣。我需要知道什么?你对我有什么建议?我什至如何使用 PHP 打开星际争霸 2 重播?

最佳答案

SC 回放文件实际上是一个 MPQ 存档文件。此 MPQ 存档包含几个不同的文件(如 .zip 文件)。

在这个文件中,MPQ 文件中的每种数据类型都有单独的文件。(例如,一个文件用于游戏事件,另一个文件用于 UI 事件)。

网上有大量关于如何处理 MPQ 文件的文档。现在,MPQ 中的单个文件有点棘手。

如果您想从回放中获取信息(玩家是谁以及他们玩过的 map ),您可以使用这些工具。 (我假设是一个类似 Unix 的 Web 服务器)。

1) 下载并构建 libmpq 和 mpq-tools ( https://libmpq.org/ )

2) 运行以下脚本

您可以通过 system() 调用运行这些,然后运行一些拆分命令来获取玩家和比赛。

将其另存为 info.sh。像命令 shell 一样运行它,并将重播文件作为参数传递。

#!/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

这是一个 ruby 脚本。将其另存为 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)]

希望这对您有所帮助!

关于php - 我如何查看星际争霸 2 重播?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3853594/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com