// tools/challenge-spec/scenarios-game.ts — Game-specific challenge scenarios
// Covers performance, balance, cheating, and physics edge cases.
import { contentMentions } from './scenarios-utils.js';
/**
 * Generate game-specific challenge scenarios: performance, balance, cheating, physics.
 */
export function generateGameChallenges(spec, specContent, knowledge) {
    const engine = knowledge.framework ?? 'unknown';
    const scenarios = [];
    // Performance: frame budget
    scenarios.push({
        scenario: `Frame budget exceeded with N entities (${engine})`,
        probability: 'high',
        impact: 'high',
        currentHandling: 'Not addressed in spec',
        requiredHandling: 'Entity pooling, LOD system, spatial partitioning (quad-tree/octree), profiler-guided optimization',
        dataConsistency: 'Trigger: Spawning 1000+ entities simultaneously; particle systems + physics active',
        userExperience: 'Frame drops cause noticeable stuttering; target 60fps minimum',
    });
    // Performance: memory
    scenarios.push({
        scenario: 'Memory spike causes GC stutter or crash',
        probability: 'medium',
        impact: 'high',
        currentHandling: 'Not addressed in spec',
        requiredHandling: 'Asset bundling, addressable assets, object pooling, incremental GC settings',
        dataConsistency: 'Trigger: Large scene load, texture streaming, or rapid asset instantiation',
        userExperience: 'Game freezes or crashes; player loses unsaved progress',
    });
    // Game balance
    scenarios.push({
        scenario: 'Game balance broken: exploitable cheese strategy',
        probability: 'medium',
        impact: 'medium',
        currentHandling: contentMentions(specContent.toLowerCase(), ['balance', 'cooldown', 'cap'])
            ? 'Partially addressed in spec'
            : 'Not addressed in spec',
        requiredHandling: 'Playtest data analysis, cooldowns on abilities, soft caps on stats, telemetry tracking',
        dataConsistency: `Trigger: Player discovers unintended interaction in spec "${spec.title}"`,
        userExperience: 'Game becomes trivially easy; other players feel cheated in multiplayer',
    });
    // Cheating / anti-cheat
    scenarios.push({
        scenario: 'Client-side save manipulation bypasses progression',
        probability: 'medium',
        impact: 'medium',
        currentHandling: contentMentions(specContent.toLowerCase(), ['checksum', 'server', 'validate'])
            ? 'Partially addressed'
            : 'Not addressed',
        requiredHandling: 'Server-side validation for online features, save file checksum, obfuscated formats',
        dataConsistency: 'Trigger: Player edits local save file or memory to set max stats/currency',
        userExperience: 'Unfair advantage in multiplayer; single-player achievement integrity lost',
    });
    // Physics edge case
    if (specContent.toLowerCase().includes('physic') ||
        specContent.toLowerCase().includes('collision')) {
        scenarios.push({
            scenario: 'Physics tunneling: fast objects pass through thin colliders',
            probability: 'medium',
            impact: 'high',
            currentHandling: contentMentions(specContent.toLowerCase(), ['ccd', 'continuous', 'sweep'])
                ? 'Continuous collision detection mentioned'
                : 'Not addressed',
            requiredHandling: 'Continuous collision detection (CCD), velocity clamping, sub-step physics simulation',
            dataConsistency: 'Trigger: High-speed projectile or player movement at low FPS',
            userExperience: 'Players clip through walls or floors; game-breaking exploits possible',
        });
    }
    return scenarios;
}
//# sourceMappingURL=scenarios-game.js.map