Skip to content

MikeManzo/BF6StatsTracker

Repository files navigation

BF6 Stats Tracker

macOS Swift SwiftUI SwiftData

A native macOS application for tracking Battlefield 6 player statistics with comprehensive historical analytics

Features โ€ข Installation โ€ข Usage โ€ข Screenshots


โœจ Features

๐Ÿ“Š Comprehensive Statistics

  • Overview Stats: Kills, deaths, K/D ratio, accuracy, win/loss, score per minute, and more
  • Class Performance: Detailed stats for all 4 classes (Assault, Engineer, Support, Recon)
  • Weapon Arsenal: 45+ weapons across 8 categories with accuracy, headshots, KPM, and damage
  • Vehicle Combat: 8 vehicle categories with kills, destroyed count, and usage time
  • Gadget Analysis: Complete gadget statistics with kills, uses, and effectiveness
  • Last Match Stats: Real-time performance from your most recent match
  • Map Statistics: Per-map performance tracking with K/D and win rates
  • Server Browser: Browse and filter active BF6 servers by platform, region, and mode

๐Ÿ“ˆ Historical Tracking (SwiftData)

NEW: All historical data is tracked locally using SwiftData - no API needed!

  • Automatic Snapshots: Stats automatically saved on every refresh
  • Performance Trends: K/D, accuracy, and KPM trends over time
  • Play Sessions: Track gaming sessions with start/end times and stats gained
  • Progress Analytics: Identify improving, declining, or stable performance
  • Map Mastery: Build real per-map statistics as you play
  • Data Ownership: All data stored locally and privately on your Mac

๐ŸŽจ Modern UI Design

  • Dark Theme: Sleek dark interface optimized for the Battlefield aesthetic
  • 10 Comprehensive Tabs: Overview, History, Maps, Charts, Classes, Weapons, Gadgets, Vehicles, Loadout, Servers
  • Draggable Class Tiles: Interactive, rearrangeable class performance cards
  • Advanced Charts: Swift Charts integration with line graphs, bar charts, and pie charts
  • Responsive Layout: Adaptive design for different window sizes
  • Smooth Animations: Spring animations, transitions, and hover effects

๐Ÿ” EA Account Integration

  • EA Login: Optional EA account authentication for automatic player detection
  • Secure OAuth: Uses EA's official authentication (EAIdentityKit)
  • Auto-Detection: Automatically fetches your EA ID, Nucleus ID, and Persona ID
  • Manual Fallback: Can also manually enter player name and platform

๐ŸŽฏ Advanced Analytics

  • Loadout Analyzer:

    • Overall effectiveness scoring (0-100%)
    • Best loadout recommendations
    • Weapon performance comparison charts
    • Playstyle identification (Aggressive Slayer, Team Medic, etc.)
    • Strengths & weaknesses analysis
    • 3-step improvement roadmap
  • Performance Charts:

    • K/D trend over time (line chart)
    • Weapon usage distribution (pie chart)
    • Top weapons comparison (bar chart)
    • Accuracy and headshot trends
  • Map Statistics:

    • Grid/List view modes
    • K/D comparison charts across maps
    • Best/worst performing maps
    • Performance badges (Elite, Great, Good, Practice)
    • Win rate tracking per map

โšก Performance Features

  • 5-Minute Cache: Smart caching to reduce API calls
  • Auto-Refresh: Configurable automatic stats refresh (1-30 minutes)
  • SwiftData Persistence: Local database for historical tracking
  • Rate Limiting: Built-in API rate limiting protection
  • Background Refresh: Fresh data on app startup

๐Ÿ”ง Menu Bar Integration

  • Collapsible Window: Minimize to menu bar for quick access
  • Quick Stats View: See key stats without opening the full app
  • Always Available: Runs in background for instant access
  • Command Menu: Keyboard shortcuts for common actions

๐Ÿš€ Installation

Requirements

  • macOS: 14.0 (Sonoma) or later
  • Xcode: 15.0+ (for development)
  • Internet: Required for API access
  • Storage: ~10MB app + minimal space for historical data (~2MB/year)

From Source

  1. Clone the repository

    git clone https://github.com/yourusername/BF6StatsTracker.git
    cd BF6StatsTracker
  2. Open in Xcode

    open BF6StatsTracker.xcodeproj
  3. Configure signing

    • Select the project in Xcode
    • Go to "Signing & Capabilities"
    • Select your development team
  4. Build and run

    • Press โŒ˜R or click the Play button
    • App will launch with SwiftData initialized

Building for Release

  1. In Xcode: Product โ†’ Archive
  2. In Organizer: Click "Distribute App"
  3. Choose "Copy App" for local distribution
  4. Export the .app file to Applications folder

๐Ÿ“– Usage

First Time Setup

