Skip to main content

Parsing library for SSBM replay files

Project description

Py-slippi is a Python parser for .slp game replay files for Super Smash Brothers Melee for the Nintendo GameCube. These replays are generated by Jas Laferriere’s Slippi recording code, which runs on a GameCube or the Dolphin emulator.

Installation

Requires Python >= 3.6. To install, run the following command (optionally inside a virtual environment):

pip install py-slippi

Usage

Reading from a replay file:

>>> from slippi import Game
>>> game = Game('path/to/game.slp')
>>> game.metadata
<Game.Metadata: date: 2018-06-22 07:52:59+00:00, duration: 5086, platform: Platform.DOLPHIN, players: (<Game.Metadata.Player: characters: {<InGameCharacter.MARTH: 18>: 5086}>, <Game.Metadata.Player: characters: {<InGameCharacter.FOX: 1>: 5086}>, None, None)>
>>> game.start
<Start: is_teams: False, players: (<Start.Player: character: CSSCharacter.MARTH, costume: 3, stocks: 4, team: None, type: Type.HUMAN, ucf: <Start.Player.UCF: dash_back: False, shield_drop: False>>, <Start.Player: character: CSSCharacter.FOX, costume: 0, stocks: 4, team: None, type: Type.CPU, ucf: <Start.Player.UCF: dash_back: False, shield_drop: False>>, None, None), random_seed: 3803194226, slippi: <Start.Slippi: version: 1.0.0.0>, stage: Stage.YOSHIS_STORY>
>>> game.end
<End: method: Method.CONCLUSIVE>
>>> game.frames[0]
<Frame: ports: (<Frame.Port: follower: None, leader: <Frame.Port.Data: post: <Frame.Port.Data.Post: character: InGameCharacter.MARTH, combo_count: 0, damage: 0.0, direction: Direction.RIGHT, last_attack_landed: None, last_hit_by: None, position: <slippi.event.Position object at 0x7f6f41f47710>, shield: 59.6619873046875, state: ActionState.LANDING, state_age: 7.0, stocks: 4>, pre: <Frame.Port.Data.Pre: buttons: <Buttons: logical: Logical.NONE, physical: Physical.NONE>, cstick: <slippi.event.Position object at 0x7f6f41f47320>, direction: Direction.RIGHT, joystick: <slippi.event.Position object at 0x7f6f41f47470>, position: <slippi.event.Position object at 0x7f6f41f474e0>, random_seed: 1373931959, state: ActionState.LANDING, triggers: <Triggers: logical: 0.0, physical: <Triggers.Physical: l: 0.0, r: 0>>>>>, <Frame.Port: follower: None, leader: <Frame.Port.Data: post: <Frame.Port.Data.Post: character: InGameCharacter.FOX, combo_count: 0, damage: 0.0, direction: Direction.LEFT, last_attack_landed: None, last_hit_by: None, position: <slippi.event.Position object at 0x7f6f41f47780>, shield: 60.0, state: ActionState.JUMP_F, state_age: 19.0, stocks: 4>, pre: <Frame.Port.Data.Pre: buttons: <Buttons: logical: Logical.NONE, physical: Physical.NONE>, cstick: <slippi.event.Position object at 0x7f6f41f473c8>, direction: Direction.LEFT, joystick: <slippi.event.Position object at 0x7f6f41f47358>, position: <slippi.event.Position object at 0x7f6f41f47550>, random_seed: 1373931959, state: ActionState.JUMP_F, triggers: <Triggers: logical: 0.0, physical: <Triggers.Physical: l: 0.0, r: 0>>>>>, None, None)>

Iterating over frame data:

for frame_index, frame in enumerate(game.frames):
    data = frame.ports[0].leader # see also: port.follower (ICs)
    print(data.post.state) # character's post-frame action state

API Docs

See the Module Index for detailed API docs, starting with slippi.game.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py-slippi-1.0.1.tar.gz (13.0 kB view hashes)

Uploaded Source

Built Distribution

py_slippi-1.0.1-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page