Skip to content

Repository files navigation

Stare (AI Staring Competition)

The internet's first real-time AI powered staring competition.


Vision

Create the world's simplest competitive web game:

  • No downloads.
  • No complicated rules.
  • No expensive hardware.
  • The AI acts as an impartial referee.

Open your camera, establish focus, and see who breaks first.


Core Rules & AI Referee Logic

  1. Eye Aspect Ratio (EAR) Evaluation:

    • Calculated continuously at 30–60 FPS using 468 MediaPipe facial landmarks: $$\text{EAR} = \frac{|p_{160} - p_{144}| + |p_{158} - p_{153}|}{2 \cdot |p_{33} - p_{133}|}$$
    • Classic Mode: Natural micro-blinks (100–250ms) permitted. Eyes closed $> 350\text{ms}$ = Loss.
    • No-Blink Mode: Any blink $> 80\text{ms}$ = Instant Loss.
    • Survival Mode: Endless gaze endurance with global high score tracking.
  2. 3D Head Pose Orientation:

    • Computes real-time Yaw (horizontal), Pitch (vertical), and Roll (tilt).
    • Looking away ($|\text{Yaw}| > 22^\circ$), looking upward ($> 20^\circ$), or looking down triggers an immediate violation whistle.
  3. Anti-Cheat & Liveness Verification:

    • Challenge-response verification ("Smile at camera", "Raise eyebrows", "Tilt head slightly left", "Blink twice").
    • Luminance and micro-movement analysis prevents photo and looped video replay attacks.
  4. Multiplayer & Matchmaking:

    • WebRTC Peer-to-Peer video streams.
    • Synchronized 3-2-1 countdown with millisecond stopwatch.
    • ELO Ranked queue (Bronze, Silver, Gold, Diamond, Master, Legend, Top 100).
    • 8-Player Single Elimination Bracket Tournament.
    • Custom Friendly rooms with shareable URLs and configurable blink thresholds.
    • Procedural Web Audio API sound effects (no external audio assets required).

Environment variables (Vercel & Firebase)

To host on Vercel with Firebase, configure the following environment variables in your Vercel Project Settings (Settings -> Environment Variables):

Variable Name Description Example
NEXT_PUBLIC_FIREBASE_API_KEY Firebase Web API Key AIzaSyD-sample-key-1234
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN Firebase Auth Domain stare-app.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID Firebase Project ID stare-app
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET Firebase Storage Bucket stare-app.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID FCM Messaging Sender ID 123456789012
NEXT_PUBLIC_FIREBASE_APP_ID Firebase Web App ID 1:123456:web:abcd1234
NEXT_PUBLIC_FIREBASE_DATABASE_URL Realtime DB URL for WebRTC https://stare-app-default-rtdb.firebaseio.com
NEXT_PUBLIC_APP_URL Deployed Vercel Domain https://stare.vercel.app

Note: Stare includes an automated client-side fallback provider, allowing the entire application and AI referee engine to operate seamlessly out of the box even before Firebase credentials are configured.


Tech Stack

  • Framework: Next.js 14 (App Router, React 18, TypeScript)
  • Styling: Tailwind CSS (Minimalist neutral dark palette inspired by Apple, Linear, and Stripe)
  • Computer Vision & AI: MediaPipe FaceLandmarker, 468 Facial Landmarks, Eye Aspect Ratio (EAR), 3D Perspective Head Pose
  • Signaling & Database: Firebase Firestore, Realtime Database, WebRTC Peer-to-Peer
  • Audio: Web Audio API procedural oscillator synthesis (countdown beeps, referee whistles, victory fanfares)
  • Deployment: Vercel

Local Development

git clone https://github.com/GraphicMiles/Peekaboo.git
cd Peekaboo
npm install
npm run dev

Visit http://localhost:3000 to run the application.

About

Stare - the internet's first real-time AI staring competition. MediaPipe face-mesh as an impartial referee in the browser.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages