DEV Community

Cover image for How I Built an AI Esports Coach with Python, GRID, and Gemini (Hackathon Journey)
 Veronika Kashtanova
Veronika Kashtanova

Posted on

How I Built an AI Esports Coach with Python, GRID, and Gemini (Hackathon Journey)

In the high-stakes world of competitive esports (Valorant, LoL), the difference between a trophy and a "GG next" often comes down to split-second decisions and mental fortitude. While data exists everywhere, raw numbers lack one critical thing: context.

During the Cloud9 x JetBrains Hackathon, I set out to bridge this gap. I didn't want to build just another stats tracker. I wanted to build C9 Pulse β€” an AI-powered "assistant coach" that combines deep GRID data analytics with real-time psychological support.

I call it: "Moneyball with a Heart." 🌩️

Here is how I built it using Python, Flask, GRID Open Platform, Junie and Gemini.

πŸ“‰ The Problem: Data Overload

Esports coaches and players are bombarded with data. The GRID Open Platform provides an incredible Live Data Feed, but interpreting complex GraphQL schemas in the middle of a high-pressure match is impossible for a human.

We needed a system that could:

  1. Digest the chaos of live game events (Series State).

  2. Translate them into actionable strategic advice.

  3. Monitor the players' mental state (The "Tilt" Factor).

πŸ’‘ The Solution: C9 Pulse

C9 Pulse is a modular web dashboard built with Flask that acts as a real-time command center. It doesn't just show you K/D ratios; it tells you how to fix them.

Command Center Screenshot

The C9 Pulse Dashboard running in Dark Mode

1. The Analytical Engine (The Brain) 🧠

Macro Strategy View

Real-time Economy Graph tracking team momentum.

Using Python and custom GraphQL queries, C9 Pulse tracks every kill, death, and credit spent.

  • Dynamic Economy Graph: Visualizes financial momentum to predict enemy buy rounds.

  • Tilt Meter: A unique algorithm that detects when a player is "tilting" (mentally collapsing) by analyzing death streaks and performance drops compared to their historical average.

2. Coach Titan (The Heart) πŸŽ™οΈ

Integration with Google Gemini allowed me to give the data a personality. Meet Titan, a ruthless yet supportive AI coach.

Live AI Coaching

Coach Titan analyzing a player's slump in real-time.

Instead of a static "You died," Titan analyzes the context:

"Hans Sama is struggling with a 2/6 K/D. His confidence is brittle. Stop aggressive peeks, set him up for a trade to reset his mental."

Using Edge-TTS (Microsoft Azure), Titan instantly speaks this advice during timeouts, keeping the player focused on the screen, not the text.


πŸ› οΈ The Technical Challenge: Cracking GraphQL

The biggest hurdle was accessing granular live data. The standard endpoints gave me schedules, but I needed live kill feeds.

This is where JetBrains AI Assistant (Junie) became my MVP. I was struggling to navigate the deep nesting of the GRID GraphQL schema. I pasted the schema into PyCharm and asked Junie to find the path to seriesState.

In seconds, Junie helped me construct a query that would have taken me hours to debug manually:

query GetSeriesState($id: ID!) {
  seriesState(id: $id) {
    games {
      teams {
        players {
          name
          kills  # Accessed via flat structure
          deaths
        }
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

With this query, I built a MatchAnalyzer class in Python that processes the stream in real-time, calculating Economy Risk percentages on the fly.

πŸ—οΈ Architecture

I designed C9 Pulse to be modular and fast.

C9 Pulse Architecture

  • Backend: Python 3.9+ & Flask.

  • Data Source: GRID Open Platform API (GraphQL).

  • AI Logic: Google Gemini API (for generating strategic advice).

  • Voice Engine: edge-tts (running locally for zero latency).

  • Dev Environment: JetBrains PyCharm + Junie AI.

πŸš€ What I Learned

This hackathon was a deep dive into the intersection of Data Science and Sports Psychology.

I'm proud of the evolution from a simple CLI script to a full voice-enabled dashboard. Here is a look at the early prototype (v0.1.0):

The biggest technical lesson? Context is King. Building the "Tilt Meter" required looking past the K/D ratio. A player going 0/3 because they are playing "entry fragger" is different from a player going 0/3 because they are missing easy shots. Teaching the AI to distinguish between the two was the key to making "Moneyball with a Heart."

🏁 Closing Thoughts

C9 Pulse proves that AI doesn't have to be a cold, calculating machine. When powered by the right data (GRID) and built with powerful tools (JetBrains), code can become a teammate that has your back when the pressure is on.

Check out the project on GitHub: πŸ‘‰ https://github.com/vero-code/c9-pulse

View the full submission on Devpost:
πŸ—³οΈ https://devpost.com/software/c9-pulse-the-ai-morale-coach

Top comments (0)