# gridLeak

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://stand-with-ukraine.pp.ua)

Welcome to **gridLeak**, an open-source preservation initiative. This organization hosts the projects built to keep the multiplayer features of *Mirror's Edge Catalyst* alive after the official EA server deprecation


## Connecting to the public instance
I host a free public instance of the gridLeak stack for community play. This allows you to experience the game's social features - Beat LEs, Time Trials, Dashes with an active playerbase, without having to set up the backend yourself

> [!IMPORTANT]
> To connect, you will need:
> - A legitimate copy of *Mirror's Edge Catalyst*
> - A Discord account

#### Pre-built Binary
You can grab the modified Windows x64 build directly:
- https://pixeldrain.com/u/JCEYkeD6
- https://files.catbox.moe/b6ojke.zip

#### Building from Source
If you want to build it yourself, make sure you have **.NET 10.0** installed
1. Clone the repository: `git clone https://github.com/synthic/BeatLink.git`
2. Open `Game/Memory.cs` and change line 24 to point to `redirector.ploxxy.dev`
3. Open `Web/Authentication.cs` and update the following:
   - line 19: `var client_id = "1266123618753052784";`
   - line 20: `var scope = "identify+guilds.members.read";`
4. Build or run the project: `dotnet build -c release` or `dotnet run`

### Using the Launcher
1. Run BeatLink, click `LOGIN` and authorize via Discord
2. Launch the game, then switch back to BeatLink
3. Click `CONNECT`, then head back into the game

## The Ecosystem
Recreating a defunct EA/DICE network stack is an exercise in extreme precision. The game client is incredibly brittle, expecting absolute parity with the original server infrastructure. Because of this, even minor differences can break the client's connection

### Why It's Fragile
- **Silent Failures:** During development, the *HTTP Gateway* remained broken for over a year because of a single missing zero byte in specific *TCP Blaze* packets. This resulted in silent failures that were nearly impossible to trace, as the game provides no ways to debug it or any logging whatsoever
- **Strict Parity:** Any minor schema mismatch or dropped packet may lead to immediate game crashes or silent, undebuggable issues
- **Time Frame:** There was only about a month to gather live traffic before the official servers shut down forever, which meant writing tools to hook, patch the game, capture, parse, and analyze the packets. Some of the packet captures only became useful years later, after the encryption was beaten

### Server Stack
The network traffic is routed dynamically across these custom services:

```mermaid
graph LR
    game[Game Client] --> redirector[Redirector]
    redirector --> blaze[Blaze]
    blaze --> gateway[The Gateway]
    blaze --> engagement[Engagement Manager]
```

- **`The Gateway`**: The central HTTP logic server that emulates Mirror's Edge Catalyst's asynchronous multiplayer. It processes user-generated content: dashes, leaderboards, and profile customization
- **`Blaze`**: A custom TCP server that emulates EA's proprietary Blaze backend. It handles initial client handshakes, with real-time Runner Tag sync, record notifications, and other updates
- **`Redirector`**: A load balancer that routes initial client startup requests to the correct Blaze node using XML over HTTP
- **`Engagement Manager`**: A supporting HTTP API that handles dynamic in-game Main Menu buttons and click tracking telemetry

## Behind the Project
I have personally spent roughly 1,000 hours recreating this server stack. Rebuilding this architecture meant writing custom hooks and patches to redirect game traffic, capturing packets and creating tools to parse them, decoding proprietary EA protocols, reverse-engineering encryption strategies, debugging the game executable, and digging through old forums and abandoned repos for clues. From there, I designed the architecture and implemented the services from scratch. Nearly three years later, the ecosystem is finally in a stable and playable state

Finally, I want to thank the Mirror's Edge community - the activity, passion, and support have been my main motivation to see this project through. I also want to thank the Beat Revival team for their support. Individual contributions are also credited in the respective repositories

## Legal Disclaimer
This is a free, open-source research and preservation project. It is not affiliated with, endorsed by, or connected to Electronic Arts (EA), DICE, or any of their associated entities

- **No Copyrighted Material:** This repository does not contain, distribute, or host any copyrighted assets, binaries, or game files from *Mirror's Edge Catalyst*. It is a clean-room implementation based entirely on network analysis
- **Non-Commercial:** This software is distributed strictly free of charge for historical preservation and educational purposes. No monetization, donations, or commercial transactions are accepted
- **Trademarks:** All product names, logos, and brands are property of their respective owners. Their use here is solely for compatibility identification purposes
