Recently in CMPT 310, I built an F1 project in Python, and I've been getting deep into C++ and low-latency systems. I wanted to combine all three things I'm passionate about into one hackathon project. Then I started thinking about F1 race engineers, those people in the drivers' ears making split-second strategy calls. They're like Iron Man's JARVIS, right? Teams run thousands of simulations trying to optimize every decision, but at the end of the day, they're still humans making educated guesses. That's when it clicked: what if Gemini could be that voice in the ear, turning real time telemetry into strategic insights? F1 plus JARVIS equals FARVIS.

What it does

FARVIS is a two brain AI system for racing. The fast brain (C++ at 50Hz) handles real-time telemetry tire wear, fuel consumption, lap times, penalties, track limits. The slow brain (Gemini API) watches the race unfold and provides lap-by-lap strategic coaching: when to pit, how to manage tires, when to push or conserve. You pick your driver at the start, and FARVIS becomes their AI race engineer, calling out pit windows, tire degradation warnings, and strategic adjustments just like a real F1 pit wall.

How we built it

C++ handles the heavy lifting, a multi-threaded race simulator with realistic F1 physics running at 50Hz. It models 20 drivers, tire compounds, fuel burn, DRS zones, track limits, and penalties. All telemetry streams out as JSON on stdout. Python picks up that stream and feeds it to the Gemini API with carefully crafted prompts that make it think like a race engineer. The system uses event-driven calls (lap boundaries, tire wear thresholds) to stay within rate limits while still feeling responsive. Everything runs in two terminals side-by-side: live leaderboard on the left, Gemini strategic calls on the right.

Challenges we ran into

Rate limits hit hard. Burned through three different Gemini models (flash, 2.0-flash, 3-flash-preview) before landing on 2.5-flash-lite that still had quota left. Had to get creative with call intervals and event detection to maximize the free tier. Also spent way too long trying to display both the C++ leaderboard and Gemini output in the same terminal with TTY redirection, eventually gave up and went with the split-screen approach, which honestly works better for demos anyway.

Accomplishments that we're proud of

Built a production-quality C++ telemetry system with proper threading, race conditions handled, and realistic F1 modeling in a hackathon timeframe. Got Gemini to actually sound like an F1 race engineer - the prompts make it give radio style calls with reasoning, not just generic advice. The "fast and slow AI" architecture works exactly like we wanted: millisecond level C++ decisions feeding into lap scale Gemini strategy. And the whole thing runs on free tier APIs with smart rate limiting.

What we learned

LLMs don't need to be real time to be useful you just need to use them where they make sense. Event driven API calls are way smarter than polling on a timer. C++ and Python can work together beautifully when you design the interfaces right (JSON streaming via pipes). And sometimes the simple solution (two terminals) beats the clever solution (TTY magic).

What's next for FARVIS

Add more race events: safety cars, weather changes, pit stop mistakes. Let users tweak driver aggression mid-race and watch Gemini adjust strategy in real-time. Maybe hook it up to actual sim racing telemetry from games like F1 2024 or iRacing. And honestly? Would love to see this as a Twitch overlay for sim racers, real AI coaching during streams.

Built With

Share this project:

Updates