Skip to content

Commit

Permalink
Use numbered links
Browse files Browse the repository at this point in the history
  • Loading branch information
colonelpanic8 committed Jun 12, 2023
1 parent 401f12d commit 6833eb7
Showing 1 changed file with 53 additions and 54 deletions.
107 changes: 53 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,67 @@

[`subtr-actor`][1] is a versatile library designed to facilitate the
process of working with and extracting data from Rocket League replays.
Utilizing the powerful [boxcars] library for parsing, subtr-actor
Utilizing the powerful [`boxcars`][2] library for parsing, subtr-actor
simplifies the underlying actor-based structure of replay files, making them
more accessible and easier to manipulate.

### Overview of Key Components

- **[ReplayProcessor]**: This struct is at the heart of subtr-actor's
- **[`ReplayProcessor`][3]**: This struct is at the heart of subtr-actor's
replay processing capabilities. In its main entry point,
[ReplayProcessor::process], it pushes network frames from the
[boxcars::Replay] that it is initialized with though an
[ActorStateModeler] instance, calling the [Collector] instance that is
provided as an argument as it does so. The [Collector] is provided with a
reference to the [ReplayProcessor] each time the it is invoked, which
[`ReplayProcessor::process`][4], it pushes network frames from the
[`boxcars::Replay`][5] that it is initialized with though an
[`ActorStateModeler`][6] instance, calling the [`Collector`][7] instance that is
provided as an argument as it does so. The [`Collector`][7] is provided with a
reference to the [`ReplayProcessor`][3] each time the it is invoked, which
allows it to use the suite of helper methods which greatly assist in the
navigation of the actor graph and the retrieval of information about the
current game state.

- **[Collector]**: This trait outlines the blueprint for data collection
from replays. The [Collector] interfaces with a [ReplayProcessor],
- **[`Collector`][7]**: This trait outlines the blueprint for data collection
from replays. The [`Collector`][7] interfaces with a [`ReplayProcessor`][3],
handling frame data and guiding the pace of replay progression with
[TimeAdvance]. It is typically invoked repeatedly through the
[ReplayProcessor::process] method as the replay is processed frame by
[`TimeAdvance`][8]. It is typically invoked repeatedly through the
[`ReplayProcessor::process`][4] method as the replay is processed frame by
frame.

- **[FrameRateDecorator]**: This struct decorates a [Collector]
- **[`FrameRateDecorator`][9]**: This struct decorates a [`Collector`][7]
implementation with a target frame duration, controlling the frame rate of
the replay processing.

#### Collector implementations

[subtr-actor](crate) also includes implementations of the [Collector] trait:
[`subtr-actor`][1] also includes implementations of the [`Collector`][7] trait:

- **[NDArrayCollector]**: This [Collector] implementations translates
- **[`NDArrayCollector`][10]**: This [`Collector`][7] implementations translates
frame-based replay data into a 2 dimensional array in the form of a
[::ndarray::Array2] instance. The exact data that is recorded in each
frame can be configured with the [FeatureAdder] and [PlayerFeatureAdder]
instances that are provided to its constructor ([NDArrayCollector::new]).
Extending the exact behavior of [NDArrayCollector] is thus possible with
user defined [FeatureAdder] and [PlayerFeatureAdder], which is made easy
with the [build_global_feature_adder!] and [build_player_feature_adder!]
macros. The [::ndarray::Array2] produced by [NDArrayCollector] is ideal
[`::ndarray::Array2`][11] instance. The exact data that is recorded in each
frame can be configured with the [`FeatureAdder`][12] and [`PlayerFeatureAdder`][13]
instances that are provided to its constructor ([`NDArrayCollector::new`][14]).
Extending the exact behavior of [`NDArrayCollector`][10] is thus possible with
user defined [`FeatureAdder`][12] and [`PlayerFeatureAdder`][13], which is made easy
with the [`build_global_feature_adder!`][15] and [`build_player_feature_adder!`][16]
macros. The [`::ndarray::Array2`][11] produced by [`NDArrayCollector`][10] is ideal
for use with machine learning libraries like pytorch and tensorflow.

- **[ReplayData]**: This [Collector] implementation provides an easy way
to get a serializable to e.g. json (though [serde::Serialize])
- **[`ReplayData`][17]**: This [`Collector`][7] implementation provides an easy way
to get a serializable to e.g. json (though [`serde::Serialize`][18])
representation of the replay. The representation differs from what you might
get from e.g. raw [boxcars] in that it is not a complicated graph of actor
get from e.g. raw [`boxcars`][2] in that it is not a complicated graph of actor
objects, but instead something more natural where the data associated with


