Skip to content

About

AI Roast Battle is a browser-based comedy game where you challenge an AI in a timed roast battle. Enter something about yourself, receive an AI-generated roast, and get 30 seconds to write a comeback. An AI judge then evaluates your response based on creativity, comedy, and damage.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

AI Roast Battle

AI Roast Battle is a browser-based comedy game where you challenge an AI in a timed roast battle.

Enter something about yourself, receive an AI-generated roast, and get 30 seconds to write a comeback. An AI judge then evaluates your response based on creativity, comedy, and damage.

Live Demo

https://ai-battel-g.onrender.com/

How It Works

  1. Start a battle.
  2. Enter something about yourself.
  3. Receive an AI-generated roast.
  4. Write a comeback within 30 seconds.
  5. Submit your response.
  6. AI evaluates your comeback.
  7. View your battle result.

Features

  • AI-generated roast battles
  • 30-second timed comebacks
  • AI-powered comeback judging
  • Multiple heat levels: Mild, Spicy, Savage
  • Standard, Chaos, and Developer battle modes
  • Input and AI response validation
  • Fallback handling for AI failures
  • Protection against duplicate and expired submissions

Only features currently enabled in the deployed application should be considered available.

Tech Stack

Layer Technology
Frontend React + TypeScript
Build Tool Vite
Backend TypeScript
AI Gemini
Styling CSS
Deployment Render
Version Control Git + GitHub

Architecture

Player
  |
  v
React Frontend
  |
  v
Application Server
  |
  +--> Validation & Safety
  |
  +--> AI Roast Generation
  |
  +--> AI Judging
  |
  v
Battle Result

AI requests are handled server-side so API credentials are not exposed in the browser.

Application Flow

The application follows a simple gameplay pipeline while keeping AI processing and validation on the server.

User Gameplay Flow

flowchart TD
    A["Player"] --> B["Battle Arena"]
    B --> C["Select Battle Mode"]
    C --> D["Configure Heat Level"]
    D --> E["Enter Personal Prompt"]

    E --> F["Input Validation"]
    F -->|Valid| G["Roast Generation"]
    F -->|Invalid| E

    G --> H["AI Roast Engine"]
    H --> I["Display Generated Roast"]

    I --> J["Start 30-Second Timer"]
    J --> K["Write Comeback"]
    K --> L["Submit Response"]

    L --> M{"Round Valid?"}
    M -->|Yes| N["AI Judge"]
    M -->|Expired| O["Round Expired"]

    N --> P["Evaluate Creativity"]
    N --> Q["Evaluate Comedy"]
    N --> R["Evaluate Damage"]

    P --> S["Battle Score"]
    Q --> S
    R --> S

    S --> T["Battle Result"]
    O --> T

    T --> U{"Play Again?"}
    U -->|Yes| B
    U -->|No| V["Return to Arena"]
Loading

AI Processing Flow

flowchart LR
    A["Browser Client"] --> B["Application Server"]

    B --> C["Request Validation"]
    C --> D["Safety Checks"]

    D --> E["AI Roast Service"]
    E --> F["AI Provider"]

    F --> G["AI Response"]
    G --> H["Response Validation"]

    H -->|Valid| I["Return Roast"]
    H -->|Invalid| J["Fallback Handler"]

    I --> K["Browser"]
    J --> K

    K --> L["Player Comeback"]
    L --> B

    B --> M["AI Judge Service"]
    M --> F

    F --> N["Evaluation Response"]
    N --> O["Result Validation"]
    O --> P["Battle Result"]
    P --> K
Loading

Failure Handling Flow

External AI services can fail or return unexpected data. The application therefore validates external responses before allowing them to affect the game state.

flowchart TD
    A["AI Request"] --> B{"Response Received?"}

    B -->|No| C["Timeout / API Failure"]
    B -->|Yes| D["Response Validation"]

    D --> E{"Response Valid?"}

    E -->|Yes| F["Continue Battle"]
    E -->|No| G["Fallback / Error Handler"]

    C --> G

    G --> H["Controlled Recovery"]
    H --> I["Preserve Game State"]

    F --> J["Continue Gameplay"]
    I --> J
Loading

Project Structure

src/
├── components/
├── utils/
├── App.tsx
├── main.tsx
└── types.ts

server/
├── auditEngine.ts
├── db.ts
├── fallbackRoasts.ts
├── gemini.ts
├── safety.ts
└── types.ts

server.ts
vite.config.ts
package.json
.env.example

Security

Never commit API keys or other secrets to Git.

Use environment variables for sensitive configuration:

AI_API_KEY=your_api_key_here

See SECURITY.md for security guidelines.

Local Development

git clone <your-repository-url>
cd <project-directory>
bun install

Create .env, configure your API key, then run:

bun run dev

Open the local URL shown by the development server.

Resilience

The application is designed to handle:

  • AI timeouts
  • API failures
  • Rate limits
  • Empty or malformed AI responses
  • Invalid input
  • Expired rounds
  • Duplicate submissions
  • Prompt injection attempts

License

This project is licensed under the MIT License. See LICENSE.

About

AI Roast Battle is a browser-based comedy game where you challenge an AI in a timed roast battle. Enter something about yourself, receive an AI-generated roast, and get 30 seconds to write a comeback. An AI judge then evaluates your response based on creativity, comedy, and damage.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages