火箭联赛回放解析与分析。
carball的Python项目详细描述
卡贝尔
各种反编译/分析火箭联赛回放的工具。
要求
- Python3.6+
- Windows、Mac或Linux
安装
pip install carball
python init.py
示例/用法
反编译并分析重播:
importcarballmanager=carball.analyze_replay_file('9EB5E5814D73F55B51A1BD9664D4CBF3.replay',output_path='9EB5E5814D73F55B51A1BD9664D4CBF3.json',overwrite=True)proto_game=manager.get_protobuf_data()
只需将重播反编译为json对象:
importcarball_json=carball.decompile_replay('9EB5E5814D73F55B51A1BD9664D4CBF3.replay',output_path='9EB5E5814D73F55B51A1BD9664D4CBF3.json',overwrite=True)
分析json游戏对象:
importcarballimportosimportgzipfromcarball.json_parser.gameimportGamefromcarball.analysis.analysis_managerimportAnalysisManager# _json is a JSON game object (from decompile_replay)game=Game()game.initialize(loaded_json=_json)analysis=AnalysisManager(game)analysis.create_analysis()# write proto out to a file# read api/*.proto for info on the object propertieswithopen(os.path.join('output.pts'),'wb')asfo:analysis.write_proto_out_to_file(fo)# write pandas dataframe out as a gzipped numpy arraywithgzip.open(os.path.join('output.gzip'),'wb')asfo:analysis.write_pandas_out_to_file(fo)
管道
如果要添加新的统计信息,最好在管道的高级统计信息部分进行添加。 你应该看看:
如果要查看创建的统计信息的输出格式,可以查看here
通过在这个目录中运行来编译proto文件
setup.bat
(Windows)或setup.sh
(Linux/Mac)
提示
Linux将python3.6
设置为python
:
sudoupdate-alternatives--install/usr/bin/pythonpython/usr/bin/python3.61
这假设您已经安装了3.6。
Linux错误(潜在):
PermissionError: [Errno 13] Permission denied: 'carball/rattletrap/rattletrap-6.2.2-linux'
修复:
chmod +x "carball/rattletrap/rattletrap-6.2.2-linux"
开发
要进行测试,必须运行pytest。对于ide,可以将它们配置为使用pytest运行程序。