each entity in the game is grouped together.

### Example

In the following example, we demonstrate how to use [boxcars],
[NDArrayCollector] and [FrameRateDecorator] to write a function that
In the following example, we demonstrate how to use [`boxcars`][2],
[`NDArrayCollector`][10] and [`FrameRateDecorator`][9] to write a function that
takes a replay filepath and collections of features adders and returns a
[ReplayMetaWithHeaders] along with a [::ndarray::Array2] . The resulting
[::ndarray::Array2] would be appropriate for use in a machine learning
context. Note that [ReplayProcessor] is also used implicitly here in the
[Collector::process_replay]
[`ReplayMetaWithHeaders`][19] along with a [`::ndarray::Array2`][11]. The resulting
[`::ndarray::Array2`][11] would be appropriate for use in a machine learning
context. Note that [`ReplayProcessor`][3] is also used implicitly here in the
[`Collector::process_replay`][20]

```rust
use subtr_actor::*;
Expand All @@ -88,27 +90,24 @@ fn get_ndarray_with_info_from_replay_filepath(

Ok(collector.get_meta_and_ndarray().map_err(|e| e.variant)?)
}
```

[1]: https://docs.rs/subtr-actor
[subtr-actor]: https://crates.io/crates/subtr-actor
[Workflow Status]: https://github.com/rlrml/subtr-actor/actions?query=workflow%3A%22main%22
[boxcars]: https://docs.rs/boxcars/latest/boxcars/
[ReplayProcessor]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayProcessor.html
[ReplayProcessor::process]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayProcessor.html#method.process
[boxcars::Replay]: https://docs.rs/boxcars/latest/boxcars/struct.Replay.html
[ActorStateModeler]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ActorStateModeler.html
[Collector]: https://docs.rs/subtr-actor/latest/subtr_actor/trait.Collector.html
[TimeAdvance]: https://docs.rs/subtr-actor/latest/subtr_actor/enum.TimeAdvance.html
[FrameRateDecorator]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.FrameRateDecorator.html
[NDArrayCollector]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.NDArrayCollector.html
[::ndarray::Array2]: https://docs.rs/ndarray/latest/ndarray/struct.Array2.html
[FeatureAdder]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.FeatureAdder.html
[PlayerFeatureAdder]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.PlayerFeatureAdder.html
[NDArrayCollector::new]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.NDArrayCollector.html#method.new
[build_global_feature_adder!]: https://docs.rs/subtr-actor/latest/subtr_actor/macro.build_global_feature_adder.html
[build_player_feature_adder!]: https://docs.rs/subtr-actor/latest/subtr_actor/macro.build_player_feature_adder.html
[ReplayData]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayData.html
[serde::Serialize]: https://docs.rs/serde/latest/serde/trait.Serialize.html
[ReplayMetaWithHeaders]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayMetaWithHeaders.html
[Collector::process_replay]: https://docs.rs/subtr-actor/latest/subtr_actor/trait.Collector.html#tymethod.process_replay


[1]: https://docs.rs/subtr-actor/latest/subtr_actor/
[2]: https://docs.rs/boxcars/latest/boxcars/
[3]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayProcessor.html
[4]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayProcessor.html#tymethod.process
[5]: https://docs.rs/boxcars/latest/boxcars/struct.Replay.html
[6]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ActorStateModeler.html
[7]: https://docs.rs/subtr-actor/latest/subtr_actor/trait.Collector.html
[8]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.TimeAdvance.html
[9]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.FrameRateDecorator.html
[10]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.NDArrayCollector.html
[11]: https://docs.rs/ndarray/latest/ndarray/struct.Array2.html
[12]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.FeatureAdder.html
[13]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.PlayerFeatureAdder.html
[14]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.NDArrayCollector.html#tymethod.new
[15]: https://docs.rs/subtr-actor/latest/subtr_actor/macro.build_global_feature_adder.html
[16]: https://docs.rs/subtr-actor/latest/subtr_actor/macro.build_player_feature_adder.html
[17]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayData.html
[18]: https://docs.rs/serde/latest/serde/trait.Serialize.html
[19]: https://docs.rs/subtr-actor/latest/subtr_actor/struct.ReplayMetaWithHeaders

0 comments on commit 6833eb7

Please sign in to comment.