BATTLEFRONTSTATS
About
Battlefrontstats.com
Battlefrontstats.com is a community-built and operated statistics tracking service for the game Star Wars™ Battlefront™ II (2017). We don't have any access to the official statistics, so we have to use some creative methods for harvesting that data.
Support
Statistics tracking requires modifying the game's code, which we can only do on PC. Sorry, no console support unless we get API access from dice. If you'd like to see this make it's way to consoles, tell them about it on twitter.
Data Retrieval
The operation of this site has many steps involved. It starts with the installer, then the mod-loader, followed by the stats-recorder, then finally this website.
Installer
The installer is a simple C# program that copies, renames, moves, and downloads several files. First it hashes all files involved to verify they're up to date. Then it renames amd_ags_x64.dll, a random dll the game uses, to ori_amd_ags_x64.dll. Then it downloads the mod-loader, which takes the name of the original dll. Then the cmods folder is created, the stats-tracker dll is downloaded, then a text file is created telling the mod loaded to load the stats-tracker mod upon game load.
mod-loader
The mod loader is a part of my cmod modding framework.. It's source is available on GitHub. It works by proxying all of the exports of the stock amd_ags_x64.dll file that the game uses. The game loads this modified dll upon start, and all functions residing in the true dll are proxied through. This allows me to create a new thread that calls LoadLibrary on several DLLs who's paths are defined in a text file.
stats-recorder
The stats-recorder aka the stats-tracker is the mod that powers this site. It detours an in-game function who's responsible for receiving all messages going to and from the client and server. This allows me to intercept when an online match has ended. To evade detection of this hook, some ASM is required to spoof the return address. Using a JSON parser, I iterate through the array of players in memory, and compile an array to be sent to the server for processing.
Server Processing
Upon receiving and verifying the data uploaded to the server, the data is pulled apart and sent to different databases. Pages are cached based upon time and database size. When a new match is logged with a particular player in it, their page will be recached upon next viewing. Leaderboards are recached any time a new match is uploaded.
Ajax Loading
Using an unhealthy amount of jquery, sections of pages are loaded individually with ajax requests. This allows the smaller and often important content to be delivered quicker, and it decreases the stress on the server by splitting up those requests.
Affiliations
Battlefrontstats.com is a community ran site. It is not affiliated with EA™, DICE™, or Lucasfilm™, and is not an official product of Star Wars™ Battlefront™. Battlefrontstats is a free site and service, funded by community donations. If you want to see exactly what data we have on your account, you can request it here.