Package: awpy
awpyTheawpypackage provides data parsing, analytics and visualization capabilities for Counter-Strike: Global Offensive (CSGO) data. In this repository, you will find the source code, issue tracker and other usefulawpyinformation. Please joinour Discordfor discussion around the library and esports analytics. You may visit the documentationhere.Table of ContentsSetup and InstallationExample Code and ProjectsContributingStructureAcknowledgmentsSetupRequirementsawpyrequiresPython>= 3.11 andGolang>= 1.18. Python acts as a wrapper for the Go code which parses demofiles.InstallationTo installawpy, you can runpip install awpyTo update the library, just runpip install --upgrade awpy. For more help, you can visit the installation channel inour Discord.Colab NotebookDo you work in Google Colab? No problem, theawpyPython library runs there, too! Check out how tosetup awpy Python library in Google Colab.Example CodeUsing theawpypackage is straightforward. Just grab a demofile and have output in a JSON or Pandas DataFrame in a few seconds. Use the example below to get started.fromawpyimportDemoParserfromawpy.analytics.statsimportplayer_stats# Set the parse_rate equal to the tick rate at which you would like to parse the frames of the demo.# This parameter only matters if parse_frames=True ()# For reference, MM demos are usually 64 ticks, and pro/FACEIT demos are usually 128 ticks.demo_parser=DemoParser(demofile="og-vs-natus-vincere-m1-dust2.dem",demo_id="og-vs-natus-vincere",parse_rate=128)# Parse the demofile, output results to dictionary with df name as keydata=demo_parser.parse()# There are a variety of top level keys# You can view game rounds and events in 'gameRounds']data["matchID"]data["clientName"]data["mapName"]data["tickRate"]data["playbackTicks"]data["playbackFramesCount"]data["parsedToFrameIdx"]data["parserParameters"]data["serverVars"]data["matchPhases"]data["matchmakingRanks"]data["playerConnections"]data["gameRounds"]# From this value, you can extract player events via: data['gameRounds'][i]['kills'], etc.player_stats(data["gameRounds"])# You can create a dictionary of player stats over a list of rounds# You can also parse the data into dataframes usingdata_df=demo_parser.parse(return_type="df")# The parser also writes a JSON file of the output named demo_id.jsonHelp! The parser returns weird rounds.Please note that the parser parseseverythingin the demo. This means that you may have rounds from the warmup (denoted with theisWarmupflag), rounds that may have ended in a draw, and other odd-looking rounds. Try using theDemoParser.clean_rounds()method to clean up. Note that this is not going to be 100 percent perfect.Help! The parser doesn't work or lacks a featureIf you need help with the parser, joinour Discord. CSGO demos are oftentimes imperfect, but if you ask on Discord, we can try to figure out what is the problem. Please remember to post the error and demo if you can! You can also check theopen issuesor visit visitour documentation.Examples and ProjectsTake a look at the following Jupyter notebooks provided in ourexamples/directory. These will help you get started parsing and analyzing CSGO data.Parsing a CSGO demofileBasic CSGO analysisBasic CSGO visualizationWorking with navigation meshesAdvanced navigation functionalityMap controlIf you use the parser for any public analysis, we kindly ask you to link to this repository, so that others may know how you parsed, analyzed or visualized your data. If you have a paper or project that uses the parser, please let us know in Discord so we can add it!ContributingWe welcome any contributions from the community. You can visit theissue pageto see what issues are still open, or you can message on Discord. We will always have a need for writing tests, quality assurance and expanding functionality. We also seek contributors to produce interesting content (such as tweets, analyses, papers, etc.) -- you can see more examples of community contenthere. If you are interested in contributing to Awpy, learn morehere.Structureawpyis structured as follows:.
├── awpy
│   ├── analytics                 # Code for CSGO analytics
│   ├── data                      # Code for dealing with CSGO map and nav data
│   ├── parser                    # Code for CSGO demo parser
│   └── visualization             # Code for CSGO visualization
├── doc                           # Contains documentation files
├── examples                      # Contains Jupyter Notebooks showing example code
└── tests                         # Contains tests for the awpy packageAcknowledgmentsThis project is made possible by the amazing work done in thedemoinfocs-golang.Big shoutout toSimpleRadarfor allowing use of their map images.Special thanks toarjun-22for his work on the initial stats module, expanding test coverage, and quality assurance checks.Thanks toJan-Ericfor his contributions extending the navigation functionality, greatly expanding test coverage and fixing bugs.Additional thanks to those of you in the Discord community who file bug reports and test awpy thoroughly.