Skip to content

Instantly share code, notes, and snippets.

@ipl31
Created August 30, 2025 18:58
Show Gist options
  • Save ipl31/ce42f3b4ea3f4030142cdf5f01637940 to your computer and use it in GitHub Desktop.
Save ipl31/ce42f3b4ea3f4030142cdf5f01637940 to your computer and use it in GitHub Desktop.
Player Data Stream
using FortniteReplayReader;
using FortniteReplayReader.Models;
using Unreal.Core.Models.Enums;
using Microsoft.Extensions.Logging;
class ModPackDadReader
{
static void Main(string[] args)
{
Console.WriteLine("Fortnite Replay Reader starting.");
// Setup code
using var loggerFactory = LoggerFactory.Create(builder =>
{
builder.AddConsole().SetMinimumLevel(LogLevel.Error);
});
ILogger logger = loggerFactory.CreateLogger<ModPackDadReader>();
var replayDir = @"G:\ReplayFiles";
var reader = new ReplayReader(logger, ParseMode.Full);
Console.WriteLine($"Looking for files in directory: {replayDir}");
foreach (string filePath in Directory.GetFiles(replayDir))
{
Console.WriteLine($"\nReading file: {filePath}");
try
{
var replay = reader.ReadReplay(filePath);
var playerLookup = new Dictionary<string, string>();
foreach (var pd in replay.PlayerData ?? Enumerable.Empty<object>())
{
var t = pd.GetType();
// Update these two lines to match the property names you saw in the dump:
var id = t.GetProperty("PlayerId")?.GetValue(pd)?.ToString(); // sometimes "NetId", "UniqueId", etc.
var name = t.GetProperty("PlayerName")?.GetValue(pd)?.ToString(); // sometimes "Name", "DisplayName"
if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(name))
playerLookup[id] = name;
}
foreach (var player in playerLookup)
{
Console.WriteLine($"Player ID: {player.Key}, Player Name: {player.Value}");
}
string replayVersion = ($"Replay Version: {replay.Header.Major}.{replay.Header.Minor}");
string replayDuration = ($"Replay Game Network Protocol Version: {replay.Header.GameNetworkProtocolVersion}");
Console.WriteLine("\nElims!");
foreach (var elim in replay.Eliminations)
{
string elimName = playerLookup.ContainsKey(elim.EliminatedInfo.Id) ? playerLookup[elim.EliminatedInfo.Id] : elim.EliminatedInfo.Id;
Console.WriteLine($"BOT: {elim.EliminatedInfo.IsBot } NAME: {elimName}");
}
}
catch (Exception ex)
{
Console.WriteLine("An error occurred while reading the replay file.");
Console.WriteLine(ex.Message);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment