Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 2.12 KB

README.md

File metadata and controls

81 lines (62 loc) · 2.12 KB

Among Us Replay - NodeJS Parser (Alpha)

This package allows parsing .aurp replays saved with this mod inside NodeJS environment.

Installation

yarn add @tkulpa/among-us-replay-nodejs

or

npm install @tkulpa/among-us-replay-nodejs

Usage

const amongUsReplay = require('@tkulpa/among-us-replay-nodejs');

amongUsReplay(`assets/replays/replay.aurp`).then(({ map_id, events }) => {
  const p5 = require('node-p5');
  const mapData = mapsData[map_id || 0];

  function sketch(p, { mapImage }) {
    const convertX = (pos) => pos * mapData.scale + mapData.offsets[0];
    const convertY = (pos) => pos * -mapData.scale + mapData.offsets[1];

    p.setup = () => {
      let canvas = p.createCanvas(mapImage.width, mapImage.height);
      p.image(mapImage, 0, 0);
      setTimeout(async () => {
        const filename = await p.saveCanvas(
          canvas,
          `output/${replayName}`,
          'png'
        );
        console.log(`saved the canvas as ${filename}`);
      }, 100);
      p.noLoop();
    };

    p.draw = () => {
      p.stroke('red');
      p.strokeWeight(10);
      events.forEach((e) =>
        e.player_states.forEach(
          ({ is_dead, position_x, position_y }) =>
            !is_dead && p.point(convertX(position_x), convertY(position_y))
        )
      );
    };
  }
  p5.createSketch(sketch, { mapImage: p5.loadImage(mapData.imgPath) });
});

Results:

Skeld

All Players pathing across whole game skeld replay Example implementation inside example folder

Polus

All Players pathing across whole game polus replay Example implementation inside example folder

Mira HQ All Players pathing across whole game

All Players pathing across whole game mira hq replay Example implementation inside example folder