Option 1: EA Account Login (Recommended)

  1. Launch BF6 Stats Tracker
  2. Click โš™๏ธ Settings in the sidebar
  3. Under "EA Account", click Sign in with EA
  4. Authenticate with your EA credentials
  5. Your player name and platform are automatically detected

Option 2: Manual Entry

  1. Launch BF6 Stats Tracker
  2. Click โš™๏ธ Settings
  3. Under "Player", enter your exact Battlefield 6 player name (case-sensitive)
  4. Select your platform (PC, PlayStation, Xbox)
  5. Click Save Settings
  6. Stats will load automatically

Navigation

The app features 10 comprehensive tabs:

Tab Icon Description
Overview ๐Ÿ“Š General stats summary with highlights and last match performance
History ๐Ÿ• Play session history with stats gained per session
Maps ๐Ÿ—บ๏ธ Per-map performance with K/D comparisons and win rates
Charts ๐Ÿ“ˆ Performance trends over time with multiple visualizations
Classes ๐Ÿ‘ค Draggable class tiles with detailed performance metrics
Weapons ๐Ÿ”ซ All weapons filtered by category with detailed stats
Gadgets ๐Ÿ’ฃ All gadgets with usage statistics and effectiveness
Vehicles ๐Ÿš All vehicles filtered by type with combat stats
Loadout ๐Ÿ“‹ Loadout analysis with recommendations and insights
Servers ๐ŸŒ Browse active BF6 servers with filtering and favorites

Features Guide

Historical Tracking

  • Automatic: Stats saved on every refresh
  • View Trends: Check "Charts" tab for K/D, accuracy, KPM over time
  • Sessions: "History" tab shows your play sessions
  • Clear Data: Settings โ†’ Data Management โ†’ Clear History

Map Statistics

  • Grid/List: Toggle view modes for different perspectives
  • Charts: Enable comparison chart to see K/D across maps
  • Search: Filter maps by name
  • Sort: By matches played, K/D, win rate, kills, or name

Loadout Analyzer

  • 5 Tabs: Overview, Weapons, Classes, Gadgets, Insights
  • Effectiveness Score: 0-100% based on K/D, accuracy, headshots, win rate, team support
  • Recommendations: Get weapon and playstyle suggestions
  • Roadmap: 3-step improvement plan

Server Browser

  • Filters: Platform, region, mode, capacity
  • Sort: By players, name, region, favorites
  • Favorites: Star servers for quick access
  • Details: Expand cards for map rotation and server info

Keyboard Shortcuts

Shortcut Action
โŒ˜R Refresh stats
โŒ˜, Open settings
โŒ˜K โ‡งโŒ˜K Clear cache
โŒ˜Q Quit application

๐Ÿ–ผ๏ธ Screenshots

Add screenshots here showing:

  • Main overview with stats
  • Map statistics view
  • Loadout analyzer
  • Performance charts
  • Server browser
  • Settings panel

๐Ÿ”Œ API Information

This app uses the GameTools.Network free API for fetching Battlefield 6 statistics.

Endpoints Used

Endpoint Purpose Cached
/bf6/stats/ Player overview statistics 5 min
/bf6/weapons/ Detailed weapon stats 5 min
/bf6/vehicles/ Detailed vehicle stats 5 min
/bf6/gadgets/ Detailed gadget stats 5 min
/bf6/classes/ Detailed class stats 5 min
/bf6/servers/ Active server list Real-time

Rate Limiting

  • Minimum interval: 1 second between requests
  • Cache duration: 5 minutes for player data
  • Automatic retry: On rate limit errors
  • Snapshot saving: No API calls (uses SwiftData)

API Limitations

  • โŒ No historical data - API only provides current stats
    • โœ… Solution: App builds history locally using SwiftData
  • โŒ No per-map stats - API doesn't break down by map
    • โœ… Solution: App distributes stats across maps intelligently
  • โŒ No match history - API doesn't provide match-by-match data
    • โœ… Solution: App tracks snapshots on each refresh

๐Ÿ—๏ธ Project Structure

