Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NEON RUNNER · 霓虹潜行

Outstanding Game AI Course Project · Academic Year 2025–2026

A cyberpunk, turn-based stealth game that combines deterministic tactical AI with an LLM strategic commander. Players infiltrate a corporate data center, collect the core chip, and escape while autonomous drones coordinate patrol, pursuit, search, and interception.

NEON RUNNER cover

Why this project matters

NEON RUNNER explores a practical hybrid-AI design: gameplay-critical perception and movement stay local, fast, and testable, while a language model may coordinate higher-level roles. The game remains fully playable when the model is unavailable because every LLM decision has a validated rule-based fallback.

AI architecture

flowchart TD
    A[Turn state] --> B[Local perception]
    B --> C[Bresenham line of sight]
    B --> D[Directional field of view]
    C --> E[Five-state drone FSM]
    D --> E
    E --> F[A* tactical movement]
    A --> G{Every N turns or new sighting}
    G --> H[Sanitized situation JSON]
    H --> I[Optional LLM commander]
    I --> J[Schema and role validation]
    J --> K[Strategic role assignment]
    I -->|timeout, error, invalid JSON| L[Deterministic commander]
    L --> K
    K --> E
Loading

Tactical layer: deterministic game AI

  • A* pathfinding: drones navigate walls toward patrol points, search targets, or the player's last known position.
  • Binary-heap frontier: the pathfinder avoids repeated full-list sorting while exploring the grid.
  • Bresenham line of sight: walls block detection even when the player is geometrically inside the vision cone.
  • Directional FOV: angle, range, and occlusion combine into the visible-cell overlay shown to the player.
  • Five-state FSM: each drone transitions through PATROL, SUSPICIOUS, CALL_BACKUP, CHASE, and SEARCH.
  • Readable counterplay: detection rises while the player remains visible and decays after line of sight is broken.

Strategic layer: SENTINEL commander

The optional commander receives a compact JSON snapshot and assigns valid roles such as CHASE_PLAYER, INTERCEPT_EXIT, GUARD_OBJECTIVE, SEARCH_LAST_SEEN, and PATROL.

Engineering safeguards include:

  • asynchronous requests that do not block the turn loop;
  • request timeouts and network-error handling;
  • JSON extraction from imperfect model output;
  • an allowlist for roles and live drone identifiers;
  • a deterministic fallback that prioritizes pursuit, exit interception, and objective defense.

This separation keeps the game responsive and reproducible while allowing the strategic layer to vary between sessions.

Gameplay

The player is the RUNNER, infiltrating NEXUS CORP in 2089. Collect the gold core chip and reach the green extraction tile before a chasing drone catches you. Optional data fragments increase the score.

Input Action
WASD or arrow keys move one grid cell
Space wait for one turn
F + direction deploy a distraction signal

Two maps and multiple difficulty configurations vary patrols, sight range, detection speed, and distraction resources.

Run locally

No Node.js build is required. Serving the directory over HTTP avoids browser restrictions on local files:

python3 -m http.server 8000

Open http://localhost:8000. Phaser 3 and web fonts are loaded from public CDNs, so the initial launch needs network access.

Optional LLM configuration

The rule-based SENTINEL works without credentials. To test an OpenAI-compatible model, copy the configuration shape from config.example.js into the local js/config.js configuration and keep the key out of commits:

const LLM_CONFIG = {
  enabled: true,
  apiKey: "YOUR_LOCAL_KEY",
  baseURL: "https://api.deepseek.com/v1",
  model: "deepseek-chat",
  timeout: 5000,
};

Because this is a browser-only prototype, a configured key is visible to the browser. Use a restricted temporary key for local demonstrations. A deployed version should proxy model calls through a server.

Repository structure

index.html          # browser entry point
css/theme.css       # cyberpunk visual system
js/config.js        # gameplay difficulty and local model settings
js/maps.js          # two tile maps and object placement
js/entities.js      # player and drone data models
js/pathfinding.js   # A*, line of sight, and field of view
js/fsm.js           # five-state drone behavior
js/llm.js           # OpenAI-compatible request wrapper
js/commander.js     # strategic assignments and deterministic fallback
js/render.js        # drawing helpers
js/game.js          # turn loop and game scene
js/main.js          # Phaser boot, start, and result scenes

Engineering contribution and development process

The implementation was AI-assisted. The project owner defined the game and hybrid-AI architecture, designed and iterated the SENTINEL prompt, validated model output, repaired map connectivity and invalid item placement, tuned detection and difficulty through playtesting, and refined the HUD and fallback behavior. AI_CODING_SUMMARY.md documents that process instead of presenting generated scaffolding as unaided work.

Limitations

  • The repository currently relies on manual playtesting rather than an automated map-solvability test suite.
  • Direct browser model calls are suitable only for local demonstrations, not production credential handling.
  • LLM latency and nondeterminism may change strategic assignments; the tactical layer and fallback preserve playability.
  • CDN dependencies prevent a fully offline first launch unless Phaser and fonts are vendored locally.

Note: This project was initially developed locally. The Git repository was created when the codebase was prepared for publication, so the early development history is unavailable. Subsequent updates are tracked in this repository.

About

Outstanding 2025–2026 The Practice of AI Applications in Games course project: a cyberpunk stealth game with FSM drones, A* pathfinding, and an LLM commander.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages