Playback Visualizations¶
The chicken_dinner
package provides (for now) one configurable playback
animation via the create_playback_animation
function or by calling directly
the playback_animation
method from a Telemetry instance.
The playback animation function depends on external python
packages matplotlib
and pillow
. To install chicken_dinner
with
these extra dependencies, use
pip install chicken-dinner[visual]
In order to use the playback animation you will need to install an
additional piece of software called ffmepg
. To install ffmpeg
on Mac,
use brew:
brew install ffmpeg
For other platforms, see here
Here is some example code for creating a playback animation:
from chicken_dinner.pubgapi import PUBG
api_key = "MY_API_KEY"
pubg = PUBG(api_key, "pc-na")
me = pubg.players_from_names("my_username")[0]
last_match_id = me.match_ids[0]
last_match = pubg.match(last_match_id)
last_match_telemetry = last_match.get_telemetry()
last_match_telemetry.playback_animation("last_match.html")
Alternately you can use the create_playback_animation()
function.
from chicken_dinner.pubgapi import PUBG
from chicken_dinner.visual.playback import create_playback_animation
api_key = "MY_API_KEY"
pubg = PUBG(api_key, "pc-na")
me = pubg.players_from_names("my_username")[0]
last_match_id = me.match_ids[0]
last_match = pubg.match(last_match_id)
last_match_telemetry = last_match.get_telemetry()
create_playback_animation(last_match_telemetry, "last_match.html")
-
chicken_dinner.visual.playback.
create_playback_animation
(telemetry, filename='playback.html', labels=True, disable_labels_after=None, label_players=None, dead_player_labels=False, zoom=False, zoom_edge_buffer=0.5, use_hi_res=False, use_no_text=False, color_teams=True, highlight_teams=None, highlight_players=None, highlight_color='#FFFF00', highlight_winner=False, label_highlights=True, care_packages=True, damage=True, end_frames=20, size=5, dpi=100, interpolate=True, interval=1, fps=30)[source]¶ Create a playback animation from telemetry data.
Using matplotlib’s animation library, create an HTML5 animation saved to disk relying on external
ffmpeg
library to create the video.To view the animation, open the resulting file in your browser.
- Parameters
telemetry – an Telemetry instance
filename – a file to generate for the animation (default “playback.html”)
labels (bool) – whether to label players by name
disable_labels_after (int) – if passed, turns off player labels after number of seconds elapsed in game
label_players (list) – a list of strings of player names that should be labeled
dead_players (bool) – whether to mark dead players
dead_player_labels (list) – a list of strings of players that should be labeled when dead
zoom (bool) – whether to zoom with the circles through the playback
zoom_edge_buffer (float) – how much to buffer the blue circle edge when zooming
use_hi_res (bool) – whether to use the hi-res image, best to be set to True when using zoom
use_no_text (bool) – whether to use the image with no text for town/location names
color_teams (bool) – whether to color code different teams
highlight_teams (list) – a list of strings of player names whose teams should be highlighted
highlight_players (list) – a list of strings of player names who should be highlighted
highlight_color (str) – a color to use for highlights
highlight_winner (bool) – whether to highlight the winner(s)
label_highlights (bool) – whether to label the highlights
care_packages (bool) – whether to show care packages
damage (bool) – whether to show PvP damage
end_frames (int) – the number of extra end frames after game has been completed
size (int) – the size of the resulting animation frame
dpi (int) – the dpi to use when processing the animation
interpolate (bool) – use linear interpolation to get frames with second-interval granularity
interval (int) – interval between gameplay frames in seconds
fps (int) – the frames per second for the animation