BF6StatsTracker/
โ”œโ”€โ”€ BF6StatsTrackerApp.swift       # App entry + SwiftData setup
โ”œโ”€โ”€ ContentView.swift               # Main navigation
โ”‚
โ”œโ”€โ”€ Models/
โ”‚   โ”œโ”€โ”€ Models.swift               # PlayerStats, WeaponStats, etc.
โ”‚   โ”œโ”€โ”€ StatsSnapshot.swift        # SwiftData models (snapshots, sessions, maps)
โ”‚   โ””โ”€โ”€ ServerModels.swift         # Server & filter models
โ”‚
โ”œโ”€โ”€ Services/
โ”‚   โ”œโ”€โ”€ APIService.swift           # GameTools API client
โ”‚   โ”œโ”€โ”€ CacheManager.swift         # 5-minute cache system
โ”‚   โ”œโ”€โ”€ HistoryManager.swift       # SwiftData snapshot management
โ”‚   โ”œโ”€โ”€ MapTracker.swift           # Per-map statistics tracking
โ”‚   โ””โ”€โ”€ ImageLoader.swift          # Image loading & caching
โ”‚
โ”œโ”€โ”€ ViewModels/
โ”‚   โ””โ”€โ”€ StatsViewModel.swift       # Main app state & logic
โ”‚
โ”œโ”€โ”€ Views/
โ”‚   โ”œโ”€โ”€ PlayerSearchView.swift     # Player search
โ”‚   โ”œโ”€โ”€ OverviewStatsView.swift    # Overview tab
โ”‚   โ”œโ”€โ”€ SessionHistoryView.swift   # History tab with sessions
โ”‚   โ”œโ”€โ”€ MapStatsView.swift         # Maps tab with charts
โ”‚   โ”œโ”€โ”€ PerformanceChartsView.swift # Charts tab with trends
โ”‚   โ”œโ”€โ”€ ClassTileView.swift        # Draggable class tiles
โ”‚   โ”œโ”€โ”€ DraggableTileContainer.swift
โ”‚   โ”œโ”€โ”€ WeaponStatsView.swift      # Weapons tab
โ”‚   โ”œโ”€โ”€ GadgetStatsView.swift      # Gadgets tab
โ”‚   โ”œโ”€โ”€ VehicleStatsView.swift     # Vehicles tab
โ”‚   โ”œโ”€โ”€ LoadoutAnalyzerView.swift  # Loadout tab with analysis
โ”‚   โ”œโ”€โ”€ ServerBrowserView.swift    # Server browser tab
โ”‚   โ”œโ”€โ”€ EALoginView.swift          # EA authentication
โ”‚   โ”œโ”€โ”€ MenuBarView.swift          # Menu bar extra
โ”‚   โ””โ”€โ”€ SettingsView.swift         # Settings with data management
โ”‚
โ””โ”€โ”€ Utilities/
    โ””โ”€โ”€ Extensions.swift           # Helper extensions

๐Ÿ’พ Data Storage

SwiftData Persistence

All historical data is stored locally using SwiftData:

  • Location: ~/Library/Application Support/BF6StatsTracker/
  • Size: ~500 bytes per snapshot, ~2MB per year of daily tracking
  • Privacy: All data stays on your Mac, never sent anywhere
  • Deletion: Settings โ†’ Data Management โ†’ Clear History

What Gets Saved

  1. Stats Snapshots - Complete player stats at each refresh
  2. Play Sessions - Gaming sessions with start/end times
  3. Map Statistics - Per-map performance tracking

Cache Storage

  • Memory Cache: Current session only
  • Disk Cache: 5-minute expiry for API responses
  • Clearable: Settings โ†’ Clear Cache

๐ŸŽฎ Game Data Reference

Classes (4)

  • Assault: Frontline infantry with breach-and-clear gadgets
  • Engineer: Vehicle specialist with repair and anti-vehicle tools
  • Support: Combat medic with healing, resupply, and revive
  • Recon: Sniper and intelligence specialist

Weapon Categories (8)

  • Assault Rifles, Carbines, SMGs, LMGs
  • DMRs, Sniper Rifles, Shotguns, Pistols

Vehicle Categories (8)

  • Main Battle Tank, Light Armor, Anti-Aircraft, Attack Helicopter
  • Transport Helicopter, Jet, Transport Vehicle, Watercraft

BF6 Maps

  • Stranded, Renewal, Hourglass, Kaleidoscope
  • Manifest, Breakaway, Discarded, Orbital
  • Exposure, Ridge, Spearhead

๐Ÿ› ๏ธ Development

Technologies Used

  • SwiftUI - Modern declarative UI framework
  • SwiftData - Local persistence and historical tracking
  • Swift Charts - Data visualization
  • Async/Await - Asynchronous API calls
  • EAIdentityKit - EA OAuth authentication
  • Combine - Reactive programming for state management

Building

  1. Clone the repository
  2. Open in Xcode 15+
  3. Select your development team
  4. Build for macOS 14.0+

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.


๐Ÿ“ Documentation

Additional documentation available:


๐Ÿ“œ License

This project is provided as-is for educational and personal use.

โš ๏ธ Disclaimer

This is an unofficial application and is not affiliated with, endorsed by, or connected to Electronic Arts, EA DICE, or the Battlefield franchise. All game content, images, and trademarks are property of their respective owners.

๐Ÿ™ Acknowledgments

  • GameTools.Network - Free Battlefield stats API
  • EA - Battlefield franchise and assets
  • Battlefield Community - Inspiration and feedback

Made with โค๏ธ for the Battlefield community

Report Bug โ€ข Request Feature โ€ข Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published