Skip to contents

Readers for the input recordings and demo files made in tool-assisted speedrunning, reinforcement learning, and research on human-game interaction. S3 outputs contain compact logical controller states, stable control identities, source numeric channels, metadata, and commands. Rows follow each format's frames, controller polls, timestamped events, or game tics. Unassigned controller ports and heterogeneous device observations use a replayr_poll_stream. read_movie() dispatches to the appropriate reader. movie_members() lists movies in a downloaded ZIP archive.

Controller layout

Each movie uses compact columns. button_layout() maps local columns to stable control identities. Use align_buttons() for an explicit common matrix layout across controllers. Original numeric values are returned by analog_channels(), under the keys that channel_layout() lists; selected stick representations by stick_channels(). BK2 N64 Boolean stick overrides are retained in movie$stick_overrides (right, up, left, down per player) and applied using the recording's BizHawk version when computing stick angles and directions.

Author

Maintainer: Thorben Pelzer thorben@pelzer.blog (ORCID)

Authors:

Examples

path <- system.file("extdata", "sample.fm2", package = "replayr")
movie <- read_movie(path)
movie
#> <replayr_movie [fm2] observations=3600 players=2 buttons=8 source=sample.fm2>
#> Header keys: version, emuVersion, rerecordCount, palFlag, romFilename, comment
#> P1 active observations: dpad_right=900, dpad_left=900, dpad_down=900, dpad_up=900, start=6, select=4, b=900, a=450
summary(movie)
#> fm2 recording sample.fm2: 3600 frames, 2 controllers, 8 controls
#> Controls active at least once:
#>  controller        key   name held activations
#>           1 dpad_right  Right  900          30
#>           1  dpad_left   Left  900          30
#>           1  dpad_down   Down  900          30
#>           1    dpad_up     Up  900          30
#>           1      start  Start    6           6
#>           1     select Select    4           4
#>           1          b      B  900         151
#>           1          a      A  450          91
#>           2 dpad_right  Right  900          30
#>           2  dpad_left   Left  900          30
#>           2  dpad_down   Down  900          30
#>           2    dpad_up     Up  900          30
#>           2      start  Start    6           6
#>           2     select Select    4           4
#>           2          b      B  900         151
#>           2          a      A  450          91
recording_info(movie)
#>   format platform video_standard  unit observations frame_rate
#> 1    fm2      NES           NTSC frame         3600   60.09881
#>   frame_rate_source duration rerecords
#> 1          platform 59.90135         0
# Button states of the first controller: observations by controls.
states <- player(movie, 1L)
dim(states)
#> [1] 3600    8