Giter Site home page Giter Site logo

saltierl / carball Goto Github PK

View Code? Open in Web Editor NEW
142.0 10.0 48.0 202.1 MB

๐Ÿ“ˆ A Rocket League replay decompiling and analysis library

Home Page: https://saltierl.github.io/carball/dev/bench/

License: Apache License 2.0

Python 98.78% Batchfile 0.01% Shell 1.21%
rocket-league replay-analyzer hacktoberfest

carball's People

Contributors

cabral450 avatar destiphy avatar divvycr avatar druthyn avatar dtracers avatar enzanki-ars avatar ima9rd avatar isaaclance avatar j-wass avatar jawnv6 avatar kcolton avatar krusmir avatar levelonedev avatar longi94 avatar mtdiedrich avatar omgoshjosh avatar sciguymjm avatar twobackfromtheend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carball's Issues

handle 'user_color_old', looks like an ID like primary and accent colors

# TODO handle 'user_color_old', looks like an ID like primary and accent colors
if 'user_color_new' in attribute['value']:
# rgb integer, 0xAARRGGBB, banners and avatar borders have different default values
user_color[item_name] = attribute['value']['user_color_new']
self.paint.append({
'car': paint.get('body', None),


This issue was generated by todo based on a TODO comment in 9c73c74. It's been assigned to @Longi94 because they committed the code.

Players with the same name or named ["ball", "game", "zTTL"]

There are issues if players have specific names.
It messes up the Dataframe analysis.data_frame

Can't parse at all:

Actually "can parse" but series of the df just gets extended, no new series for the player

Potential crash with replay goals not being found

Traceback (most recent call last): File "/env/local/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'boost' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 346, in run_http_function result = _function_handler.invoke_user_function(flask.request) File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 217, in invoke_user_function return call_user_function(request_or_event) File "/env/local/lib/python3.7/site-packages/google/cloud/functions/worker.py", line 210, in call_user_function return self._user_function(request_or_event) File "/user_code/main.py", line 109, in parse_replay raise e File "/user_code/main.py", line 105, in parse_replay game_manager, proto_location, pandas_location = decompile_replay(replay_location) File "/user_code/main.py", line 41, in decompile_replay proto_manager = analyze_replay_file(filename, rattletrap_path=dir_path) File "/env/local/lib/python3.7/site-packages/carball/decompile_replays.py", line 53, in analyze_replay_file analysis.create_analysis() File "/env/local/lib/python3.7/site-packages/carball/analysis/analysis_manager.py", line 59, in create_analysis data_frame, kickoff_frames, first_touch_frames) File "/env/local/lib/python3.7/site-packages/carball/analysis/analysis_manager.py", line 83, in perform_full_analysis self.events_creator.create_events(game, proto_game, player_map, data_frame, kickoff_frames, first_touch_frames) File "/env/local/lib/python3.7/site-packages/carball/analysis/events/event_creator.py", line 33, in create_events self.calculate_kickoff_stats(game, proto_game, player_map, data_frame, kickoff_frames, first_touch_frames) File "/env/local/lib/python3.7/site-packages/carball/analysis/events/event_creator.py", line 40, in calculate_kickoff_stats kickoffs = BaseKickoff.get_kickoffs_from_game(game, proto_game, self.id_creator, player_map, data_frame, kickoff_frames, first_touch_frames) File "/env/local/lib/python3.7/site-packages/carball/analysis/events/kickoff_detection/kickoff_analysis.py", line 44, in get_kickoffs_from_game kickoff_player = BaseKickoff.get_player_stats(cur_kickoff, player, data_frame, frame, end_frame) File "/env/local/lib/python3.7/site-packages/carball/analysis/events/kickoff_detection/kickoff_analysis.py", line 63, in get_player_stats kickoff_player.boost = data_frame[player.name]['boost'][end_frame] File "/env/local/lib/python3.7/site-packages/pandas/core/frame.py", line 2980, in __getitem__ indexer = self.columns.get_loc(key) File "/env/local/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2899, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/_libs/index.pyx", line 107, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 131, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1607, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1614, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'boost'

Add boost steals

which is large boost taken on opponent side
while ball is on opponent side

Add curve goal detection

These are goals scored in the curve mutator mode but would not make it in as a straight shot.

Add breakaway goals / counterattack goals

These would goals that start in the defending half and then move to the attacking half either without contention or happen really quickly before a defense can setup

Add demo/bump count and "usefull demos/bumps"

physical := demo/bump
I'd love to see a statistic that shows how many physicals a player/team did.

With the recognition of a physical you could also calculate if it was useful (or bad). My suggestions for this:

Offense: Easier to calculate I guess. A goal and a physical happens in a time frame. The physical stopped a player that could have potentially saved the shot.

if( goalHappened() && physicalHappened())
return canSave(player.positions[before], shot) && !canSave(player.position[after], shot)

Defense: You would need a prediction routine probably, that simulates a timeframe if a bump wouldn't have happen. Probably to hard, but suprise me :P

A bad demo is when you bring someone in position to save a ball he couldn't have saved without it.
You could modify my example from earlier. It occurs when a shot was made and saved with a demo in a time window (probably how long it takes to drive field end to end without boost).

if( shotHappened() && demoHappened() && saveHappend())
return canSave(player.positions[after], shot) && !canSave(player.position[before], shot)

Would be really great to see something like this :)

carball 0.3.0 breaks on the replay host joining late (presumably)

https://cdn.discordapp.com/attachments/412423088521740288/490247165046685696/1E9B0E044A80E084534F6381517D5D82.replay

carball.analyze_replay_file('replays/1E9B0E044A80E084534F6381517D5D82.replay', 'replays/1E9B0E044A80E084534F6381517D5D82.replay.json')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/matthew/PycharmProjects/ReplayAnalysis/3.6/lib/python3.6/site-packages/carball/decompile_replays.py", line 68, in analyze_replay_file
    game = Game(loaded_json=_json)
  File "/home/matthew/PycharmProjects/ReplayAnalysis/3.6/lib/python3.6/site-packages/carball/json_parser/game.py", line 64, in __init__
    self.all_data = self.parse_replay()
  File "/home/matthew/PycharmProjects/ReplayAnalysis/3.6/lib/python3.6/site-packages/carball/json_parser/game.py", line 341, in parse_replay
    player_ball_data[player_actor_id][frame_number] = data_dict
KeyError: 5

output file

What does the output file look like once you have run carball? and can you show and an example?

handle 'user_color_old', looks like an ID like primary and accent colors

# TODO handle 'user_color_old', looks like an ID like primary and accent colors
if 'user_color_new' in attribute['value']:
# rgb integer, 0xAARRGGBB, banners and avatar borders have different default values
user_color[item_name] = attribute['value']['user_color_new']
self.paint.append({
'car': paint.get('body', None),


This issue was generated by todo based on a TODO comment in f39636d when #174 was merged. cc @SaltieRL.

Bug: installation ImportError: cannot import name 'game_metadata_pb2'

Hi,

I get the following error trying to install carball from source, both pip install -e . and python init.py creates the same error. I can install with pip install carball

I am macos and python 3.6

Traceback (most recent call last):
  File "init.py", line 17, in <module>
    initialize_project()
  File "init.py", line 14, in initialize_project
    initalize_rattletrap()
  File "init.py", line 2, in initalize_rattletrap
    from carball.rattletrap.check_rattletrap_version import update_rattletrap
  File "/xxx/xxx/toolboxes/carball/carball/__init__.py", line 2, in <module>
    from carball.decompile_replays import decompile_replay
  File "/xxx/xxx/toolboxes/carball/carball/decompile_replays.py", line 4, in <module>
    from carball.analysis.analysis_manager import AnalysisManager
  File "/xxx/xxx/toolboxes/carball/carball/analysis/analysis_manager.py", line 14, in <module>
    from ..analysis.cleaner.cleaner import clean_replay
  File "/xxx/xxx/toolboxes/carball/carball/analysis/cleaner/cleaner.py", line 5, in <module>
    from ...analysis.cleaner.frame_cleaner import remove_invalid_players
  File "/xxx/xxx/toolboxes/carball/carball/analysis/cleaner/frame_cleaner.py", line 5, in <module>
    from ...generated.api import game_pb2
  File "/xxx/xxx/toolboxes/carball/carball/generated/api/game_pb2.py", line 16, in <module>
    from api.metadata import game_metadata_pb2 as api_dot_metadata_dot_game__metadata__pb2
ImportError: cannot import name 'game_metadata_pb2'

Trouble installing package

I'm trying to install carball to an anaconda environment using the instructions in the readme. I keep getting this error:

ERROR: Could not find a version that satisfies the requirement python (from versions: none)
ERROR: No matching distribution found for python

I'm using python 3.7,
can anybody help me?

Create list of pressure groups

This will take in a list of possessions and filter into team possessions which will filter into pressure group.
A pressure group is where the ball is on a half for more than 5 seconds and does not leave the half for more then 3 seconds

Parse into JSON.

Hey,

I'm not familiar at all with Python and their structure. So this might be more a Python related question than a Carball related question. Hard to tell:

My goal is to parse a replay into a JSON that includes the analysis etc...
Currently I'm able to load the replay perfectly and let it parse it. Now I want to write that data to a .json file. Looked things up and found the json.dumps but it's providing me the following error:
TypeError: Object of type 'Game' is not JSON serializable

I pretty much understand the error but not sure how I would go about on parsing that into JSON.
Any help or clue towards the correct answer is very welcome.

Kind regards,
Pollie

Pandas KeyError during kickoff analysis

Attempted to analyze this replay: https://cdn.discordapp.com/attachments/594899039355666432/599450806428762113/21DF74C045EEF30284D1339ECEC561D4.replay but carball crashed.

Happy to provide any other info you'd need!

Python stack trace:

Traceback (most recent call last):
  File "stats_init.py", line 10, in <module>
    carball.analyze_replay_file(init_replay_file_path)
  File "<project-folder>\venv\lib\site-packages\carball\decompile_replays.py", line 52, in analyze_replay_file
    analysis.create_analysis()
  File "<project-folder>\venv\lib\site-packages\carball\analysis\analysis_manager.py", line 59, in create_analysis
    data_frame, kickoff_frames, first_touch_frames)
  File "<project-folder>\venv\lib\site-packages\carball\analysis\analysis_manager.py", line 83, in perform_full_analysis
    self.events_creator.create_events(game, proto_game, player_map, data_frame, kickoff_frames, first_touch_frames)
  File "<project-folder>\venv\lib\site-packages\carball\analysis\events\event_creator.py", line 32, in create_events
    self.calculate_kickoff_stats(game, proto_game, player_map, data_frame, kickoff_frames, first_touch_frames)
  File "<project-folder>\venv\lib\site-packages\carball\analysis\events\event_creator.py", line 38, in calculate_kickoff_stats
    kickoffs = BaseKickoff.get_kickoffs_from_game(game, proto_game, self.id_creator, player_map, data_frame, kickoff_frames, first_touch_frames)
  File "<project-folder>\venv\lib\site-packages\carball\analysis\events\kickoff_detection\kickoff_analysis.py", line 40, in get_kickoffs_from_game
    BaseKickoff.set_jumps(kPlayer, player, data_frame, frame, end_frame)
  File "<project-folder>\venv\lib\site-packages\carball\analysis\events\kickoff_detection\kickoff_analysis.py", line 56, in set_jumps
    if collected_boost_df[f] == True:
  File "<project-folder>\venv\lib\site-packages\pandas\core\series.py", line 868, in __getitem__
    result = self.index.get_value(self, key)
  File "<project-folder>\venv\lib\site-packages\pandas\core\indexes\base.py", line 4375, in get_value
    tz=getattr(series.dtype, 'tz', None))
  File "pandas\_libs\index.pyx", line 81, in pandas._libs.index.IndexEngine.get_value
  File "pandas\_libs\index.pyx", line 89, in pandas._libs.index.IndexEngine.get_value
  File "pandas\_libs\index.pyx", line 132, in pandas._libs.index.IndexEngine.get_loc
  File "pandas\_libs\hashtable_class_helper.pxi", line 987, in pandas._libs.hashtable.Int64HashTable.get_item
  File "pandas\_libs\hashtable_class_helper.pxi", line 993, in pandas._libs.hashtable.Int64HashTable.get_item
KeyError: 9434

Crash when rattletrap update was interrupted

Traceback (most recent call last):
  File "C:\Users\laptop3\AppData\Local\Programs\Python\Python37-32\Scripts\carball-script.py", line 11, in <module>
    load_entry_point('carball==0.6.30', 'console_scripts', 'carball')()
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\command_line.py", line 56, in main
    manager = carball.analyze_replay_file(args.input)
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\decompile_replays.py", line 43, in analyze_replay_file
    _json = decompile_replay(replay_path, output_path=output_path, overwrite=overwrite, rattletrap_path=rattletrap_path)
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\decompile_replays.py", line 25, in decompile_replay
    return run_rattletrap.decompile_replay(replay_path, output_path, overwrite, rattletrap_path)
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\rattletrap\run_rattletrap.py", line 82, in decompile_replay
    command = create_rattletrap_command(replay_path, output_path, overwrite, rattletrap_path)
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\rattletrap\run_rattletrap.py", line 35, in create_rattletrap_command
    binary = get_binary_for_platform(pt.system(), binaries)
  File "c:\users\laptop3\appdata\local\programs\python\python37-32\lib\site-packages\carball\rattletrap\rattletrap_utils.py", line 30, in get_binary_for_platform
    binary = [f for f in binaries if f.endswith('.exe')][0]
IndexError: list index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.