# AFNS Battle Simulator API Simulates naval surface battles between the Aegean Federation Naval Service (AFNS) and an opposing force, using the auto-resolve model of the Dynamic Campaign Mod for Sea Power. Base URL: https://aegean-battle-sim.pages.dev No key is needed. Responses are JSON. CORS is open. ## GET /api/ships Lists what can be put in a battle: the AFNS named fleet, every ship class (with AAW and ASuW ratings 1-9), preset enemy groups, doctrines, crew grades and weather. ## POST /api/battle (or GET /api/battle?enemy=...&aegean=...) Body fields (only "enemy" is required): - enemy: the opposing force. Any of: "Kirov battle group" (a preset group name or key) "slava, sovremenny, 2 krivak" (classes, with counts) [{"class": "slava"}, {"class": "krivak", "count": 2}, {"class": "sovremenny", "name": "Admiral Ushakov"}] - aegean: which AFNS ships sail. "all" (default), or names: ["Saint Martin", "Pyrgos", "Kavala"]. The "AFNS" prefix and accents are optional. A class can stand in for a hypothetical ship: [{"class": "fremm", "name": "AFNS New Hope"}] - range_nm: contact range, 3 to 200 (default 150) - weather: clear | moderate | rough | fog (default clear) - aegean_doctrine / enemy_doctrine: generic | nato | usn | soviet | chinese | jmsdf (defaults: nato for the AFNS; the enemy's navy otherwise) - aegean_crew / enemy_crew: regular | veteran | elite (default regular) - aegean_radars / enemy_radars: on | silent (default on; silent ships stay dark until seen) - aegean_fight_to_end / enemy_fight_to_end: true to never break off - mode: fight (one battle, with a log) | odds (the same battle 200 times) | both (default) - runs: odds runs, 20 to 200 (default 200) - seed: a battle number to replay an exact battle; random if left out The answer has: - summary: one paragraph to retell, with a link to watch the battle animated - fight: verdict, hours, sides (lost_pct, ships_sunk, broke_off), ships (each ship's fate, magazine with loaded/left, and what she expended), log (minute, range_nm, event; each defence line names every SAM, CIWS, gun, jammer and decoy and what it killed) - odds: verdict, typical/best/worst loss % for each side, breaks_off_pct, and each ship's sunk_pct - watch_url: opens the battle in the simulator, animated, exactly as fought - battle_no: pass it back as seed to fight the same battle again Errors come back as {"error": "..."} with status 400 and say what to fix. ## How to use it in a story Use "fight" for what happened in a particular engagement, and read the log for detail (detections, salvos, intercepts, hits, ships sunk, who broke off). Use "odds" to judge whether an engagement is wise. The model leaves out aircraft, submarines and anti-submarine warfare: it is surface ships only. Example: POST /api/battle {"aegean": ["Saint Martin", "Pyrgos", "La Trinite", "Kavala"], "enemy": "Soviet surface action group", "range_nm": 120, "mode": "fight"}