diff --git a/src/editor/data/mapPromptPresets.ts b/src/editor/data/mapPromptPresets.ts new file mode 100644 index 00000000..b2b2f28e --- /dev/null +++ b/src/editor/data/mapPromptPresets.ts @@ -0,0 +1,465 @@ +/** + * Map Prompt Presets - Starter prompts for AI map generation + * + * These presets provide curated theme descriptions for common competitive + * map archetypes, including both traditional land maps and naval maps. + */ + +import type { BiomeType } from '@/data/maps/core/ElevationMap'; +import type { MapGenerationSettings } from '../services/LLMMapGenerator'; + +// ============================================================================ +// TYPES +// ============================================================================ + +export interface MapPromptPreset { + id: string; + name: string; + description: string; + category: 'standard' | 'naval' | 'hybrid'; + prompt: string; + // Suggested settings (user can override) + suggestedSettings?: Partial; +} + +export interface PresetCategory { + id: 'standard' | 'naval' | 'hybrid'; + name: string; + description: string; +} + +// ============================================================================ +// CATEGORIES +// ============================================================================ + +export const PRESET_CATEGORIES: PresetCategory[] = [ + { + id: 'standard', + name: 'Standard', + description: 'Traditional land-based competitive maps', + }, + { + id: 'naval', + name: 'Naval', + description: 'Water-focused maps requiring naval units', + }, + { + id: 'hybrid', + name: 'Hybrid', + description: 'Mixed land and water gameplay', + }, +]; + +// ============================================================================ +// STANDARD MAP PRESETS +// ============================================================================ + +const STANDARD_PRESETS: MapPromptPreset[] = [ + { + id: 'central_highground', + name: 'Central High Ground', + category: 'standard', + description: 'Classic layout with a contested elevated center and multiple approach ramps', + prompt: `A classic competitive map with a prominent central high ground plateau that dominates the map. +Four ramps lead up to this central position from each quadrant. Main bases are positioned in the corners +on high ground with natural expansions on mid-level terrain below. Third bases are located at the map +edges between player positions. The central high ground should have a watch tower for vision control. +Include destructible rocks blocking alternate paths to natural expansions. Forests provide vision +blockers near third base positions.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + includeForests: true, + }, + }, + { + id: 'clean_macro', + name: 'Clean Macro', + category: 'standard', + description: 'Open layout favoring economic play with strong rush distance', + prompt: `A balanced macro-focused map with generous rush distance between starting positions. +Main bases on high ground in corners with wide, defensible ramps to natural expansions on mid ground. +Natural expansions have clear mineral lines facing away from attack paths. Third bases are positioned +along the edges with moderate travel distance. The center is relatively open with gentle elevation +changes rather than sharp cliffs. Watch towers at strategic midpoints. Minimal choke points to +encourage mobile army positioning. Some scattered rocks and light forests for tactical cover.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + includeForests: true, + }, + }, + { + id: 'vertical_split', + name: 'Vertical Split', + category: 'standard', + description: 'Tall map layout with gold bases rewarding aggressive expansion', + prompt: `A vertically-oriented map where players spawn on opposite ends (top and bottom). +Main bases on high ground with natural expansions directly below on mid ground. The map is taller +than it is wide, creating long attack distances through the center. Gold bases are positioned in +risky locations near the map center, rewarding aggressive play. Multiple attack paths run vertically +with elevation changes creating natural defensive positions. Watch towers along the central corridor. +Destructible rocks open shortcuts between lanes.`, + suggestedSettings: { + playerCount: 2, + mapSize: 'medium', + }, + }, + { + id: 'close_quarters', + name: 'Close Quarters', + category: 'standard', + description: 'Tight 2-player map with short rush distance and aggressive gameplay', + prompt: `A compact two-player map designed for aggressive, action-packed games. Short rush +distance between main bases. Main bases on high ground with small, tight ramps that are easy to +wall off. Natural expansions are close to mains but exposed to attack. A single dominant attack +path runs through the center with a key high ground position. Third bases are risky and hard to +defend. Watch tower at the center rewards early scouting. Dense forests along the edges provide +flanking opportunities. Designed for fast-paced games with early confrontations.`, + suggestedSettings: { + playerCount: 2, + mapSize: 'small', + includeForests: true, + }, + }, + { + id: 'cross_positions', + name: 'Cross Positions', + category: 'standard', + description: 'Four-player map optimized for diagonal cross-spawn matchups', + prompt: `A four-player map where cross-spawns (diagonal positions) create the most balanced +matchups. Main bases in corners on high ground with naturals on mid ground. When players spawn +cross-map, they have equal rush distance through the center. The center features a large open +area with scattered high ground positions and watch towers. Third bases are tucked along the +edges between spawn positions. Fourth bases near the center are high-risk, high-reward. +Destructible rocks block shortcuts that would make close-spawn positions unfair.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + }, + }, + { + id: 'fortress', + name: 'Fortress', + category: 'standard', + description: 'Highly defensible positions with limited attack paths', + prompt: `A defensive map where each player starts in a fortress-like position. Main bases +on high ground with narrow ramps that are easy to wall and defend. Natural expansions are +tucked behind the main, creating a secure pocket. Only one or two main attack paths lead to +each base position. The center is open but requires committing through choke points to attack. +Watch towers guard the approaches. Third bases require venturing out of the fortress. +Destructible rocks can open backdoor paths for flanking maneuvers.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'medium', + includeForests: true, + }, + }, + { + id: 'open_plains', + name: 'Open Plains', + category: 'standard', + description: 'Wide open map with minimal chokes favoring mobile armies', + prompt: `A wide-open battlefield with minimal terrain obstructions. Main bases on +high ground corners with natural expansions on open mid-ground. Very few choke points - +armies can maneuver freely across most of the map. Elevation changes are gradual rather +than cliff-based. The center is a large open plain with scattered watch towers. Third +and fourth bases are spread around the perimeter. Light forests provide some tactical +cover but the map emphasizes army control and positioning over terrain advantages.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'huge', + includeForests: true, + }, + }, + { + id: 'ring_of_fire', + name: 'Ring of Fire', + category: 'standard', + description: 'Circular layout with bases around the perimeter and contested center', + prompt: `A circular map design with player bases arranged around the outer ring on +high ground. Natural expansions drop down to mid-ground toward the center. The map +center features a large low-ground arena with a raised platform in the very middle +holding a watch tower. Multiple ramps connect the outer ring to the central area. +Third bases are positioned between player starting locations along the ring. The +circular design ensures equal distances between all positions.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + }, + }, +]; + +// ============================================================================ +// NAVAL MAP PRESETS +// ============================================================================ + +const NAVAL_PRESETS: MapPromptPreset[] = [ + { + id: 'island_hopping', + name: 'Island Hopping', + category: 'naval', + description: 'Separate starting islands requiring naval transport or combat', + prompt: `Each player starts on their own isolated island surrounded by deep water. +Main bases occupy the center of each island on high ground. Natural expansions are on +the same island at lower elevation near the shore. To reach enemy players, you must +cross deep water - either by naval transport or naval combat units. Small neutral +islands in the water between players contain additional expansion locations and watch +towers. Shallow water near shorelines allows some ground unit movement. The islands +should be large enough to feel like complete bases but small enough that naval +dominance is essential for victory.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'ocean' as BiomeType, + includeWater: true, + islandMap: true, + }, + }, + { + id: 'coastal_assault', + name: 'Coastal Assault', + category: 'naval', + description: 'Mainland bases with valuable island expansions across the water', + prompt: `Players start on a large central landmass with their main bases on high +ground near the coast. Natural expansions are inland, safe from naval attack. However, +the richest expansion locations (gold bases) are on islands offshore that can only be +reached by water. Deep water separates the mainland from these island expansions. +Players must balance defending their mainland territory while projecting naval power +to secure island resources. Watch towers on coastal cliffs provide vision of approaching +naval forces. Some shallow water areas allow ground units to wade between close islands.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'huge', + includeWater: true, + islandMap: true, + }, + }, + { + id: 'archipelago', + name: 'Archipelago', + category: 'naval', + description: 'Scattered small islands with bridges and water channels', + prompt: `A scattered collection of small to medium islands connected by a mix of +land bridges and deep water channels. Players start on medium-sized islands with room +for main and natural bases. Expansion requires claiming neighboring islands - some +accessible by narrow land bridges, others only by water. The map should feel fragmented +with no dominant landmass. Deep water channels create naval highways between island +clusters. Watch towers on small central islands provide strategic vision. Shallow water +around island shores creates beach landing zones.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'jungle' as BiomeType, + includeWater: true, + islandMap: true, + }, + }, + { + id: 'river_divide', + name: 'River Divide', + category: 'naval', + description: 'Wide river splits the map with bridge chokepoints', + prompt: `A wide, deep river runs through the center of the map, completely dividing +it into two halves. Players on opposite sides of the river cannot attack by land except +through heavily contested bridge crossings. Two or three bridges span the river at key +locations, creating critical choke points. Main bases are set back from the river on +high ground with natural expansions on the riverbank. Control of the bridges and the +river itself (via naval units) is essential. Small islands in the river contain watch +towers and expansion locations. The river should be wide enough to feel like a real +naval battlefield.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + includeWater: true, + }, + }, + { + id: 'peninsula_war', + name: 'Peninsula War', + category: 'naval', + description: 'Bases on peninsulas jutting into central ocean', + prompt: `Each player starts on a peninsula that juts out into a large central ocean. +Main bases are at the tip of each peninsula on high ground, with natural expansions +further back on the land connection. The peninsulas are connected by land around the +outer edge of the map, but this path is long and winding. The direct route between +players is across the central ocean. Peninsulas are narrow enough that naval +bombardment from the water can threaten inland structures. Small islands in the +central ocean offer expansion opportunities for those who control the water.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'grassland' as BiomeType, + includeWater: true, + islandMap: true, + }, + }, + { + id: 'atoll', + name: 'Atoll', + category: 'naval', + description: 'Ring of islands around a central deep water lagoon', + prompt: `A ring-shaped arrangement of islands surrounds a deep central lagoon. +Players start on the larger islands in the outer ring with main bases on high ground. +The islands are connected by a mix of shallow water (allowing ground unit crossing) +and land bridges. The central lagoon is deep water with a small island in the very +center containing a powerful watch tower position. Controlling the central lagoon +with naval forces provides map control and the ability to strike any position on +the ring. Outer edges of the atoll drop off into impassable void.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'ocean' as BiomeType, + includeWater: true, + islandMap: true, + }, + }, +]; + +// ============================================================================ +// HYBRID MAP PRESETS +// ============================================================================ + +const HYBRID_PRESETS: MapPromptPreset[] = [ + { + id: 'port_city', + name: 'Port City', + category: 'hybrid', + description: 'Coastal urban map with harbors and mixed land/water combat', + prompt: `A coastal battlefield with significant land area and a large bay or harbor. +Main bases are inland on high ground, safe from naval attack. Natural expansions are +at the coast near docking areas. The bay cuts into the map, allowing naval units to +threaten coastal positions while remaining protected from land-based attacks. Some +expansions are on small islands in the bay, requiring naval access. Land routes exist +between all players but naval control of the bay provides flanking opportunities and +faster reinforcement routes. Ruined structures and debris suggest an urban/industrial +setting.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + includeWater: true, + }, + }, + { + id: 'fjord', + name: 'Fjord', + category: 'hybrid', + description: 'Narrow water channels between high cliff walls', + prompt: `A dramatic landscape of high cliffs separated by narrow, deep water channels +(fjords). Main bases sit atop the cliffs on high ground with ramps leading down to +mid-level plateaus. The fjords cut between these elevated land masses, allowing naval +units to navigate between player positions. Land bridges cross the fjords at a few key +points, creating important chokepoints. Expansion locations are found both on the cliff +tops and on narrow beaches at water level. Naval units in the fjords can support land +battles or threaten coastal expansions. The cliff walls create dramatic elevation +differences.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'frozen' as BiomeType, + includeWater: true, + }, + }, + { + id: 'river_delta', + name: 'River Delta', + category: 'hybrid', + description: 'Branching waterways creating multiple islands and paths', + prompt: `A river delta where multiple branching waterways create a maze of islands +and peninsulas. Main bases are on larger, more stable landmasses on high ground. The +river branches create natural boundaries between territories, with some crossings via +shallow water and others requiring bridges or naval transport. The waterways vary from +shallow (crossable by ground units) to deep (naval only). Expansion locations are +scattered across the various islands and peninsulas. Control of key waterway +intersections provides strategic advantages. Forests and vegetation are dense, +fitting a delta/swamp environment.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'huge', + biome: 'jungle' as BiomeType, + includeWater: true, + includeForests: true, + }, + }, + { + id: 'frozen_shore', + name: 'Frozen Shore', + category: 'hybrid', + description: 'Icy coastline with frozen shallows and open water', + prompt: `A frozen coastal map where the boundary between land and sea is blurred by +ice. Main bases are inland on high ground in a frozen/tundra environment. The coastline +features a mix of frozen shallow water (walkable but slow) and open deep water. Some +areas that appear frozen are actually thin ice over deep water - only naval units can +traverse these. Expansions along the coast risk both naval attack and ground assault. +Icebergs and frozen rock formations provide cover. A frozen bay or inlet creates +opportunities for naval flanking maneuvers.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'frozen' as BiomeType, + includeWater: true, + }, + }, + { + id: 'volcanic_islands', + name: 'Volcanic Islands', + category: 'hybrid', + description: 'Volcanic archipelago with lava hazards and water channels', + prompt: `A chain of volcanic islands with dramatic terrain. Main bases are in the +caldera or on the slopes of dormant volcanic peaks on high ground. Active lava flows +create impassable hazards in some areas. Deep water channels separate the islands, +requiring naval transport to move between them. Some islands are connected by hardened +lava bridges. The central volcano is the dominant terrain feature with valuable +expansion locations on its slopes. Volcanic rock formations and crystal deposits +from mineral-rich volcanic soil dot the landscape.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'large', + biome: 'volcanic' as BiomeType, + includeWater: true, + islandMap: true, + }, + }, + { + id: 'twin_continents', + name: 'Twin Continents', + category: 'hybrid', + description: 'Two large landmasses separated by a contested strait', + prompt: `Two large continent-like landmasses separated by a central strait of water. +Each continent can support multiple players (for team games) or one player each (for 1v1). +Main bases are deep in the interior of each continent on high ground. Natural expansions +spread toward the coast. The strait between continents is narrow enough for long-range +units to fire across but requires naval transport for ground forces. Small islands in +the strait provide stepping stones and watch tower positions. Control of the strait +determines who can project power to the enemy continent.`, + suggestedSettings: { + playerCount: 4, + mapSize: 'huge', + includeWater: true, + }, + }, +]; + +// ============================================================================ +// EXPORTS +// ============================================================================ + +export const MAP_PROMPT_PRESETS: MapPromptPreset[] = [ + ...STANDARD_PRESETS, + ...NAVAL_PRESETS, + ...HYBRID_PRESETS, +]; + +/** + * Get presets filtered by category + */ +export function getPresetsByCategory(category: PresetCategory['id']): MapPromptPreset[] { + return MAP_PROMPT_PRESETS.filter((preset) => preset.category === category); +} + +/** + * Get a preset by ID + */ +export function getPresetById(id: string): MapPromptPreset | undefined { + return MAP_PROMPT_PRESETS.find((preset) => preset.id === id); +} diff --git a/src/editor/panels/AIGeneratePanel.tsx b/src/editor/panels/AIGeneratePanel.tsx index 92dd7b53..48bf9b43 100644 --- a/src/editor/panels/AIGeneratePanel.tsx +++ b/src/editor/panels/AIGeneratePanel.tsx @@ -16,6 +16,13 @@ import type { MapData } from '@/data/maps/MapTypes'; import type { BiomeType } from '@/data/maps/core/ElevationMap'; import { useLLMGeneration } from '../hooks/useLLMGeneration'; import type { LLMProvider, MapGenerationSettings } from '../services/LLMMapGenerator'; +import { + MAP_PROMPT_PRESETS, + PRESET_CATEGORIES, + getPresetsByCategory, + type MapPromptPreset, + type PresetCategory, +} from '../data/mapPromptPresets'; // ============================================================================ // TYPES @@ -190,6 +197,22 @@ export function AIGeneratePanel({ config, onMapGenerated }: AIGeneratePanelProps const theme = config.theme; const [state, actions] = useLLMGeneration(); const [showApiKey, setShowApiKey] = useState(false); + const [selectedCategory, setSelectedCategory] = useState('standard'); + const [selectedPresetId, setSelectedPresetId] = useState(null); + + // Get presets for current category + const categoryPresets = getPresetsByCategory(selectedCategory); + + // Apply a preset + const applyPreset = (preset: MapPromptPreset) => { + setSelectedPresetId(preset.id); + // Update theme with the preset prompt + actions.updateSettings({ theme: preset.prompt.trim() }); + // Apply suggested settings if available + if (preset.suggestedSettings) { + actions.updateSettings(preset.suggestedSettings); + } + }; // Handle successful generation useEffect(() => { @@ -429,23 +452,129 @@ export function AIGeneratePanel({ config, onMapGenerated }: AIGeneratePanelProps + {/* Map Presets */} +
+
+ {/* Category Tabs */} +
+ {PRESET_CATEGORIES.map((category) => ( + { + setSelectedCategory(category.id); + setSelectedPresetId(null); + }} + theme={theme} + > + {category.name} + + ))} +
+ + {/* Preset List */} +
+ {categoryPresets.map((preset) => ( + + ))} +
+ + {/* Category Description */} +
+ {PRESET_CATEGORIES.find((c) => c.id === selectedCategory)?.description} +
+
+
+ {/* Theme Description */}
+
+ + {selectedPresetId && ( + + )} +