/** * ============================================================================================== * Modul: DTIM-ZEC NORN ATOM-STARSHIP V2 — DAMTP ATOM CONSTRUCTOR & AUTONOMOUS ECONOMY * Datei: TLW_Atom_Starship_Norn_V2.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Projekt-DB: https://xqskys.de * Version: 5.0.0 (V2 · DAMTP Axiomatic Visuals, Station Treasury Cubes, Atom Lab & DevMode) * * Lizenz-Header: * - Source Code (.pde / .php): MIT License * - Documents & Open Data: CC0 1.0 Universal * Copyright (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * ============================================================================================== */ int langMode = 0; boolean languageChosen = false; int viewMode = 0; // 0=Kosmos, 1=Tech, 2=3D-Basis, 3=3D-Walk, 4=Handel, 5=Mars, 6=Atom-Bau boolean a11yMode = false; // Global Accessibility Toggle: Standard <-> High Contrast / Colorblind float simTime = 0.0; // DEVELOPMENT MODUS (4 Sekunden Taste 'c' / 'C' halten = 240 Frames) boolean keyCHeld = false; int devHoldFrames = 0; boolean devModeActive = false; int devPopupTimer = 0; // WELT- & SCHIFFS-KINEMATIK float WORLD_SIZE = 7200.0; float HALF_WORLD = 3600.0; float shipX = 0.0; float shipY = 0.0; float shipVX = 0.0; float shipVY = 0.0; float shipAngle = 0.0; float camX = 0.0; float camY = 0.0; boolean drivesActive = true; // KAPITALISTISCH GEKOPPELTE RESSOURCEN (Ausbalancierte Startwerte) int rawErz = 50; int refinedErz = 90; int totalErzBuilt = 90; int rawQuanta = 5; int researchFP = 85; int totalFPBuilt = 85; int creditsEUR = 120; int wasteEntropy = 0; int hullHP = 100; int maxHullHP = 100; int rawOreCap = 100; int cargoCap = 16; int[] cargoQty = { 2, 1, 1, 1 }; int[] goodBasePrice = { 22, 38, 64, 92 }; int[] goodOreCost = { 10, 16, 24, 30 }; int[] goodFpCost = { 2, 6, 12, 18 }; String[] goodNameDe = { "CNT-Aerogel-Matten", "Bariumtitanat-Kerne", "Zeno-Stasis-Kapseln", "Plasma-Döner & Ayran" }; String[] goodNameEn = { "CNT Aerogel Mats", "Barium Titanate Cores", "Zeno Stasis Pods", "Plasma Doner & Ayran" }; ArrayList fractalDrones, npcShips, spaceStations, remotePeers; ArrayList spaceAtoms, spaceBonds, spaceQuanta, spaceRifts, spaceShots, shockRings, floatingTags; ArrayList evmCounterStates; // Kapitel 1.2: Sichtbare -E Counter-States -> Voids int dockedStationIdx = -1; int npcCubesCount = 0; int stationYieldTimer = 0; // KAPITEL 6: KAPITALISTISCHER ATOM-BAU-KONSTRUKTOR (WIE ATOM_SIMULATOR_2) int labProtons = 1; int labNeutrons = 1; int labElectrons = 1; int labBuildMode = 0; // 0 = Kern-Modus (Fusion Permit), 1 = Topologischer Molekül-Modus boolean labExpertMatrix = true; int COST_PROTON_ERZ = 4; int COST_PROTON_EUR = 2; int COST_NEUTRON_ERZ = 4; int COST_NEUTRON_FP = 1; int COST_ELEC_FP = 2; int COST_ELEC_EUR = 1; // MARS-AUFBAUBASIS (3x3 SYMMETRISCHES RASTER) float MARS_BASE_X = 0.0; float MARS_BASE_Y = 1320.0; float MARS_PAD_W = 190.0; float MARS_PAD_H = 116.0; float MARS_STEP_X = 226.0; float MARS_STEP_Y = 152.0; float MARS_START_X = -321.0; float MARS_START_Y = -210.0; float[] marsPadProg = new float[9]; int[] marsReqGoodA = { 0, 1, 0, 1, 2, 2, 3, 3, 1 }; int[] marsReqGoodB = { -1, -1, -1, -1, -1, -1, -1, 0, 0 }; int marsSettlers = 0; boolean marsShieldOn = false; boolean marsDefenseOn = true; boolean marsHomeworldUnlocked = false; boolean showHomeworldBanner = false; int marsBuildCooldown = 0; int marsStaySquare = -1; int marsStayFrames = 0; float marsEventTimer = 420.0; boolean marsFlareOn = false; int marsFlareTime = 0; boolean marsMeteorOn = false; float marsMetX = 0.0; float marsMetY = 1000.0; float marsMetVX = 0.0; float marsMetVY = 0.30; float marsMetHP = 100.0; int marsLaserTimer = 0; // PHASE 2: 0-KLICK NORN-HEIMATWELT-FARM int hwKorn = 3, hwTom = 3, hwWasser = 4, hwHeu = 2; int hwMilch = 0, hwKaese = 0, hwMehl = 0, hwPizza = 0; float hwKornGrow = 0.0, hwTomGrow = 0.0; boolean hwStallBuilt = false, hwMuehleBuilt = false, hwKaeseBuilt = false; float hwStallWork = 0.0, hwMuehleWork = 0.0, hwKaeseWork = 0.0, hwPizzaWork = 0.0; float hwWalkerX = 560.0, hwWalkerY = 320.0, hwWalkAnim = 0.0; int activeWeapon = 1; boolean autoAim = true; boolean zeroClick = false; int autoFireTimer = 0; float aimAngle = 0.0; MultiShellAtom lockedAtom = null; MultiShellAtom playerShotAtom = null; int playerShotClaimTimer = 0; String sensorInfo = ""; boolean keyW = false, keyA = false, keyS = false, keyD = false; boolean keyTurnL = false, keyTurnR = false; boolean mouseSteer = true; String myClientId = ""; boolean lobbyOnline = false; int onlinePlayers = 1; int lobbySyncTimer = 0; String localQuickSave = ""; String bannerHead = ""; String bannerSub = ""; int NUM_TECH = 12; String[] tCode = new String[12]; String[] tTitleDe = new String[12]; String[] tTitleEn = new String[12]; String[] tBranchDe = new String[12]; String[] tBranchEn = new String[12]; String[] tDescDe = new String[12]; String[] tDescEn = new String[12]; int[] tBranchId = new int[12]; int[] tTier = new int[12]; int[] tPrereq = new int[12]; int[] tCost = new int[12]; int[] tLevel = new int[12]; boolean freeTechMode = false; float nornAtpPulse = 40.0; int BASE_DIM = 14; int BASE_HEIGHT = 6; int[] baseVoxels = new int[14 * 14 * 6]; int erzCubesCount = 0; int fpCubesCount = 0; int tradeCubesCount = 0; int isoRotation = 0; float walkX = 7.5, walkY = 7.5, walkDirX = 1.0, walkDirY = 0.0, walkPlaneX = 0.0, walkPlaneY = 0.66; String tr(String de, String en) { return (langMode == 0) ? de : en; } float getNormMouseX() { return constrain(mouseX, 0, width); } float getNormMouseY() { return constrain(mouseY, 0, height); } // BETHE-WEIZSÄCKER TRÖPFCHENMODELL (Semi-empirische Massenformel in MeV) float calcBetheWeizsaecker(int Z, int N) { int A = Z + N; if (A <= 1 || Z <= 0) return 0.0; float av = 15.8, as = 18.3, ac = 0.714, aa = 23.2, ap = 12.0; float Evol = av * A; float Esurf = as * pow(float(A), 2.0 / 3.0); float Ecoul = ac * Z * (Z - 1) / pow(float(A), 1.0 / 3.0); float Esym = aa * pow(float(A - 2 * Z), 2.0) / float(A); float Epair = 0.0; if (A % 2 == 0) { if (Z % 2 == 0 && N % 2 == 0) Epair = ap / sqrt(float(A)); else Epair = -ap / sqrt(float(A)); } return max(0.0, Evol - Esurf - Ecoul - Esym + Epair); } // Dual-Mode Accessibility Palette (WCAG 2.1 AA >= 4.5:1) int getUiPalette(boolean hc, int role) { if (hc) { if (role == 0) return color(0, 0, 0); if (role == 1) return color(10, 14, 24); if (role == 2) return color(180, 95, 0); if (role == 3) return color(0, 82, 155); if (role == 4) return color(255, 225, 45); return color(255, 255, 255); } if (role == 0) return color(6, 8, 14); if (role == 1) return color(13, 16, 26); if (role == 2) return color(122, 16, 38); if (role == 3) return color(18, 46, 98); if (role == 4) return color(225, 55, 85); return color(242, 246, 255); } int getKindColor(boolean hc, int k) { if (hc) { if (k == 1 || k == 9) return color(255, 165, 0); if (k == 2) return color(235, 242, 255); if (k == 3) return color(86, 195, 255); if (k == 4) return color(255, 235, 55); if (k == 5 || k == 7) return color(0, 235, 175); if (k == 6 || k == 8) return color(245, 120, 215); return color(255, 255, 255); } if (k == 1) return color(220, 42, 74); if (k == 2) return color(185, 198, 220); if (k == 3) return color(65, 145, 255); if (k == 4) return color(255, 215, 55); if (k == 5) return color(35, 215, 155); if (k == 6) return color(205, 85, 235); if (k == 7) return color(0, 255, 180); if (k == 8) return color(255, 45, 65); return color(255, 135, 55); } void pushBanner(String h, String s) { bannerHead = h; bannerSub = s; } void detectSystemAccessibilityPreference() { try { if (typeof window != "undefined" && window.matchMedia) { if (window.matchMedia("(prefers-contrast: more)").matches || window.matchMedia("(forced-colors: active)").matches) a11yMode = true; if (typeof window.nornA11yHighContrast != "undefined") a11yMode = Boolean(window.nornA11yHighContrast); } } catch (Exception e) {} } void toggleGlobalA11yMode() { a11yMode = !a11yMode; try { if (typeof window != "undefined") { window.nornA11yHighContrast = a11yMode; if (window.document && window.document.documentElement) { window.document.documentElement.setAttribute("data-a11y", a11yMode ? "highcontrast" : "standard"); } } } catch (Exception e) {} } String getA11yToggleLabel() { return a11yMode ? tr("Sehhilfe: High Contrast", "A11y: High Contrast") : tr("Sehhilfe: Standard", "A11y: Standard"); } void setup() { size(1120, 740); noSmooth(); frameRate(60); detectSystemAccessibilityPreference(); myClientId = "N" + int(random(100000, 999999)) + "_" + millis(); spaceAtoms = new ArrayList(); spaceBonds = new ArrayList(); spaceQuanta = new ArrayList(); spaceRifts = new ArrayList(); spaceShots = new ArrayList(); shockRings = new ArrayList(); floatingTags = new ArrayList(); fractalDrones = new ArrayList(); npcShips = new ArrayList(); spaceStations = new ArrayList(); remotePeers = new ArrayList(); evmCounterStates = new ArrayList(); initTechNodes(); initVoxelBase(); initMarsBase(); initSpaceStations(); seedCosmosWorld(); initNpcFleet(); syncFractalDronesWithTech(); setWelcomeBanner(); syncNornLobby(); } void setWelcomeBanner() { bannerHead = tr("Neu: [N] Atom-Konstruktor an der Basis & autonome Stationskassen für Würfel!", "New: [N] Atom Constructor at Base & autonomous Station Treasuries for Cubes!"); bannerSub = tr("DAMTP-Effekte aktiv (ZEC -E Voids, Zeno-Messung, Tensile Stress) · [C] 4s halten = Dev-Modus", "DAMTP Visuals active (ZEC -E Voids, Zeno Lock, Tensile Stress) · Hold [C] 4s = Dev Mode"); } void initMarsBase() { for (int i = 0; i < 9; i++) marsPadProg[i] = 0.0; marsPadProg[0] = 25.0; marsPadProg[2] = 35.0; marsSettlers = 0; marsShieldOn = false; marsDefenseOn = true; marsHomeworldUnlocked = false; showHomeworldBanner = false; marsStaySquare = -1; marsStayFrames = 0; } int getMarsOverallProgress() { float sum = 0.0; for (int i = 0; i < 9; i++) sum += marsPadProg[i]; return int(sum / 9.0); } int getGridCol(int idx) { return idx % 3; } int getGridRow(int idx) { return int(floor(idx / 3.0)); } float getMarsPadLeftX(int idx) { return MARS_BASE_X + MARS_START_X + getGridCol(idx) * MARS_STEP_X; } float getMarsPadTopY(int idx) { return MARS_BASE_Y + MARS_START_Y + getGridRow(idx) * MARS_STEP_Y; } float getMarsPadCenterX(int idx) { return getMarsPadLeftX(idx) + MARS_PAD_W * 0.5; } float getMarsPadCenterY(int idx) { return getMarsPadTopY(idx) + MARS_PAD_H * 0.5; } int getMarsMenuCardX(int idx) { return 34 + getGridCol(idx) * 356; } int getMarsMenuCardY(int idx) { return 128 + getGridRow(idx) * 172; } void initSpaceStations() { spaceStations.clear(); spaceStations.add(new SpaceStation(0, 740.0, -580.0, "BASIS ALPHA: ERZ & ATOM-LABOR", "BASE ALPHA: ORE & ATOM LAB", 0, 1.05, color(225, 55, 85))); spaceStations.add(new SpaceStation(1, -780.0, 520.0, "BASIS BETA: QUANTEN-FORSCHUNG", "BASE BETA: QUANTUM RESEARCH", 1, 1.08, color(56, 189, 248))); spaceStations.add(new SpaceStation(2, -2150.0, -1850.0, "STATION GAMMA: TECH-BÖRSE", "STATION GAMMA: TECH EXCHANGE", 2, 1.20, color(250, 195, 45))); spaceStations.add(new SpaceStation(3, 2250.0, 1950.0, "HAFEN DELTA: TIEFRAUM-DEPOT", "PORT DELTA: DEEP-SPACE DEPOT", 0, 1.28, color(45, 210, 145))); spaceStations.add(new SpaceStation(4, 140.0, -2650.0, "FREIHAFEN EPSILON: KREUZ", "FREEPORT EPSILON: CROSSROADS", 2, 1.22, color(205, 85, 235))); } void initNpcFleet() { npcShips.clear(); String[] names = { "NPC Vega", "NPC Orin", "NPC Lyra", "NPC Kael", "NPC Mira" }; int[] cols = { color(250, 195, 55), color(56, 189, 248), color(244, 114, 182), color(52, 211, 153), color(192, 132, 252) }; for (int i = 0; i < 5; i++) { float ang = (TWO_PI * i) / 5.0; npcShips.add(new NpcShip(i, names[i], cos(ang) * 950.0, sin(ang) * 950.0, cols[i])); } } void initTechNodes() { setTech(0, "A1", "120°-Waben-Kopplung", "120° Honeycomb Coupling", "Antrieb", "Drive", 0, 0, -1, 15, "Verankert das Norn-Schiff auf dem Gitter (+15% Tempo).", "Anchors Norn ship on lattice (+15% speed)."); setTech(1, "A2", "ALDI-YBCO Supraleiter-Ring", "ALDI-YBCO Superconductor Ring", "Antrieb", "Drive", 0, 1, 0, 30, "Heckring für Phasengradienten (+25% Schub).", "Stern ring for phase gradient (+25% thrust)."); setTech(2, "A3", "Adjacency-Fold-Drive (0.0 G)", "Adjacency Fold Drive (0.0 G)", "Antrieb", "Drive", 0, 2, 1, 55, "Trägheitslose Gitter-Faltung (+35% Max-Tempo).", "Inertialess lattice folding (+35% max speed)."); setTech(3, "B1", "Bohr-Slater Resonanz-Photon", "Bohr-Slater Resonance Photon", "Waffen", "Weapons", 1, 0, -1, 15, "Hebt Elektronen auf höhere Schalen (+FP).", "Elevates electrons to outer shells (+RP)."); setTech(4, "B2", "Mesonenkanone (Pi+/- Salve)", "Meson Cannon (Pi+/- Salvo)", "Waffen", "Weapons", 1, 1, 3, 30, "Löst Risse auf & extrahiert Kern-Erz.", "Dissolves rifts & extracts core Ore."); setTech(5, "B3", "Gluon- & W-Boson-Injektor", "Gluon & W-Boson Injector", "Waffen", "Weapons", 1, 2, 4, 55, "Verdoppelt Erz- & Isotopen-Ausbeute.", "Doubles Ore & isotope extraction yield."); setTech(6, "C1", "CNT-Aerogel-Panzerung", "CNT Aerogel Armor", "Panzerung", "Armor", 2, 0, -1, 15, "Erhöht Hüllenintegrität (+45 Max-HP/Stufe).", "Increases hull integrity (+45 Max HP/level)."); setTech(7, "C2", "Zeno-Stasis-Deflektorschild", "Zeno-Stasis Deflector Shield", "Panzerung", "Armor", 2, 1, 6, 35, "Dämpft Riss-Kollisionen um 50%.", "Dampens rift collisions by 50%."); setTech(8, "C3", "EVM-Void-Riss-Absorber", "EVM Void Rift Absorber", "Panzerung", "Armor", 2, 2, 7, 60, "Leitet Einschlagenergie in Voids ab.", "Routes impact energy into voids."); setTech(9, "D1", "Norn-Biochemie-Pilot (ATP)", "Norn Biochemistry Pilot (ATP)", "Norn & Fraktal", "Norn & Fractal", 3, 0, -1, 15, "Erzeugt kontinuierlich Forschungspunkte.", "Continuously generates Research Points."); setTech(10, "D2", "Kleines Fraktalschiff (+Drohne)", "Little Fractal Ship (+Drone)", "Norn & Fraktal", "Norn & Fractal", 3, 1, 9, 25, "Bis zu 3 autonome Fraktal-Ernteschiffe.", "Up to 3 autonomous Fractal Harvesters."); setTech(11, "D3", "Elite-Frachtraum & Atom-Synthese", "Elite Cargo & Atom Synthesis", "Norn & Fraktal", "Norn & Fractal", 3, 2, 10, 45, "+6 Frachtraum/Stufe & +25% Atom-Bau-Dividende.", "+6 Cargo slots/level & +25% Atom Lab dividend."); for (int i = 0; i < NUM_TECH; i++) tLevel[i] = 0; tLevel[0] = 1; tLevel[3] = 1; tLevel[9] = 1; tLevel[10] = 1; recalcShipCapabilities(); } void setTech(int idx, String c, String tiDe, String tiEn, String brDe, String brEn, int bId, int tr, int pre, int cost, String dDe, String dEn) { tCode[idx] = c; tTitleDe[idx] = tiDe; tTitleEn[idx] = tiEn; tBranchDe[idx] = brDe; tBranchEn[idx] = brEn; tBranchId[idx] = bId; tTier[idx] = tr; tPrereq[idx] = pre; tCost[idx] = cost; tDescDe[idx] = dDe; tDescEn[idx] = dEn; } void recalcShipCapabilities() { maxHullHP = 100 + tLevel[6] * 45; hullHP = min(maxHullHP, hullHP); rawOreCap = 100 + tLevel[10] * 35; cargoCap = 16 + tLevel[11] * 6; syncFractalDronesWithTech(); } void syncFractalDronesWithTech() { int desired = max(1, tLevel[10]); while (fractalDrones.size() > desired) fractalDrones.remove(fractalDrones.size() - 1); while (fractalDrones.size() < desired) { float ang = fractalDrones.size() * TWO_PI / 3.0; fractalDrones.add(new FractalDrone(shipX + cos(ang) * 70.0, shipY + sin(ang) * 70.0, fractalDrones.size())); } } boolean isTooCloseToAnyStation(float wx, float wy, float minDist) { for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (dist(wx, wy, st.x, st.y) < minDist) return true; } return (abs(wx - MARS_BASE_X) < 460.0 && abs(wy - MARS_BASE_Y) < 380.0); } void seedCosmosWorld() { spaceAtoms.clear(); spaceBonds.clear(); spaceQuanta.clear(); spaceRifts.clear(); spaceShots.clear(); shockRings.clear(); floatingTags.clear(); evmCounterStates.clear(); for (int i = 0; i < 82; i++) spaceQuanta.add(new VacuumQuantum(random(-HALF_WORLD + 160, HALF_WORLD - 160), random(-HALF_WORLD + 160, HALF_WORLD - 160))); for (int i = 0; i < 32; i++) { float rx = random(-HALF_WORLD + 220, HALF_WORLD - 220), ry = random(-HALF_WORLD + 220, HALF_WORLD - 220); if (dist(0, 0, rx, ry) > 280.0 && !isTooCloseToAnyStation(rx, ry, 280.0)) spaceRifts.add(new SingularityRift(rx, ry)); } spaceAtoms.add(new MultiShellAtom(185, -50, 1, 0, 1)); spaceAtoms.add(new MultiShellAtom(278, -50, 1, 0, 1)); spaceAtoms.add(new MultiShellAtom(-195, -75, 6, 6, 6)); spaceAtoms.add(new MultiShellAtom(120, 210, 8, 8, 8)); for (int i = 0; i < 72; i++) { float ax = random(-HALF_WORLD + 220, HALF_WORLD - 220), ay = random(-HALF_WORLD + 220, HALF_WORLD - 220); if (dist(0, 0, ax, ay) < 250.0 || isTooCloseToAnyStation(ax, ay, 240.0)) continue; int r = i % 5; spaceAtoms.add(new MultiShellAtom(ax, ay, r == 0 ? 1 : (r == 1 ? 2 : (r == 2 ? 3 : (r == 3 ? 6 : 8))), r == 0 ? 0 : (r == 1 ? 2 : (r == 2 ? 4 : (r == 3 ? 6 : 8))), r == 0 ? 1 : (r == 1 ? 2 : (r == 2 ? 2 : (r == 3 ? 6 : 8))))); } } String serializeGameState() { String s1 = langMode + "," + (a11yMode ? 1 : 0) + "," + nf(shipX, 1, 1) + "," + nf(shipY, 1, 1) + "," + nf(shipAngle, 1, 3); String s2 = rawErz + "," + refinedErz + "," + totalErzBuilt + "," + rawQuanta + "," + researchFP + "," + totalFPBuilt + "," + creditsEUR + "," + wasteEntropy + "," + hullHP + "," + activeWeapon + "," + (zeroClick ? 1 : 0) + "," + erzCubesCount + "," + fpCubesCount + "," + tradeCubesCount + "," + isoRotation + "," + (drivesActive ? 1 : 0) + "," + npcCubesCount; String s3 = cargoQty[0] + "," + cargoQty[1] + "," + cargoQty[2] + "," + cargoQty[3]; String techStr = ""; for (int i = 0; i < NUM_TECH; i++) { if (i > 0) techStr += ","; techStr += tLevel[i]; } String marsStr = (marsHomeworldUnlocked ? 1 : 0) + "," + marsSettlers + "," + (marsShieldOn ? 1 : 0) + "," + (marsDefenseOn ? 1 : 0); for (int i = 0; i < 9; i++) marsStr += "," + nf(marsPadProg[i], 1, 1); marsStr += "," + hwKorn + "," + hwTom + "," + hwWasser + "," + hwHeu + "," + hwMilch + "," + hwKaese + "," + hwMehl + "," + hwPizza + "," + (hwStallBuilt ? 1 : 0) + "," + (hwMuehleBuilt ? 1 : 0) + "," + (hwKaeseBuilt ? 1 : 0); for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); marsStr += "," + st.stationCubes + "," + int(st.treasuryEUR); } String voxStr = ""; for (int i = 0; i < baseVoxels.length; i++) voxStr += baseVoxels[i]; return s1 + "|" + s2 + "|" + s3 + "|" + techStr + "|" + voxStr + "|" + marsStr; } boolean deserializeGameState(String raw) { if (raw == null || raw.length() < 30) return false; String[] parts = split(trim(raw), '|'); if (parts == null || parts.length < 5) return false; String[] p1 = split(parts[0], ','), p2 = split(parts[1], ','), p3 = split(parts[2], ','), p4 = split(parts[3], ','); String voxStr = parts[4]; if (p1 == null || p1.length < 5 || p2 == null || p2.length < 15 || p3 == null || p3.length < 4 || p4 == null || p4.length < NUM_TECH) return false; langMode = constrain(int(p1[0]), 0, 1); a11yMode = (int(p1[1]) >= 1); shipX = float(p1[2]); shipY = float(p1[3]); shipAngle = float(p1[4]); shipVX = 0; shipVY = 0; camX = shipX; camY = shipY; rawErz = int(p2[0]); refinedErz = int(p2[1]); totalErzBuilt = int(p2[2]); rawQuanta = int(p2[3]); researchFP = int(p2[4]); totalFPBuilt = int(p2[5]); creditsEUR = int(p2[6]); wasteEntropy = int(p2[7]); hullHP = int(p2[8]); activeWeapon = constrain(int(p2[9]), 1, 5); zeroClick = (int(p2[10]) == 1); erzCubesCount = int(p2[11]); fpCubesCount = int(p2[12]); tradeCubesCount = int(p2[13]); isoRotation = constrain(int(p2[14]), 0, 3); drivesActive = (p2.length >= 16) ? (int(p2[15]) == 1) : true; npcCubesCount = (p2.length >= 17) ? int(p2[16]) : 0; for (int g = 0; g < 4; g++) cargoQty[g] = int(p3[g]); for (int i = 0; i < NUM_TECH; i++) tLevel[i] = constrain(int(p4[i]), 0, 3); if (voxStr.length() >= baseVoxels.length) for (int i = 0; i < baseVoxels.length; i++) baseVoxels[i] = constrain(int(str(voxStr.charAt(i))), 0, 3); if (parts.length >= 6) { String[] p5 = split(parts[5], ','); if (p5 != null && p5.length >= 24) { marsHomeworldUnlocked = (int(p5[0]) == 1); marsSettlers = int(p5[1]); marsShieldOn = (int(p5[2]) == 1); marsDefenseOn = (int(p5[3]) == 1); for (int i = 0; i < 9; i++) marsPadProg[i] = float(p5[4 + i]); hwKorn = int(p5[13]); hwTom = int(p5[14]); hwWasser = int(p5[15]); hwHeu = int(p5[16]); hwMilch = int(p5[17]); hwKaese = int(p5[18]); hwMehl = int(p5[19]); hwPizza = int(p5[20]); hwStallBuilt = (int(p5[21]) == 1); hwMuehleBuilt = (int(p5[22]) == 1); hwKaeseBuilt = (int(p5[23]) == 1); if (p5.length >= 34) { int sumStCubes = 0; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); st.stationCubes = int(p5[24 + i * 2]); st.treasuryEUR = float(p5[25 + i * 2]); sumStCubes += st.stationCubes; } tradeCubesCount = max(tradeCubesCount, sumStCubes); } } } recalcShipCapabilities(); return true; } void saveCurrentGameSlot() { String payload = serializeGameState(); localQuickSave = payload; boolean savedRemote = false; try { String[] res = loadStrings("norn_lobby.php?action=save&cid=" + myClientId + "&data=" + payload); if (res != null) for (int i = 0; i < res.length; i++) if (trim(res[i]).equals("SAVE_STATUS=SAVED")) { savedRemote = true; lobbyOnline = true; } } catch (Exception e) {} if (!savedRemote) { try { String[] outLines = { payload }; saveStrings("norn_save.txt", outLines); } catch (Exception e) {} } spawnFloatingTag(shipX, shipY - 28, tr("SPIELSTAND GESPEICHERT!", "GAME SAVED!"), color(0, 255, 180)); pushBanner(tr("Spielstand gespeichert! (Mars: " + getMarsOverallProgress() + "%)", "Game saved! (Mars: " + getMarsOverallProgress() + "%)"), tr("Jederzeit wiederherstellbar mit [Laden / O].", "Restore anytime with [Load / O].")); } void loadSavedGameSlot() { String loadedData = ""; try { String[] res = loadStrings("norn_lobby.php?action=load&cid=" + myClientId); if (res != null) for (int i = 0; i < res.length; i++) { String line = trim(res[i]); if (line.startsWith("SAVE_DATA=")) { String val = line.substring(10); if (!val.equals("EMPTY") && val.length() > 30) { loadedData = val; lobbyOnline = true; } } } } catch (Exception e) {} if (loadedData.length() < 30) { try { String[] localLines = loadStrings("norn_save.txt"); if (localLines != null && localLines.length > 0) loadedData = localLines[0]; } catch (Exception e) {} } if (loadedData.length() < 30 && localQuickSave.length() > 30) loadedData = localQuickSave; if (deserializeGameState(loadedData)) { spawnFloatingTag(shipX, shipY - 28, tr("SPIELSTAND GELADEN!", "GAME LOADED!"), color(56, 189, 248)); pushBanner(tr("Spielstand geladen! (Mars: " + getMarsOverallProgress() + "%)", "Savegame loaded! (Mars: " + getMarsOverallProgress() + "%)"), tr("Fortschritt wiederhergestellt.", "Progress restored.")); } else pushBanner(tr("Noch kein Spielstand vorhanden.", "No saved game found yet."), tr("Klicke zuerst auf [Speichern / K].", "Click [Save / K] first.")); } void initVoxelBase() { for (int i = 0; i < baseVoxels.length; i++) baseVoxels[i] = 0; erzCubesCount = 0; fpCubesCount = 0; tradeCubesCount = 0; npcCubesCount = 0; setBaseVoxel(1, 1, 0, 1); setBaseVoxel(BASE_DIM - 2, 1, 0, 1); setBaseVoxel(1, BASE_DIM - 2, 0, 2); setBaseVoxel(BASE_DIM - 2, BASE_DIM - 2, 0, 3); } int getBaseVoxel(int x, int y, int z) { return (x < 0 || x >= BASE_DIM || y < 0 || y >= BASE_DIM || z < 0 || z >= BASE_HEIGHT) ? -1 : baseVoxels[x + y * BASE_DIM + z * BASE_DIM * BASE_DIM]; } void setBaseVoxel(int x, int y, int z, int val) { if (x >= 0 && x < BASE_DIM && y >= 0 && y < BASE_DIM && z >= 0 && z < BASE_HEIGHT) baseVoxels[x + y * BASE_DIM + z * BASE_DIM * BASE_DIM] = val; } void checkBaseVoxelMilestones() { while (totalErzBuilt >= (erzCubesCount + 1) * 110) { erzCubesCount++; growVoxelCubeInBase(1); } while (totalFPBuilt >= (fpCubesCount + 1) * 110) { fpCubesCount++; growVoxelCubeInBase(2); } } void growVoxelCubeInBase(int cubeType) { for (int z = 0; z < BASE_HEIGHT; z++) for (int r = 2; r <= 5; r++) for (int y = 7 - r; y <= 7 + r; y++) for (int x = 7 - r; x <= 7 + r; x++) { if (x <= 0 || x >= BASE_DIM - 1 || y <= 0 || y >= BASE_DIM - 1) continue; if (z == 0 && (x == 7 || y == 7 || (abs(x - 7) <= 1 && abs(y - 7) <= 1))) continue; if (getBaseVoxel(x, y, z) == 0 && (z == 0 || getBaseVoxel(x, y, z - 1) > 0)) { setBaseVoxel(x, y, z, cubeType); return; } } } void addResearchFP(int amount) { researchFP += amount; totalFPBuilt += amount; checkBaseVoxelMilestones(); } void addRefinedErz(int amount) { refinedErz += amount; totalErzBuilt += amount; checkBaseVoxelMilestones(); } void spawnFloatingTag(float wx, float wy, String txt, int col) { floatingTags.add(new FloatingTag(wx, wy, txt, col)); } // KAPITEL 1.2: ZEC & EVM COUNTER-STATE (-E -> Kosmischer Void-Riss) class EvmCounterState { float ox, oy, x, y, vx, vy, energyMeV; int life, maxLife; SingularityRift targetVoid; EvmCounterState(float sx, float sy, float eVal) { ox = sx; oy = sy; x = sx; y = sy; energyMeV = -abs(eVal); maxLife = 155; life = maxLife; targetVoid = null; float bestD = 99999.0; for (int i = 0; i < spaceRifts.size(); i++) { SingularityRift r = (SingularityRift) spaceRifts.get(i); float d = dist(sx, sy, r.x, r.y); if (d < bestD) { bestD = d; targetVoid = r; } } float ang = (targetVoid != null) ? atan2(targetVoid.y - sy, targetVoid.x - sx) : random(TWO_PI); vx = cos(ang) * 2.4; vy = sin(ang) * 2.4; } } void spawnEvmCounterState(float wx, float wy, float eVal) { if (evmCounterStates.size() < 36) evmCounterStates.add(new EvmCounterState(wx, wy, eVal)); } String getMarsSquareName(int idx) { String[] de = { "1. DTIM-Energie-Kern", "2. Zeno-Schutzschild", "3. Meteor-Abwehrturm", "4. Dipol-Atmosphäre", "5. Wärme & Wasser", "6. Enthalpie-Flora", "7. Döner & Ayran ISRU", "8. Norn-Habitate", "9. Fraktal-Helfer-Dock" }; String[] en = { "1. DTIM Energy Core", "2. Zeno Shield", "3. Meteor Defense", "4. Dipole Atmosphere", "5. Thermal & Water", "6. Enthalpy Flora", "7. Doner & Ayran ISRU", "8. Norn Habitats", "9. Fractal Dock" }; return tr(de[idx], en[idx]); } String getMarsSquareReqLabel(int idx) { int gA = marsReqGoodA[idx], gB = marsReqGoodB[idx]; String shortA = (gA == 0) ? "CNT-Aerogel" : ((gA == 1) ? "Bariumtitanat" : ((gA == 2) ? "Zeno-Stasis" : "Plasma-Döner")); if (gB >= 0) return shortA + " + " + ((gB == 0) ? "CNT-Aerogel" : "Bariumtitanat"); return "1x " + shortA + " + 10 " + tr("Erz", "Ore"); } boolean canDeliverToMarsSquare(int idx) { if (marsPadProg[idx] >= 100.0) return false; if (devModeActive) return true; int gA = marsReqGoodA[idx], gB = marsReqGoodB[idx]; return (gB >= 0) ? (cargoQty[gA] >= 1 && cargoQty[gB] >= 1) : (cargoQty[gA] >= 1 && refinedErz >= 10); } void deliverProductsToMarsSquare(int idx, String builderName, float bonusPct) { if (marsPadProg[idx] >= 100.0) return; float prev = marsPadProg[idx]; marsPadProg[idx] = min(100.0, marsPadProg[idx] + bonusPct); if (idx == 1 && marsPadProg[1] >= 25.0) marsShieldOn = true; if (idx == 2 && marsPadProg[2] >= 10.0) marsDefenseOn = true; if (idx == 7) { int tp = int((marsPadProg[7] / 100.0) * 60.0); if (marsSettlers < tp) marsSettlers = tp; } spawnFloatingTag(getMarsPadCenterX(idx), getMarsPadCenterY(idx) - 20, builderName + ": +" + int(bonusPct) + "%", color(80, 245, 175)); if (prev < 100.0 && marsPadProg[idx] >= 100.0) pushBanner(tr(getMarsSquareName(idx) + " zu 100% fertig!", getMarsSquareName(idx) + " completed!"), tr("Mars: " + getMarsOverallProgress() + "%", "Mars: " + getMarsOverallProgress() + "%")); checkMarsHomeworldCompletion(); } void checkMarsHomeworldCompletion() { if (marsHomeworldUnlocked) return; for (int i = 0; i < 9; i++) if (marsPadProg[i] < 100.0) return; marsHomeworldUnlocked = true; showHomeworldBanner = true; marsSettlers = 60; marsStaySquare = -1; marsStayFrames = 0; pushBanner(tr("DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!"), tr("0-Klick Heimatwelt-Farm aktiv!", "0-Click Homeworld Farm active!")); } void updateMarsBaseWorldLogic() { if (marsBuildCooldown > 0) marsBuildCooldown--; if (marsLaserTimer > 0) marsLaserTimer--; if (!marsHomeworldUnlocked) { marsEventTimer -= 1.0; if (marsEventTimer <= 0.0) { marsEventTimer = 720.0; if (!marsMeteorOn && random(1.0) < 0.75) { marsMeteorOn = true; marsMetX = MARS_BASE_X + random(-260, 260); marsMetY = MARS_BASE_Y - 330.0; marsMetVX = (MARS_BASE_X - marsMetX) * 0.0008; marsMetVY = 0.30; marsMetHP = 100.0; } else { marsFlareOn = true; marsFlareTime = 240; } } if (marsFlareOn) { marsFlareTime--; if (marsFlareTime <= 0) marsFlareOn = false; } if (marsMeteorOn) { marsMetX += marsMetVX; marsMetY += marsMetVY; if (marsDefenseOn && frameCount % 14 == 0) { marsMetHP -= (28.0 + (marsPadProg[2] / 100.0) * 24.0); marsLaserTimer = 10; shockRings.add(new ShockRing(marsMetX, marsMetY, color(56, 189, 248))); } if (marsMetHP <= 0.0) { marsMeteorOn = false; addRefinedErz(15); if (marsPadProg[4] < 100.0) { marsPadProg[4] = min(100.0, marsPadProg[4] + 5.0); checkMarsHomeworldCompletion(); } spawnFloatingTag(marsMetX, marsMetY, tr("+15 Erz & +5% Wasser!", "+15 Ore & +5% Water!"), color(56, 189, 248)); } else if (marsMetY > MARS_BASE_Y + 250.0) marsMeteorOn = false; } } int hoveredPad = -1; float margin = 12.0; for (int i = 0; i < 9; i++) { float qx = getMarsPadLeftX(i) + margin, qy = getMarsPadTopY(i) + margin; if (shipX >= qx && shipX <= qx + MARS_PAD_W - margin * 2.0 && shipY >= qy && shipY <= qy + MARS_PAD_H - margin * 2.0) { hoveredPad = i; break; } } if (hoveredPad == -1 || marsHomeworldUnlocked || marsPadProg[hoveredPad] >= 100.0 || !canDeliverToMarsSquare(hoveredPad)) { if (hoveredPad != -1 && !marsHomeworldUnlocked && marsPadProg[hoveredPad] < 100.0 && !canDeliverToMarsSquare(hoveredPad) && frameCount % 50 == 0) { pushBanner(tr("Benötigt für " + getMarsSquareName(hoveredPad) + ": " + getMarsSquareReqLabel(hoveredPad), "Required for " + getMarsSquareName(hoveredPad) + ": " + getMarsSquareReqLabel(hoveredPad)), tr("Stelle die Ware unter [G] Handel her oder kaufe sie an einer Station!", "Synthesize the good in [G] Trade or buy it at a station!")); } marsStaySquare = -1; marsStayFrames = 0; if (hoveredPad != -1 && marsHomeworldUnlocked) runHomeworldSquareStep(hoveredPad); return; } if (hoveredPad == marsStaySquare) { if (marsBuildCooldown <= 0) marsStayFrames = min(26, marsStayFrames + 1); } else { marsStaySquare = hoveredPad; marsStayFrames = 1; } if (marsStayFrames >= 26 && marsBuildCooldown <= 0) { marsStayFrames = 0; marsBuildCooldown = 45; if (!devModeActive) { int gA = marsReqGoodA[hoveredPad], gB = marsReqGoodB[hoveredPad]; cargoQty[gA]--; if (gB >= 0) cargoQty[gB]--; else refinedErz -= 10; } deliverProductsToMarsSquare(hoveredPad, tr("NORN", "NORN"), 25.0); } } void runHomeworldSquareStep(int idx) { if (idx == 0) { if (hwKornGrow == 0 && hwKorn >= 1) { hwKorn--; hwKornGrow = 1.0; } else if (hwKornGrow > 0 && hwWasser >= 1) { hwKornGrow += 1.6; if (hwKornGrow >= 100.0) { hwKornGrow = 0.0; hwWasser--; hwKorn += 4; hwHeu += 4; } } } else if (idx == 1) { if (hwTomGrow == 0 && hwTom >= 1) { hwTom--; hwTomGrow = 1.0; } else if (hwTomGrow > 0 && hwWasser >= 1) { hwTomGrow += 1.6; if (hwTomGrow >= 100.0) { hwTomGrow = 0.0; hwWasser--; hwTom += 4; hwHeu += 2; } } } else if (idx == 2 && frameCount % 18 == 0 && hwWasser < 15) hwWasser++; else if (idx == 3) { if (!hwStallBuilt && (devModeActive || creditsEUR >= 15)) { if (!devModeActive) creditsEUR -= 15; hwStallBuilt = true; } else if (hwStallBuilt && hwKorn >= 2 && hwHeu >= 4) { hwStallWork += 1.8; if (hwStallWork >= 100.0) { hwStallWork = 0.0; hwKorn -= 2; hwHeu -= 4; hwMilch += 4; } } } else if (idx == 4) { if (!hwKaeseBuilt && (devModeActive || creditsEUR >= 30)) { if (!devModeActive) creditsEUR -= 30; hwKaeseBuilt = true; } else if (hwKaeseBuilt && hwMilch >= 4) { hwKaeseWork += 1.8; if (hwKaeseWork >= 100.0) { hwKaeseWork = 0.0; hwMilch -= 4; hwKaese += 2; } } } else if (idx == 5) { if (!hwMuehleBuilt && (devModeActive || creditsEUR >= 25)) { if (!devModeActive) creditsEUR -= 25; hwMuehleBuilt = true; } else if (hwMuehleBuilt && hwKorn >= 4) { hwMuehleWork += 1.8; if (hwMuehleWork >= 100.0) { hwMuehleWork = 0.0; hwKorn -= 4; hwMehl += 3; } } } else if (idx == 6 && hwMehl >= 1 && hwKaese >= 1 && hwTom >= 1) { hwPizzaWork += 2.2; if (hwPizzaWork >= 100.0) { hwPizzaWork = 0.0; hwMehl--; hwKaese--; hwTom--; hwPizza++; if (getCargoUsed() < cargoCap) cargoQty[3]++; } } else if (idx == 7 || idx == 8) { int earned = hwPizza * 32 + hwKaese * 14 + hwMehl * 6 + hwMilch * 5; if (earned > 0) { hwPizza = 0; hwKaese = 0; hwMehl = 0; hwMilch = 0; creditsEUR += earned; spawnFloatingTag(shipX, shipY - 24, "+" + earned + " EUR", color(80, 245, 175)); } } } // AUTONOME STATIONSKASSE & WÜRFEL-WIRTSCHAFT class SpaceStation { int id; float x, y; String nameDe, nameEn; int specialty; float priceBonus; int accentCol; float treasuryEUR; int stationCubes; SpaceStation(int sid, float sx, float sy, String nDe, String nEn, int spec, float bonus, int col) { id = sid; x = sx; y = sy; nameDe = nDe; nameEn = nEn; specialty = spec; priceBonus = bonus; accentCol = col; treasuryEUR = 25.0 + sid * 10.0; stationCubes = 0; } // Jeder Würfel erhöht den Stations-Unterhalt -> Station macht pro Handel weniger Netto-Gewinn float getProfitRetentionFactor() { return 1.0 / (1.0 + 0.28 * stationCubes); } // Kosten für den nächsten Stations-Würfel steigen moderat float getNextCubeCost() { return 85.0 + stationCubes * 40.0; } void addTradeRevenue(float grossRevenue, String sourceTag) { float netGain = grossRevenue * getProfitRetentionFactor(); treasuryEUR += netGain; while (treasuryEUR >= getNextCubeCost()) { treasuryEUR -= getNextCubeCost(); stationCubes++; tradeCubesCount++; growVoxelCubeInBase(3); spawnFloatingTag(x, y - 95, tr("STATION BAUT WÜRFEL #", "STATION BUILT CUBE #") + stationCubes, color(255, 225, 55)); pushBanner(tr(nameDe + " hat aus Handelsgewinnen Würfel #" + stationCubes + " finanziert!", nameEn + " financed Cube #" + stationCubes + " from trade profits!"), tr("Bonus: +" + ((specialty == 1) ? "FP" : "Erz") + "/Zyklus · Netto-Marge jetzt " + int(getProfitRetentionFactor() * 100) + "%", "Bonus: +" + ((specialty == 1) ? "RP" : "Ore") + "/cycle · Net margin now " + int(getProfitRetentionFactor() * 100) + "%")); } } } // Kontinuierlicher Bonus-Ertrag aller Stations-Würfel (Erz & Forschung) void updateAutonomousStationCubeYields() { stationYieldTimer++; if (stationYieldTimer < 150) return; stationYieldTimer = 0; int bonusErz = 0, bonusFp = 0; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (st.stationCubes <= 0) continue; if (st.specialty == 0) bonusErz += st.stationCubes * 2; else if (st.specialty == 1) bonusFp += st.stationCubes * 2; else { bonusErz += st.stationCubes; bonusFp += st.stationCubes; } } if (bonusErz > 0) addRefinedErz(bonusErz); if (bonusFp > 0) addResearchFP(bonusFp); } void draw() { background(getUiPalette(a11yMode, 0)); simTime += 0.025; // 4-Sekunden 'C'-Taste halten für Development Modus (240 Frames @ 60 FPS) if (keyCHeld && !devModeActive) { devHoldFrames++; if (devHoldFrames >= 240) { devModeActive = true; devPopupTimer = 260; spawnFloatingTag(shipX, shipY - 35, "Development modus Aktiv", color(0, 255, 180)); pushBanner("Development modus Aktiv!", tr("Alle Einkäufe, Synthesen, Techs & Atom-Bauten sind jetzt kostenlos.", "All purchases, syntheses, techs & atom builds are now free.")); } } else if (!keyCHeld && !devModeActive) { devHoldFrames = max(0, devHoldFrames - 2); } if (devPopupTimer > 0) devPopupTimer--; if (!languageChosen) { drawLanguageSelectionGate(); drawDevModeOverlay(); return; } if (lobbyOnline) { lobbySyncTimer++; if (lobbySyncTimer >= 180) { lobbySyncTimer = 0; syncNornLobby(); } } if (tLevel[9] > 0) { nornAtpPulse += 0.12 * tLevel[9]; if (nornAtpPulse >= 100.0) { nornAtpPulse = 0.0; addResearchFP(2 * tLevel[9]); } } updateAutonomousStationCubeYields(); if (viewMode == 0) drawFlightMode(); else if (viewMode == 1) drawTechTreeMode(); else if (viewMode == 2) drawIsometricBaseMode(); else if (viewMode == 3) drawWalk3DBaseMode(); else if (viewMode == 4) drawEliteTradeMode(); else if (viewMode == 5) drawMarsBaseDetailMode(); else if (viewMode == 6) drawAtomConstructorBaseMode(); drawGlobalTopBar(); if (showHomeworldBanner) drawHomeworldVictoryOverlay(); drawDevModeOverlay(); } void drawDevModeOverlay() { // Fortschrittsbalken während die Taste C gehalten wird if (keyCHeld && !devModeActive && devHoldFrames > 5) { int bw = 320, bh = 38, bx = int(width * 0.5 - bw * 0.5), by = 52; fill(10, 14, 24, 240); stroke(255, 225, 45); strokeWeight(2.0); rect(bx, by, bw, bh, 7); strokeWeight(1.0); fill(0, 210, 140); noStroke(); rect(bx + 4, by + 4, map(devHoldFrames, 0, 240, 0, bw - 8), bh - 8, 5); fill(255); textSize(12); textAlign(CENTER, CENTER); text(tr("Halte [C] für Development Modus... ", "Hold [C] for Development Mode... ") + nf((240 - devHoldFrames) / 60.0, 1, 1) + "s", bx + bw * 0.5, by + bh * 0.5); } // Popup "Development modus Aktiv" if (devPopupTimer > 0) { int pw = 460, ph = 135, px = int(width * 0.5 - pw * 0.5), py = int(height * 0.5 - ph * 0.5); fill(8, 14, 26, 248); stroke(0, 255, 180); strokeWeight(3.0); rect(px, py, pw, ph, 10); strokeWeight(1.0); fill(0, 145, 90); noStroke(); rect(px + 2, py + 2, pw - 4, 42, 8); fill(255); textSize(18); textAlign(CENTER, CENTER); text("Development modus Aktiv", px + pw * 0.5, py + 23); fill(235, 245, 255); textSize(13); text(tr("Alle Einkäufe, Tech-Stufen, Mars-Lieferungen\nund der Atom-Konstruktor sind ab sofort kostenlos!", "All purchases, tech tiers, Mars deliveries\nand the Atom Constructor are now completely free!"), px + pw * 0.5, py + 84); } } void drawLanguageSelectionGate() { drawSpacetimeHexGrid(); fill(4, 5, 12, 224); noStroke(); rect(0, 0, width, height); int mx = 200, my = 110, mw = width - 400, mh = 510; fill(getUiPalette(a11yMode, 1)); stroke(getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.8 : 2.0); rect(mx, my, mw, mh, 10); strokeWeight(1.0); fill(getUiPalette(a11yMode, 2)); noStroke(); rect(mx + 1, my + 1, mw - 2, 48, 9); fill(255); textSize(17); textAlign(CENTER, CENTER); text("DTIM-ZEC NORN ATOM-STARSHIP V2 · SPRACHE / LANGUAGE", width * 0.5, my + 25); fill(255); textSize(13); textAlign(LEFT, TOP); text("DEUTSCH:\nSteuere das Norn-Raumschiff durch das 7200x7200 Gitter, baue eigene Atome & Moleküle im [N] Atom-Konstruktor (mit Bethe-Weizsäcker-Dividende), beobachte echte DAMTP-Quanteneffekte (ZEC -E Counter-States, Zeno-Lock, Tensile Stress) und finanziere über Stationskassen autonome Würfel!\n\nENGLISH:\nPilot the Norn starship across the 7200x7200 lattice, assemble custom atoms & molecules in the [N] Atom Constructor, observe DAMTP quantum effects, and fund autonomous station cubes through trade!", mx + 30, my + 68, mw - 60, 270); drawBigGateBtn(mx + 35, my + 350, 305, 62, "DEUTSCH STARTEN ▶", getUiPalette(a11yMode, 2)); drawBigGateBtn(mx + 380, my + 350, 305, 62, "START IN ENGLISH ▶", getUiPalette(a11yMode, 3)); drawNavBtn(mx + 35, my + 430, 305, 38, "Spielstand laden / Load Save [O]", a11yMode ? color(0, 95, 55) : color(20, 115, 70), false); drawNavBtn(mx + 380, my + 430, 305, 38, getA11yToggleLabel() + " [H]", a11yMode ? color(0, 82, 155) : color(28, 35, 52), a11yMode); } void drawBigGateBtn(int bx, int by, int bw, int bh, String lbl, int bg) { fill(bg); stroke(a11yMode ? color(255, 225, 45) : color(220, 232, 250)); strokeWeight(a11yMode ? 2.6 : 1.8); rect(bx, by, bw, bh, 7); strokeWeight(1.0); fill(255); textSize(16); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } void drawGlobalTopBar() { fill(getUiPalette(a11yMode, 1)); noStroke(); rect(0, 0, width, 38); stroke(getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.0 : 1.0); line(0, 38, width, 38); strokeWeight(1.0); int inactiveBg = a11yMode ? color(16, 22, 36) : color(22, 28, 42); drawNavBtn(6, 5, 78, 28, tr("[1] Kosmos", "[1] Cosmos"), viewMode == 0 ? getUiPalette(a11yMode, 2) : inactiveBg, viewMode == 0); String marsTabLbl = marsHomeworldUnlocked ? tr("[R] Heimat", "[R] Home") : tr("[R] Mars " + getMarsOverallProgress() + "%", "[R] Mars " + getMarsOverallProgress() + "%"); drawNavBtn(88, 5, 96, 28, marsTabLbl, (viewMode == 5) ? getUiPalette(a11yMode, 2) : (marsHomeworldUnlocked ? color(16, 105, 62) : inactiveBg), viewMode == 5); drawNavBtn(188, 5, 94, 28, tr("[N] Atom-Bau", "[N] Atom Lab"), viewMode == 6 ? getUiPalette(a11yMode, 2) : color(18, 68, 95), viewMode == 6); drawNavBtn(286, 5, 82, 28, "[T] Tech", viewMode == 1 ? getUiPalette(a11yMode, 2) : inactiveBg, viewMode == 1); drawNavBtn(372, 5, 84, 28, tr("[G] Handel", "[G] Trade"), viewMode == 4 ? getUiPalette(a11yMode, 2) : inactiveBg, viewMode == 4); int totalCubes = erzCubesCount + fpCubesCount + tradeCubesCount + npcCubesCount; drawNavBtn(460, 5, 92, 28, tr("[B] Basis(" + totalCubes + ")", "[B] Base(" + totalCubes + ")"), viewMode == 2 ? getUiPalette(a11yMode, 2) : inactiveBg, viewMode == 2); drawNavBtn(556, 5, 74, 28, "[V] 3D", viewMode == 3 ? getUiPalette(a11yMode, 2) : inactiveBg, viewMode == 3); drawNavBtn(634, 5, 64, 28, tr("Speich.", "Save"), a11yMode ? color(0, 95, 55) : color(20, 125, 75), false); drawNavBtn(702, 5, 58, 28, tr("Laden", "Load"), getUiPalette(a11yMode, 3), false); fill(devModeActive ? color(0, 255, 180) : color(255)); textSize(11); textAlign(LEFT, CENTER); String devTag = devModeActive ? " [DEV]" : ""; text("E:" + refinedErz + " FP:" + researchFP + " " + creditsEUR + "€" + devTag, 765, 19); drawNavBtn(912, 5, 48, 28, langMode == 0 ? "DE[L]" : "EN[L]", inactiveBg, false); drawNavBtn(964, 5, 150, 28, getA11yToggleLabel() + " [H]", a11yMode ? getUiPalette(a11yMode, 2) : getUiPalette(a11yMode, 3), a11yMode); } void drawNavBtn(int bx, int by, int bw, int bh, String lbl, int bg, boolean activeState) { fill(bg); if (a11yMode) { stroke(activeState ? color(255, 235, 55) : color(210, 225, 245)); strokeWeight(activeState ? 2.4 : 1.6); } else { stroke(activeState ? color(255) : color(125, 160, 220)); strokeWeight(activeState ? 1.6 : 1.0); } rect(bx, by, bw, bh, 5); strokeWeight(1.0); fill(255); textSize(11); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } void drawFlightMode() { float speedMult = 1.0 + tLevel[0] * 0.15 + tLevel[1] * 0.25 + tLevel[2] * 0.35; updateShipKinematics(speedMult); updateAutoAimTarget(); updateTargetReservations(); updateFractalDrones(); updateNpcFleet(); updateAtomsAndSpaceEntities(); updateMarsBaseWorldLogic(); processZeroClickBases(); if (zeroClick) { if (autoFireTimer > 0) autoFireTimer--; if (lockedAtom != null && autoFireTimer <= 0) { fireActiveWeapon(); autoFireTimer = 20; } } camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); pushMatrix(); translate(width * 0.5 - camX, (height - 130) * 0.5 - camY); drawSpacetimeHexGrid(); drawSpaceBounds(); drawLargeMarsBaseInWorld(); drawSpaceStations(); drawCovalentBonds(); drawSpaceEntities(); drawEvmCounterStates(); drawFractalDrones(); drawNpcFleet(); drawRemotePeerShips(); drawAimBeam(); drawFloatingTags(); pushMatrix(); translate(shipX, shipY); rotate(shipAngle); drawNornStarship(); popMatrix(); popMatrix(); drawStationCompassMarkers(); drawFlightHUD(); } // KAPITEL 2.2: GRAPH LAPLACIAN FIELD EQUATION L_Gamma * Psi_ij = (8*pi*G/c^4)*I_ij // Das Sechseck-Raumgitter krümmt sich sichtbar um das Schiff UND um schwere Atomkerne void drawSpacetimeHexGrid() { int step = 46, startX = floor((camX - width * 0.6) / step) * step, endX = ceil((camX + width * 0.6) / step) * step; int startY = floor((camY - height * 0.6) / step) * step, endY = ceil((camY + height * 0.6) / step) * step; for (int gx = startX; gx <= endX; gx += step) for (int gy = startY; gy <= endY; gy += step) { float dx = shipX - gx, dy = shipY - gy, d = max(0.1, sqrt(dx * dx + dy * dy)); float comp = (d < 180.0) ? map(d, 0, 180, 16.0, 0.0) : 0.0; float px = gx + (dx / d) * comp, py = gy + (dy / d) * comp; for (int k = 0; k < spaceAtoms.size(); k++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(k); if (abs(a.x - gx) > 150 || abs(a.y - gy) > 150) continue; float adx = a.x - px, ady = a.y - py, ad = max(4.0, sqrt(adx * adx + ady * ady)); if (ad < 135.0) { float pull = min(14.0, ((a.protons + a.neutrons) * 1.1) * (1.0 - ad / 135.0)); px += (adx / ad) * pull; py += (ady / ad) * pull; } } if (a11yMode) stroke(100, 150, 225, constrain(map(d, 0, 460, 75, 22), 18, 85)); else stroke(45, 85, 195, constrain(map(d, 0, 460, 48, 12), 10, 65)); noFill(); beginShape(); for (int i = 0; i < 6; i++) { float a = (PI / 3.0) * i + simTime * 0.02; vertex(px + cos(a) * 23.0, py + sin(a) * 23.0); } endShape(CLOSE); } } void drawSpaceBounds() { stroke(a11yMode ? color(255, 225, 45) : color(225, 55, 85, 130)); strokeWeight(a11yMode ? 3.0 : 2.0); noFill(); rect(-HALF_WORLD, -HALF_WORLD, WORLD_SIZE, WORLD_SIZE); stroke(59, 110, 194, 55); line(-HALF_WORLD, 0, HALF_WORLD, 0); line(0, -HALF_WORLD, 0, HALF_WORLD); strokeWeight(1.0); } void drawLargeMarsBaseInWorld() { if (abs(MARS_BASE_X - camX) > width * 0.95 && abs(MARS_BASE_Y - camY) > height * 0.95) return; pushMatrix(); translate(MARS_BASE_X, MARS_BASE_Y); rectMode(CORNER); int overall = getMarsOverallProgress(); if (a11yMode) { fill(10, 14, 24, 245); stroke(marsHomeworldUnlocked ? color(0, 235, 175) : color(255, 225, 45)); strokeWeight(3.2); } else { fill(lerpColor(color(68, 22, 18, 232), color(16, 48, 36, 236), map(overall, 0, 100, 0.0, 1.0))); stroke(marsHomeworldUnlocked ? color(80, 245, 175) : color(225, 85, 65)); strokeWeight(2.5); } rect(-350, -252, 700, 504, 14); strokeWeight(1.0); if (marsShieldOn) { noFill(); stroke(a11yMode ? color(86, 195, 255) : color(56, 189, 248, 120 + sin(simTime * 3.0) * 35)); strokeWeight(2.2); ellipse(0, 0, 750, 550); strokeWeight(1.0); } fill(255); textSize(13); textAlign(CENTER, TOP); text(marsHomeworldUnlocked ? tr("NORN HEIMATWELT (0-KLICK FARM & MANUFAKTUR) · 60 Norns", "NORN HOMEWORLD (0-CLICK FARM & MANUFACTORY) · 60 Norns") : tr("GROSSE MARS-AUFBAUBASIS (" + overall + "% · Siedler: " + marsSettlers + "/60)", "LARGE MARS CONSTRUCTION BASE (" + overall + "% · Settlers: " + marsSettlers + "/60)"), 0, -240); for (int i = 0; i < 9; i++) { float qx = getMarsPadLeftX(i) - MARS_BASE_X, qy = getMarsPadTopY(i) - MARS_BASE_Y, qw = MARS_PAD_W, qh = MARS_PAD_H; boolean shipOver = (marsStaySquare == i && !marsHomeworldUnlocked) || (marsHomeworldUnlocked && shipX >= getMarsPadLeftX(i) && shipX <= getMarsPadLeftX(i) + qw && shipY >= getMarsPadTopY(i) && shipY <= getMarsPadTopY(i) + qh); if (!marsHomeworldUnlocked) { boolean ready = canDeliverToMarsSquare(i), done = (marsPadProg[i] >= 100.0); if (a11yMode) { fill(done ? color(0, 72, 48) : (ready ? color(0, 62, 120) : color(18, 22, 34))); stroke(shipOver ? color(255) : (done ? color(0, 235, 175) : (ready ? color(255, 235, 55) : color(170, 185, 210)))); strokeWeight(shipOver ? 3.2 : (ready || done ? 2.4 : 1.5)); } else { fill(done ? color(20, 95, 60) : (ready ? color(24, 54, 112) : color(24, 20, 28))); stroke(shipOver ? color(255) : (done ? color(80, 245, 175) : (ready ? color(255, 220, 80) : color(135, 95, 95)))); strokeWeight(shipOver ? 2.5 : 1.3); } rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(11); textAlign(CENTER, TOP); text(getMarsSquareName(i), qx + qw * 0.5, qy + 8); fill(ready ? color(255, 235, 85) : color(230, 238, 250)); textSize(10); text(done ? tr("FERTIG (100%)", "COMPLETE (100%)") : getMarsSquareReqLabel(i), qx + qw * 0.5, qy + 30); fill(6, 10, 18); stroke(a11yMode ? color(255) : color(40, 50, 70)); rect(qx + 14, qy + 56, qw - 28, 12, 3); noStroke(); fill(done ? (a11yMode ? color(0, 235, 175) : color(80, 245, 175)) : (a11yMode ? color(86, 195, 255) : color(56, 189, 248))); rect(qx + 14, qy + 56, constrain(map(marsPadProg[i], 0, 100, 0, qw - 28), 0, qw - 28), 12, 3); if (marsStaySquare == i && marsStayFrames > 0 && !done && ready) { float barW = constrain(map(min(marsStayFrames, 26), 0, 26, 0, qw - 28), 0, qw - 28); fill(255, 235, 55); rect(qx + 14, qy + 98, barW, 5, 2); } String statusMark = a11yMode ? (done ? " [✓]" : (ready ? " [★]" : "")) : ""; fill(255); textSize(11); text(int(marsPadProg[i]) + "%" + statusMark, qx + qw * 0.5, qy + 76); } else { String[] fDe = { "Korn-Feld (" + int(hwKornGrow) + "%)", "Tomaten-Feld (" + int(hwTomGrow) + "%)", "Brunnen (" + hwWasser + ")", hwStallBuilt ? "Kuhstall (" + int(hwStallWork) + "%)" : "Kuhstall (15€)", hwKaeseBuilt ? "Käserei (" + int(hwKaeseWork) + "%)" : "Käserei (30€)", hwMuehleBuilt ? "Mühle (" + int(hwMuehleWork) + "%)" : "Mühle (25€)", "Pizza-Ofen (" + int(hwPizzaWork) + "%)", "Heimat-Markt", "Norn-Dorf (60)" }; String[] fEn = { "Grain Field (" + int(hwKornGrow) + "%)", "Tomato Field (" + int(hwTomGrow) + "%)", "Well (" + hwWasser + ")", hwStallBuilt ? "Barn (" + int(hwStallWork) + "%)" : "Barn (15€)", hwKaeseBuilt ? "Creamery (" + int(hwKaeseWork) + "%)" : "Creamery (30€)", hwMuehleBuilt ? "Mill (" + int(hwMuehleWork) + "%)" : "Mill (25€)", "Pizza Oven (" + int(hwPizzaWork) + "%)", "Home Market", "Norn Village (60)" }; fill(shipOver ? color(0, 95, 58) : color(14, 72, 48)); stroke(shipOver ? color(255, 235, 55) : color(0, 235, 175)); strokeWeight(a11yMode ? 2.2 : 1.2); rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(12); textAlign(CENTER, CENTER); text(tr(fDe[i], fEn[i]), qx + qw * 0.5, qy + qh * 0.5); } } if (marsMeteorOn) { float tx = getMarsPadCenterX(2) - MARS_BASE_X, ty = getMarsPadCenterY(2) - MARS_BASE_Y; float mx = marsMetX - MARS_BASE_X, my = marsMetY - MARS_BASE_Y; if (marsLaserTimer > 0) { stroke(86, 195, 255); strokeWeight(3.2); line(tx, ty, mx, my); stroke(255); strokeWeight(1.2); line(tx, ty, mx, my); strokeWeight(1.0); } fill(145, 65, 35); stroke(255, 225, 55); strokeWeight(2.4); ellipse(mx, my, 40, 40); strokeWeight(1.0); fill(255); textSize(10); textAlign(CENTER, CENTER); text(int(max(0, marsMetHP)) + "%", mx, my); } popMatrix(); } void drawSpaceStations() { for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (abs(st.x - camX) > width * 0.75 || abs(st.y - camY) > height * 0.75) continue; pushMatrix(); translate(st.x, st.y); rectMode(CORNER); fill(a11yMode ? color(10, 14, 24, 245) : color(14, 18, 28, 228)); stroke(a11yMode ? color(255, 225, 45) : st.accentCol); strokeWeight(a11yMode ? 2.8 : 2.0); rect(-180, -135, 360, 265, 10); strokeWeight(1.0); fill(255); textSize(12); textAlign(CENTER, TOP); text(tr(st.nameDe, st.nameEn), 0, -126); fill(255, 225, 55); textSize(10); String yieldType = (st.specialty == 0) ? tr("Erz", "Ore") : ((st.specialty == 1) ? "FP" : tr("Erz+FP", "Ore+RP")); text(tr("Stationskasse: ", "Station Treasury: ") + int(st.treasuryEUR) + "/" + int(st.getNextCubeCost()) + " EUR · " + tr("Würfel: ", "Cubes: ") + st.stationCubes + " (+" + yieldType + ") · " + tr("Netto-Marge: ", "Net Margin: ") + int(st.getProfitRetentionFactor() * 100) + "%", 0, -108); int c1 = a11yMode ? color(145, 45, 20) : color(122, 16, 38); int c2 = a11yMode ? color(140, 88, 0) : color(145, 100, 18); int c3 = a11yMode ? color(0, 92, 55) : color(20, 105, 65); int c4 = a11yMode ? color(0, 72, 145) : color(18, 46, 98); if (st.specialty == 0) { drawBasePad(-160, -84, 150, 78, c1, tr("1. Erz-Schmelze", "1. Ore Smelter"), tr("Roh-Erz -> Bau-Erz", "Raw Ore -> Refined Ore")); drawBasePad(10, -84, 150, 78, c2, tr("2. Kassen-Markt", "2. Treasury Market"), tr("Verkauf x" + nf(st.priceBonus, 1, 2) + " -> Kasse", "Sell x" + nf(st.priceBonus, 1, 2) + " -> Treasury")); drawBasePad(-160, 12, 320, 96, c3, tr("3. Atom-Bau-Labor [N] & Handel [G]", "3. Atom Constructor [N] & Trade [G]"), tr("Repariert Hülle · [N] Eigene Atome & Moleküle bauen!", "Repairs hull · [N] Build custom atoms & molecules!")); } else if (st.specialty == 1) { drawBasePad(-160, -84, 150, 78, c4, tr("1. Quanten-Labor", "1. Quantum Lab"), tr("Quanta -> Forschung", "Quanta -> Research")); drawBasePad(10, -84, 150, 78, c1, tr("2. Plasma-Synthese", "2. Plasma Synthesis"), tr("Waste -> Erz + FP", "Waste -> Ore + RP")); drawBasePad(-160, 12, 320, 96, c4, tr("3. DAMTP Atom-Konstruktor [N]", "3. DAMTP Atom Constructor [N]"), tr("ATP-Boost · [N] Atom-Bau | [G] Handel | [R] Mars", "ATP Boost · [N] Atom Lab | [G] Trade | [R] Mars")); } else { drawBasePad(-160, -84, 150, 78, c1, tr("1. Konverter", "1. Converter"), tr("Erz & Quanta", "Ore & Quanta")); drawBasePad(10, -84, 150, 78, c2, tr("2. Freihafen-Kasse", "2. Freeport Treasury"), tr("Verkauf x" + nf(st.priceBonus, 1, 2) + " -> Würfel", "Sell x" + nf(st.priceBonus, 1, 2) + " -> Cubes")); drawBasePad(-160, 12, 320, 96, c3, tr("3. Atom-Werkstatt [N] & Kreuz [G]", "3. Atom Workshop [N] & Trade [G]"), tr("Repariert Hülle · [N] Atome bauen | [G] Mars-Waren", "Repairs hull · [N] Build atoms | [G] Mars goods")); } popMatrix(); } } void drawBasePad(float px, float py, float pw, float ph, int col, String title, String desc) { fill(col); stroke(a11yMode ? color(255, 235, 55) : color(220, 232, 250)); strokeWeight(a11yMode ? 1.8 : 1.0); rect(px, py, pw, ph, 6); strokeWeight(1.0); fill(255); textSize(12); textAlign(CENTER, TOP); text(title, px + pw * 0.5, py + 12); fill(245, 248, 255); textSize(10); text(desc, px + pw * 0.5, py + 42); } void drawStationCompassMarkers() { float viewH = height - 130; String[] shortNames = { "Alpha", "Beta", "Gamma", "Delta", "Epsilon" }; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); float sx = width * 0.5 + (st.x - camX), sy = viewH * 0.5 + (st.y - camY); if (sx >= 30 && sx <= width - 30 && sy >= 46 && sy <= viewH - 20) continue; float cx = constrain(sx, 58, width - 58), cy = constrain(sy, 56, viewH - 22); fill(8, 10, 18, 240); stroke(a11yMode ? color(255, 225, 45) : st.accentCol); strokeWeight(a11yMode ? 2.0 : 1.0); rect(cx - 52, cy - 13, 104, 26, 4); strokeWeight(1.0); fill(255); textSize(10); textAlign(CENTER, CENTER); text(shortNames[i] + "[" + st.stationCubes + "] " + int(dist(shipX, shipY, st.x, st.y) / 10.0) + "m", cx, cy); } float msx = width * 0.5 + (MARS_BASE_X - camX), msy = viewH * 0.5 + (MARS_BASE_Y - camY); if (msx < 30 || msx > width - 30 || msy < 46 || msy > viewH - 20) { float cx = constrain(msx, 62, width - 62), cy = constrain(msy, 56, viewH - 22); fill(14, 16, 26, 245); stroke(marsHomeworldUnlocked ? color(0, 235, 175) : color(255, 225, 45)); strokeWeight(a11yMode ? 2.2 : 1.2); rect(cx - 56, cy - 14, 112, 28, 4); strokeWeight(1.0); fill(255); textSize(10); textAlign(CENTER, CENTER); text("MARS (" + getMarsOverallProgress() + "%) " + int(dist(shipX, shipY, MARS_BASE_X, MARS_BASE_Y) / 10.0) + "m", cx, cy); } } SpaceStation getActiveOrNearestStation() { if (dockedStationIdx >= 0 && dockedStationIdx < spaceStations.size()) return (SpaceStation) spaceStations.get(dockedStationIdx); SpaceStation best = (SpaceStation) spaceStations.get(0); float bestD = 999999.0; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); float d = dist(shipX, shipY, st.x, st.y); if (d < bestD) { bestD = d; best = st; } } return best; } float getActiveStationBonus() { return (dockedStationIdx >= 0 && dockedStationIdx < spaceStations.size()) ? ((SpaceStation) spaceStations.get(dockedStationIdx)).priceBonus : 1.0; } float getTradeMultiplier() { return (1.0 + tradeCubesCount * 0.08) * getActiveStationBonus(); } int getCargoUsed() { return cargoQty[0] + cargoQty[1] + cargoQty[2] + cargoQty[3]; } void processZeroClickBases() { dockedStationIdx = -1; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); float dx = shipX - st.x, dy = shipY - st.y; if (abs(dx) < 180 && abs(dy) < 135) { dockedStationIdx = i; if (dx >= -160 && dx <= -10 && dy >= -84 && dy <= -4) { if ((st.specialty == 0 || st.specialty == 2) && rawErz > 0 && frameCount % 8 == 0) { int batch = min(5, rawErz); rawErz -= batch; addRefinedErz(batch * 2); st.addTradeRevenue(batch * 1.5, "SMELT"); } if ((st.specialty == 1 || st.specialty == 2) && rawQuanta > 0 && frameCount % 12 == 0) { rawQuanta--; addResearchFP(14 + tLevel[9] * 4); st.addTradeRevenue(6.0, "QUANTA"); } } if (dx >= 10 && dx <= 160 && dy >= -84 && dy <= -4) { if ((st.specialty == 0 || st.specialty == 2) && frameCount % 16 == 0) { int earned = 0; float mult = getTradeMultiplier(); for (int g = 0; g < 4; g++) if (cargoQty[g] > 0) { earned += int(cargoQty[g] * goodBasePrice[g] * mult); cargoQty[g] = 0; } if (refinedErz >= 30) { refinedErz -= 20; earned += int(14 * mult); } if (earned > 0) { creditsEUR += earned; st.addTradeRevenue(earned * 0.42, "PLAYER"); spawnFloatingTag(shipX, shipY - 26, "+" + earned + " EUR (+" + int(earned * 0.42 * st.getProfitRetentionFactor()) + " Kasse)", color(255, 220, 65)); } } else if (st.specialty == 1 && wasteEntropy > 0 && frameCount % 12 == 0) { wasteEntropy--; addRefinedErz(8); addResearchFP(8); st.addTradeRevenue(7.0, "PLASMA"); } } if (dx >= -160 && dx <= 160 && dy >= 12 && dy <= 108) { if (hullHP < maxHullHP && frameCount % 6 == 0) hullHP = min(maxHullHP, hullHP + 2); if (st.specialty == 1 && frameCount % 25 == 0) addResearchFP(2); } break; } } } void updateShipKinematics(float speedMult) { float maxSpd = 4.6 * speedMult; if (keyTurnL) shipAngle -= 0.055; if (keyTurnR) shipAngle += 0.055; if (drivesActive) { float mx = getNormMouseX(), my = getNormMouseY(); if (keyW || keyS) { mouseSteer = false; float thrust = keyW ? 0.26 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && my > 40 && my < height - 130) { float sx = width * 0.5 + (shipX - camX), sy = (height - 130) * 0.5 + (shipY - camY); float dx = mx - sx, dy = my - sy, d = sqrt(dx * dx + dy * dy); if (d > 18.0) { float targetA = atan2(dy, dx); shipAngle += atan2(sin(targetA - shipAngle), cos(targetA - shipAngle)) * 0.12; float throttle = constrain((d - 18.0) / 140.0, 0.0, 1.0) * 0.23; shipVX += cos(shipAngle) * throttle; shipVY += sin(shipAngle) * throttle; } } shipVX *= 0.95; shipVY *= 0.95; } else { shipVX *= 0.88; shipVY *= 0.88; if (abs(shipVX) < 0.02) shipVX = 0.0; if (abs(shipVY) < 0.02) shipVY = 0.0; } float sp = sqrt(shipVX * shipVX + shipVY * shipVY); if (sp > maxSpd) { shipVX = (shipVX / sp) * maxSpd; shipVY = (shipVY / sp) * maxSpd; } shipX = constrain(shipX + shipVX, -HALF_WORLD + 60, HALF_WORLD - 60); shipY = constrain(shipY + shipVY, -HALF_WORLD + 60, HALF_WORLD - 60); } void updateAutoAimTarget() { lockedAtom = null; float bestD = 360.0; for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (!a.destroyed) { float d = dist(shipX, shipY, a.x, a.y); if (d < bestD) { bestD = d; lockedAtom = a; } } } if (autoAim && lockedAtom != null) { aimAngle = atan2(lockedAtom.y - shipY, lockedAtom.x - shipX); float bMeV = calcBetheWeizsaecker(lockedAtom.protons, lockedAtom.neutrons); sensorInfo = lockedAtom.getSymbol() + " · E_bind: " + nf(bMeV, 1, 1) + " MeV · " + tr("Erz: ", "Ore: ") + lockedAtom.oreReserve + (lockedAtom.zenoObserved ? " [ZENO-LOCK]" : ""); } else { aimAngle = shipAngle; sensorInfo = tr("DAMTP-Sensoren aktiv · [N] Atom-Konstruktor | [G] Stationskassen | [R] Mars (" + getMarsOverallProgress() + "%)", "DAMTP Sensors active · [N] Atom Constructor | [G] Station Treasuries | [R] Mars (" + getMarsOverallProgress() + "%)"); } } void updateTargetReservations() { if (playerShotClaimTimer > 0) { playerShotClaimTimer--; if (playerShotClaimTimer <= 0) playerShotAtom = null; } for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); a.claimedBy = -1; a.claimLabel = ""; } if (autoAim && lockedAtom != null) { lockedAtom.claimedBy = 0; lockedAtom.claimLabel = "NORN"; } if (playerShotAtom != null && playerShotClaimTimer > 0) { playerShotAtom.claimedBy = 0; playerShotAtom.claimLabel = "NORN"; } for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); int myId = 1 + i; if (d.targetAtom != null) { if (d.targetAtom.destroyed || d.targetAtom.oreReserve < 6 || (d.targetAtom.claimedBy != -1 && d.targetAtom.claimedBy != myId)) d.targetAtom = null; else { d.targetAtom.claimedBy = myId; d.targetAtom.claimLabel = "FRAKTAL"; } } } for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); int myId = 100 + i; if (npc.targetAtom != null) { if (npc.targetAtom.destroyed || npc.targetAtom.oreReserve < 8 || (npc.targetAtom.claimedBy != -1 && npc.targetAtom.claimedBy != myId)) npc.targetAtom = null; else { npc.targetAtom.claimedBy = myId; npc.targetAtom.claimLabel = npc.name; } } } } MultiShellAtom findUnclaimedAtomNear(float ox, float oy, float maxR, int minOre) { MultiShellAtom best = null; float bestD = maxR; for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (!a.destroyed && a.oreReserve >= minOre && a.claimedBy == -1) { float d = dist(ox, oy, a.x, a.y); if (d < bestD) { bestD = d; best = a; } } } return best; } void drawAimBeam() { if (autoAim && lockedAtom != null) { stroke(getKindColor(a11yMode, activeWeapon == 5 ? 9 : 4)); strokeWeight(a11yMode ? 2.4 : 1.5); line(shipX, shipY, lockedAtom.x, lockedAtom.y); noFill(); ellipse(lockedAtom.x, lockedAtom.y, 92, 92); if (a11yMode) { line(lockedAtom.x - 54, lockedAtom.y, lockedAtom.x - 38, lockedAtom.y); line(lockedAtom.x + 38, lockedAtom.y, lockedAtom.x + 54, lockedAtom.y); line(lockedAtom.x, lockedAtom.y - 54, lockedAtom.x, lockedAtom.y - 38); line(lockedAtom.x, lockedAtom.y + 38, lockedAtom.x, lockedAtom.y + 54); } strokeWeight(1.0); } } void drawNornStarship() { if (tLevel[7] > 0) { noFill(); stroke(a11yMode ? color(0, 235, 175) : color(45, 210, 145, 160)); strokeWeight(a11yMode ? 2.4 : 1.8); ellipse(0, 0, 114, 70); } if (drivesActive) { stroke(0, 255, 180); strokeWeight(2.2); fill(18, 28, 45); ellipse(-26, 0, 16, 48 + tLevel[1] * 4); noStroke(); fill(0, 255, 180, 140 + sin(simTime * 18.0) * 80); ellipse(-35, 0, 12, 22); } else { stroke(135, 155, 185); strokeWeight(1.8); fill(14, 18, 28); ellipse(-26, 0, 16, 48 + tLevel[1] * 4); } fill(242, 246, 255); stroke(a11yMode ? color(255, 235, 55) : (tLevel[6] > 0 ? color(45, 210, 145) : color(30, 42, 60))); strokeWeight(1.8 + tLevel[6] * 0.8); beginShape(); vertex(-30, -10 - tLevel[6]); vertex(24, -8 - tLevel[6]); vertex(64, 0); vertex(24, 8 + tLevel[6]); vertex(-30, 10 + tLevel[6]); vertex(-16, 0); endShape(CLOSE); if (tLevel[4] > 0) { fill(getKindColor(a11yMode, 9)); stroke(255); rect(8, -16, 20 + tLevel[4] * 4, 4); rect(8, 12, 20 + tLevel[4] * 4, 4); } fill(235, 185, 110); noStroke(); ellipse(-2, 0, 10, 8); strokeWeight(1.0); } void fireActiveWeapon() { float nx = shipX + cos(shipAngle) * 42.0, ny = shipY + sin(shipAngle) * 42.0; int kind = (activeWeapon == 5) ? 9 : (activeWeapon == 1 ? 4 : (activeWeapon == 2 ? 5 : (activeWeapon == 3 ? 6 : 3))); spaceShots.add(new BosonShot(nx, ny, cos(aimAngle) * 11.0, sin(aimAngle) * 11.0, kind)); if (activeWeapon == 5 && tLevel[4] >= 2) spaceShots.add(new BosonShot(nx - sin(aimAngle) * 8.0, ny + cos(aimAngle) * 8.0, cos(aimAngle) * 11.0, sin(aimAngle) * 11.0, 9)); } class FractalDrone { float x, y, vx, vy, spin, beamTargetX, beamTargetY; int idx, harvestCooldown, beamTimer; MultiShellAtom targetAtom; FractalDrone(float sx, float sy, int id) { x = sx; y = sy; idx = id; spin = random(TWO_PI); harvestCooldown = 35 + id * 15; } } void updateFractalDrones() { for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); int myId = 1 + i; d.spin += 0.08; if (d.beamTimer > 0) d.beamTimer--; if (d.targetAtom == null || dist(shipX, shipY, d.targetAtom.x, d.targetAtom.y) > 560.0) { d.targetAtom = findUnclaimedAtomNear(shipX, shipY, 520.0, 6); if (d.targetAtom != null) { d.targetAtom.claimedBy = myId; d.targetAtom.claimLabel = "FRAKTAL"; } } float gx = shipX + cos(simTime * 1.4 + i * 2.1) * 85.0, gy = shipY + sin(simTime * 1.4 + i * 2.1) * 85.0; if (d.targetAtom != null) { gx = d.targetAtom.x + cos(simTime * 2.0 + i) * 58.0; gy = d.targetAtom.y + sin(simTime * 2.0 + i) * 58.0; } d.vx = lerp(d.vx, (gx - d.x) * 0.06, 0.18); d.vy = lerp(d.vy, (gy - d.y) * 0.06, 0.18); d.x += d.vx; d.y += d.vy; if (d.targetAtom != null && dist(d.x, d.y, d.targetAtom.x, d.targetAtom.y) < 95.0) { d.harvestCooldown--; if (d.harvestCooldown <= 0) { d.harvestCooldown = max(45, 95 - tLevel[10] * 15); int mined = min(d.targetAtom.oreReserve, 6 + tLevel[10] * 2); d.targetAtom.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); d.targetAtom.hitFlash = 14; d.beamTargetX = d.targetAtom.x; d.beamTargetY = d.targetAtom.y; d.beamTimer = 14; spawnFloatingTag(d.targetAtom.x, d.targetAtom.y - 26, "+" + mined + " " + tr("Erz (Fraktal)", "Ore (Fractal)"), color(0, 255, 180)); if (d.targetAtom.oreReserve < 6) d.targetAtom = null; } } } } void drawFractalDrones() { for (int i = 0; i < fractalDrones.size(); i++) { FractalDrone d = (FractalDrone) fractalDrones.get(i); if (d.beamTimer > 0) { stroke(0, 255, 180); strokeWeight(a11yMode ? 2.4 : 1.8); line(d.x, d.y, d.beamTargetX, d.beamTargetY); strokeWeight(1.0); } pushMatrix(); translate(d.x, d.y); rotate(d.spin); noFill(); stroke(0, 255, 180); strokeWeight(a11yMode ? 2.0 : 1.5); for (int k = 0; k < 3; k++) { rotate(TWO_PI / 3.0); triangle(0, -13, -10, 9, 10, 9); } strokeWeight(1.0); popMatrix(); } } class NpcShip { int id; String name; float x, y, vx, vy, angle, beamX, beamY; int shipCol, state, rawOre, cargoGoods, marsSupplyCrate, credits, targetStationIdx, targetMarsPad, actionCooldown, beamTimer; MultiShellAtom targetAtom; NpcShip(int nid, String label, float sx, float sy, int col) { id = nid; name = label; x = sx; y = sy; angle = random(TWO_PI); shipCol = col; credits = 45; targetStationIdx = nid % spaceStations.size(); targetMarsPad = nid % 9; actionCooldown = 40 + nid * 12; } } // NPC-Flotte generiert beim Erreichen einer Station echten Handelsumsatz für die Stationskasse! void updateNpcFleet() { for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); int myId = 100 + i; if (npc.beamTimer > 0) npc.beamTimer--; if (npc.state == 0) { if (npc.targetAtom == null) { npc.targetAtom = findUnclaimedAtomNear(npc.x, npc.y, 2400.0, 8); if (npc.targetAtom != null) { npc.targetAtom.claimedBy = myId; npc.targetAtom.claimLabel = npc.name; } } if (npc.targetAtom != null) { float dx = npc.targetAtom.x - npc.x, dy = npc.targetAtom.y - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 82.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.4, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.4, 0.08); } else { npc.vx = lerp(npc.vx, -dy / d * 1.1, 0.1); npc.vy = lerp(npc.vy, dx / d * 1.1, 0.1); npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 75; int mined = min(npc.targetAtom.oreReserve, 6); npc.targetAtom.oreReserve -= mined; npc.rawOre += mined; npc.beamX = npc.targetAtom.x; npc.beamY = npc.targetAtom.y; npc.beamTimer = 14; if (npc.rawOre >= 18 || npc.targetAtom.oreReserve < 8) { npc.targetAtom = null; npc.state = 1; npc.targetStationIdx = int(random(0, spaceStations.size())); } } } } else { npc.angle += 0.015; npc.vx = cos(npc.angle) * 2.0; npc.vy = sin(npc.angle) * 2.0; } } else if (npc.state == 1) { SpaceStation st = (SpaceStation) spaceStations.get(npc.targetStationIdx); float dx = st.x - npc.x, dy = st.y - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 75.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.6, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.6, 0.08); } else { npc.vx *= 0.85; npc.vy *= 0.85; npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 60; float npcTurnover = 16.0 + npc.rawOre * 1.4; if (npc.cargoGoods > 0) { npc.credits += int(28 * st.priceBonus); npc.cargoGoods = 0; npcTurnover += 14.0; } if (npc.rawOre > 0) { npc.credits += npc.rawOre * 2; npc.rawOre = 0; } // NPC zahlt Umsatz in die Stationskasse ein -> finanziert Stations-Würfel! st.addTradeRevenue(npcTurnover, npc.name); spawnFloatingTag(st.x + random(-55, 55), st.y - 60, npc.name + ": +" + int(npcTurnover * st.getProfitRetentionFactor()) + "€ Kasse", st.accentCol); if (!marsHomeworldUnlocked && npc.credits >= 22) { npc.credits -= 18; npc.marsSupplyCrate = 1; npc.targetMarsPad = findLowestMarsSquare(); npc.state = 2; } else npc.state = 0; } } } else if (npc.state == 2) { float tx = getMarsPadCenterX(npc.targetMarsPad), ty = getMarsPadCenterY(npc.targetMarsPad); float dx = tx - npc.x, dy = ty - npc.y, d = max(1.0, sqrt(dx * dx + dy * dy)); npc.angle = atan2(dy, dx); if (d > 36.0) { npc.vx = lerp(npc.vx, (dx / d) * 2.3, 0.08); npc.vy = lerp(npc.vy, (dy / d) * 2.3, 0.08); } else { npc.vx *= 0.82; npc.vy *= 0.82; npc.actionCooldown--; if (npc.actionCooldown <= 0) { npc.actionCooldown = 60; if (!marsHomeworldUnlocked && npc.marsSupplyCrate > 0) { npc.marsSupplyCrate = 0; deliverProductsToMarsSquare(npc.targetMarsPad, npc.name, 3.5); } npc.state = 0; } } } npc.x = constrain(npc.x + npc.vx, -HALF_WORLD + 90, HALF_WORLD - 90); npc.y = constrain(npc.y + npc.vy, -HALF_WORLD + 90, HALF_WORLD - 90); } } int findLowestMarsSquare() { int best = 0; float lowest = 101.0; for (int i = 0; i < 9; i++) if (marsPadProg[i] < lowest) { lowest = marsPadProg[i]; best = i; } return best; } void drawNpcFleet() { for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); if (abs(npc.x - camX) > width * 0.65 || abs(npc.y - camY) > height * 0.65) continue; int col = a11yMode ? color(255, 225, 55) : npc.shipCol; if (npc.beamTimer > 0) { stroke(col); strokeWeight(1.8); line(npc.x, npc.y, npc.beamX, npc.beamY); strokeWeight(1.0); } pushMatrix(); translate(npc.x, npc.y); rotate(npc.angle); fill(20, 26, 40); stroke(col); strokeWeight(2.0); beginShape(); vertex(22, 0); vertex(-14, -11); vertex(-8, 0); vertex(-14, 11); endShape(CLOSE); strokeWeight(1.0); popMatrix(); fill(col); textSize(10); textAlign(CENTER, TOP); text(npc.name + ((npc.state == 2) ? " -> Mars" : ""), npc.x, npc.y + 15); } } void drawRemotePeerShips() { for (int i = 0; i < remotePeers.size(); i++) { RemotePeer rp = (RemotePeer) remotePeers.get(i); if (rp.mode == 0) { pushMatrix(); translate(rp.x, rp.y); rotate(rp.angle); fill(86, 195, 255); stroke(255); triangle(18, 0, -12, -9, -12, 9); popMatrix(); } } } // MEHRSCHALEN-ATOM MIT DAMTP-AXIOMATIK (Zeno-Lock, Fusion-Permit, I_max Sättigung, Tensile Stress) class MultiShellAtom { float x, y, vx, vy, orbitPhase; int protons, neutrons, electrons, oreReserve, maxOre, excitedLevel, exciteTimer, hitFlash, bondCount, claimedBy; boolean destroyed, hasFusionPermit, zenoObserved; int unstableDecayTimer; String claimLabel; MultiShellAtom(float ax, float ay, int p, int n, int e) { x = ax; y = ay; vx = random(-0.25, 0.25); vy = random(-0.25, 0.25); protons = max(1, p); neutrons = max(0, n); electrons = max(0, e); maxOre = (protons + neutrons) * 4 + 16; oreReserve = maxOre; orbitPhase = random(TWO_PI); claimedBy = -1; claimLabel = ""; hasFusionPermit = false; zenoObserved = false; unstableDecayTimer = 0; } String getSymbol() { int A = protons + neutrons; String[] syms = { "n", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg" }; String s = (protons >= 0 && protons < syms.length) ? syms[protons] : ("Z" + protons); return s + "-" + A; } int getOuterShell() { return (electrons <= 2) ? 1 : ((electrons <= 10) ? 2 : 3); } int getMaxBonds() { return ((protons == 1 && electrons == 1) ? 1 : (((protons >= 6 && electrons >= 4)) ? 2 : (hasFusionPermit ? 2 : 0))); } boolean isUnstableIsotope() { float ratio = (protons > 0) ? float(neutrons) / float(protons) : 9.0; return (protons >= 2 && (ratio < 0.55 || ratio > 1.85)) || (protons + neutrons > 16); } } class AtomBond { MultiShellAtom a, b; float eprPulse; AtomBond(MultiShellAtom aa, MultiShellAtom bb) { a = aa; b = bb; eprPulse = random(TWO_PI); } } void updateAtomsAndSpaceEntities() { spaceBonds.clear(); float traktorR = 48.0 + tLevel[10] * 45.0; float worldMouseX = camX + (getNormMouseX() - width * 0.5); float worldMouseY = camY + (getNormMouseY() - (height - 130) * 0.5); for (int i = spaceAtoms.size() - 1; i >= 0; i--) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (a.destroyed) { spaceAtoms.remove(i); continue; } a.bondCount = 0; a.orbitPhase += 0.045; if (a.hitFlash > 0) a.hitFlash--; a.vx *= 0.985; a.vy *= 0.985; if (abs(a.vx) < 0.12) a.vx += random(-0.04, 0.04); if (abs(a.vy) < 0.12) a.vy += random(-0.04, 0.04); a.x += a.vx; a.y += a.vy; if (a.x < -HALF_WORLD + 110 || a.x > HALF_WORLD - 110) a.vx = -a.vx; if (a.y < -HALF_WORLD + 110 || a.y > HALF_WORLD - 110) a.vy = -a.vy; if (a.oreReserve < a.maxOre && frameCount % 80 == 0) a.oreReserve++; // KAPITEL 1.3: SUBSYSTEM SELF-OBSERVATION (H_O x H_S x H_E) -> QUANTEN-ZENO-LOCK a.zenoObserved = (dist(shipX, shipY, a.x, a.y) < 210.0) || (dist(worldMouseX, worldMouseY, a.x, a.y) < 85.0); // KAPITEL 3.2: SINGULARITY SATURATION I_max = c^5 / (G * hbar) // Überschreitet die Nukleonenzahl A > 18, erfolgt eine deterministische Lambda_0 Phasen-Inversion statt Kollaps! int massA = a.protons + a.neutrons; if (massA > 18 && spaceAtoms.size() < 95) { int pHalf = max(1, a.protons / 2), nHalf = max(1, a.neutrons / 2), eHalf = max(1, a.electrons / 2); a.protons = max(1, a.protons - pHalf); a.neutrons = max(1, a.neutrons - nHalf); a.electrons = max(1, a.electrons - eHalf); MultiShellAtom child = new MultiShellAtom(a.x + 34, a.y - 24, pHalf, nHalf, eHalf); child.vx = -a.vx + random(-1.4, 1.4); child.vy = -a.vy + random(-1.4, 1.4); spaceAtoms.add(child); spaceQuanta.add(new VacuumQuantum(a.x, a.y)); spawnEvmCounterState(a.x, a.y, 14.5); shockRings.add(new ShockRing(a.x, a.y, color(255, 225, 55))); spawnFloatingTag(a.x, a.y - 40, "I_max LAMBDA_0 INVERSION!", color(255, 225, 55)); } // Spontaner Beta-Zerfall instabiler Isotope (wird durch Zeno-Beobachtung eingefroren!) if (a.isUnstableIsotope() && !a.zenoObserved) { a.unstableDecayTimer++; if (a.unstableDecayTimer > 380) { a.unstableDecayTimer = 0; if (a.neutrons > a.protons && a.neutrons > 1) { a.neutrons--; a.protons++; a.electrons++; } else if (a.protons > 2) { a.protons--; a.neutrons++; } spawnEvmCounterState(a.x, a.y, 0.511); shockRings.add(new ShockRing(a.x, a.y, getKindColor(a11yMode, 6))); spawnFloatingTag(a.x, a.y - 28, "BETA-DECAY (-E -> VOID)", getKindColor(a11yMode, 6)); } } if (a.excitedLevel > 0 && a.electrons > 0) { a.exciteTimer--; if (a.exciteTimer <= 0) { a.excitedLevel = 0; a.hitFlash = 18; spaceQuanta.add(new VacuumQuantum(a.x + random(-28, 28), a.y + random(-28, 28))); spawnEvmCounterState(a.x, a.y, 2.4); shockRings.add(new ShockRing(a.x, a.y, getKindColor(a11yMode, 4))); } } } // Kovalente Bindungen & Fusion bei Atomen mit Fusion-Permit aus dem Atom-Konstruktor for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a1 = (MultiShellAtom) spaceAtoms.get(i); if (a1.destroyed) continue; for (int j = i + 1; j < spaceAtoms.size(); j++) { MultiShellAtom a2 = (MultiShellAtom) spaceAtoms.get(j); if (a2.destroyed) continue; float dx = a2.x - a1.x, dy = a2.y - a1.y, d = max(1.0, sqrt(dx * dx + dy * dy)); if ((a1.hasFusionPermit || a2.hasFusionPermit) && d < 46.0 && (a1.protons + a1.neutrons + a2.protons + a2.neutrons) <= 18) { a1.protons += a2.protons; a1.neutrons += a2.neutrons; a1.electrons += a2.electrons; a1.maxOre += a2.maxOre; a1.oreReserve += a2.oreReserve; a2.destroyed = true; addResearchFP(12); spawnEvmCounterState(a1.x, a1.y, 8.8); shockRings.add(new ShockRing(a1.x, a1.y, color(0, 255, 180))); spawnFloatingTag(a1.x, a1.y - 35, "KERNFUSION! -> " + a1.getSymbol() + " (+12 FP)", color(0, 255, 180)); continue; } if (a1.bondCount < a1.getMaxBonds() && a2.bondCount < a2.getMaxBonds() && d >= 62.0 && d <= 152.0) { spaceBonds.add(new AtomBond(a1, a2)); a1.bondCount++; a2.bondCount++; float sp = (d - 104.0) * 0.014; a1.vx += (dx / d) * sp; a1.vy += (dy / d) * sp; a2.vx -= (dx / d) * sp; a2.vy -= (dy / d) * sp; } } } // KAPITEL 2.3: FLAT GALACTIC ROTATION CURVES g_stress = sqrt(G*M*a_0)/r // Schwere Atomkerne (A >= 10) ziehen Vakuum-Quanten auf tangentialen 1/r-Bahnen an for (int i = spaceQuanta.size() - 1; i >= 0; i--) { VacuumQuantum q = (VacuumQuantum) spaceQuanta.get(i); float d = dist(shipX, shipY, q.x, q.y); if (d < traktorR && d > 1.0) { q.x += ((shipX - q.x) / d) * (2.2 + tLevel[10] * 0.8); q.y += ((shipY - q.y) / d) * (2.2 + tLevel[10] * 0.8); } else { for (int k = 0; k < spaceAtoms.size(); k++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(k); if (a.protons + a.neutrons < 10) continue; float ad = dist(a.x, a.y, q.x, q.y); if (ad > 38.0 && ad < 190.0) { float ang = atan2(a.y - q.y, a.x - q.x); q.x += cos(ang) * 0.45 - sin(ang) * 0.75; q.y += sin(ang) * 0.45 + cos(ang) * 0.75; break; } } } if (d < 34.0) { rawQuanta++; q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); spawnFloatingTag(shipX, shipY - 24, "+1 Quantum", getKindColor(a11yMode, 7)); } } // Update Kapitel 1.2 EVM Counter-States (-E -> Void Rifts) for (int i = evmCounterStates.size() - 1; i >= 0; i--) { EvmCounterState cs = (EvmCounterState) evmCounterStates.get(i); if (cs.targetVoid != null) { float dx = cs.targetVoid.x - cs.x, dy = cs.targetVoid.y - cs.y, d = max(1.0, sqrt(dx * dx + dy * dy)); cs.vx = lerp(cs.vx, (dx / d) * 3.2, 0.12); cs.vy = lerp(cs.vy, (dy / d) * 3.2, 0.12); if (d < 22.0) cs.life = min(cs.life, 12); } cs.x += cs.vx; cs.y += cs.vy; cs.life--; if (cs.life <= 0) evmCounterStates.remove(i); } for (int i = 0; i < spaceRifts.size(); i++) { SingularityRift r = (SingularityRift) spaceRifts.get(i); r.x += cos(simTime * 1.4 + r.phase) * 0.6; r.y += sin(simTime * 1.7 + r.phase) * 0.6; if (dist(shipX, shipY, r.x, r.y) < 32.0) { hullHP = max(10, hullHP - max(6, 26 - tLevel[6] * 5 - tLevel[7] * 5)); wasteEntropy++; r.x = shipX + cos(shipAngle + PI) * 420.0; r.y = shipY + sin(shipAngle + PI) * 420.0; } } for (int i = spaceShots.size() - 1; i >= 0; i--) { BosonShot s = (BosonShot) spaceShots.get(i); s.x += s.vx; s.y += s.vy; s.life--; if (s.life <= 0) { spaceShots.remove(i); continue; } if (s.kind == 9) { boolean hitR = false; for (int r = 0; r < spaceRifts.size(); r++) { SingularityRift rf = (SingularityRift) spaceRifts.get(r); if (dist(s.x, s.y, rf.x, rf.y) < 30.0) { shockRings.add(new ShockRing(rf.x, rf.y, getKindColor(a11yMode, 9))); rf.x = random(-HALF_WORLD + 160, HALF_WORLD - 160); rf.y = random(-HALF_WORLD + 160, HALF_WORLD - 160); addResearchFP(10); hitR = true; break; } } if (hitR) { spaceShots.remove(i); continue; } } for (int j = 0; j < spaceAtoms.size(); j++) { MultiShellAtom target = (MultiShellAtom) spaceAtoms.get(j); if (dist(s.x, s.y, target.x, target.y) < ((target.electrons > 2 || target.excitedLevel > 0) ? 48.0 : 34.0)) { applyWeaponReactionToAtom(s, target); spaceShots.remove(i); break; } } } for (int i = shockRings.size() - 1; i >= 0; i--) { ShockRing r = (ShockRing) shockRings.get(i); r.r += 2.8; r.alpha -= 10; if (r.alpha <= 0) shockRings.remove(i); } for (int i = floatingTags.size() - 1; i >= 0; i--) { FloatingTag ft = (FloatingTag) floatingTags.get(i); ft.y -= 0.75; ft.life -= 3; if (ft.life <= 0) floatingTags.remove(i); } } void applyWeaponReactionToAtom(BosonShot s, MultiShellAtom target) { int bonusMult = 1 + tLevel[5]; target.hitFlash = 24; target.vx += s.vx * 0.10; target.vy += s.vy * 0.10; playerShotAtom = target; playerShotClaimTimer = 180; target.claimedBy = 0; // Jede positive Energie-Injektion (+E) erzeugt axiomatisch einen -E Counter-State für Tr(rho_0 * H_hat) = 0 spawnEvmCounterState(target.x, target.y, 1.022 * bonusMult); if (s.kind == 4 && target.electrons > 0) { int baseN = target.getOuterShell(); if (target.excitedLevel < 2 && (baseN + target.excitedLevel) < 3) { target.excitedLevel++; target.exciteTimer = 165; int fpGain = (target.bondCount > 0) ? 10 : 6; addResearchFP(fpGain); spawnFloatingTag(target.x, target.y - 34, "+" + fpGain + " FP", getKindColor(a11yMode, 4)); } else { target.electrons--; target.excitedLevel = 0; addResearchFP(12); spaceQuanta.add(new VacuumQuantum(target.x + 26, target.y - 18)); spawnFloatingTag(target.x, target.y - 34, "+12 FP", getKindColor(a11yMode, 4)); } } else if (s.kind == 5) { target.neutrons++; int mined = min(target.oreReserve, 12 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yMode, 5)); } else if (s.kind == 6) { if (target.protons > 1) { target.protons--; target.neutrons++; } else target.neutrons++; int mined = min(target.oreReserve, 10 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); addResearchFP(8); spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yMode, 6)); } else if (s.kind == 3) { if (target.electrons < target.protons) { target.electrons++; creditsEUR += 14; spawnFloatingTag(target.x, target.y - 34, "+14 EUR", getKindColor(a11yMode, 3)); } else { target.excitedLevel = min(2, target.excitedLevel + 1); target.exciteTimer = 120; creditsEUR += 6; spawnFloatingTag(target.x, target.y - 34, "+6 EUR", getKindColor(a11yMode, 3)); } } else if (s.kind == 9) { int mined = min(target.oreReserve, 18 * bonusMult); target.oreReserve -= mined; rawErz = min(rawOreCap, rawErz + mined); wasteEntropy++; spawnFloatingTag(target.x, target.y - 34, "+" + mined + " " + tr("Erz", "Ore"), getKindColor(a11yMode, 9)); } shockRings.add(new ShockRing(target.x, target.y, getKindColor(a11yMode, s.kind))); } // KAPITEL 1.2 RENDERER: ANTI-NEGATIVE COUNTER-STATES (-E) & VOID-VERSCHRÄNKUNG void drawEvmCounterStates() { for (int i = 0; i < evmCounterStates.size(); i++) { EvmCounterState cs = (EvmCounterState) evmCounterStates.get(i); if (abs(cs.x - camX) > width * 0.7 || abs(cs.y - camY) > height * 0.7) continue; int al = int(map(cs.life, 0, cs.maxLife, 30, 235)); stroke(245, 115, 195, al * 0.7); strokeWeight(1.3); // Gestrichelte ZEC-Verschränkungslinie vom Ursprung zum -E Paket for (int s = 0; s < 5; s++) { float t0 = s / 5.0, t1 = (s + 0.55) / 5.0; line(lerp(cs.ox, cs.x, t0), lerp(cs.oy, cs.y, t0), lerp(cs.ox, cs.x, t1), lerp(cs.oy, cs.y, t1)); } fill(32, 8, 28, al); stroke(255, 120, 215, al); ellipse(cs.x, cs.y, 18, 18); fill(255, 225, 245, al); textSize(9); textAlign(CENTER, CENTER); text("-E", cs.x, cs.y); strokeWeight(1.0); } } // KAPITEL 3.1 RENDERER: KOVALENTE BINDUNGEN & NON-LOKALE EPR-MATRIX-SHORTCUTS (A_ij^(eff)) void drawCovalentBonds() { int eCol = getKindColor(a11yMode, 3), glowC = a11yMode ? color(255, 235, 55) : color(56, 189, 248); for (int i = 0; i < spaceBonds.size(); i++) { AtomBond b = (AtomBond) spaceBonds.get(i); if (abs(b.a.x - camX) > width * 0.7 && abs(b.b.x - camX) > width * 0.7) continue; float mx = (b.a.x + b.b.x) * 0.5, my = (b.a.y + b.b.y) * 0.5, dx = b.b.x - b.a.x, dy = b.b.y - b.a.y, d = max(1.0, sqrt(dx * dx + dy * dy)); pushMatrix(); translate(mx, my); rotate(atan2(dy, dx)); noFill(); stroke(glowC); strokeWeight(a11yMode ? 2.0 : 1.5); ellipse(0, 0, d + 40.0, 40.0); // Kapitel 3.1: Nicht-lokaler EPR-Shortcut-Blitz entlang der Matrix-Adjazenzkante stroke(195, 125, 255, 175); strokeWeight(1.4); float zig = sin(simTime * 8.0 + i) * 7.0; line(-d * 0.42, 0, -d * 0.14, zig); line(-d * 0.14, zig, d * 0.14, -zig); line(d * 0.14, -zig, d * 0.42, 0); strokeWeight(1.0); float t1 = simTime * 2.4 + i, t2 = t1 + PI; noStroke(); fill(eCol); ellipse(sin(t1) * (d * 0.58), sin(2.0 * t1) * 14.0, 9, 9); ellipse(sin(t2) * (d * 0.58), sin(2.0 * t2) * 14.0, 9, 9); popMatrix(); } } void drawSpaceEntities() { int qCol = getKindColor(a11yMode, 7), rCol = getKindColor(a11yMode, 8); for (int i = 0; i < spaceQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) spaceQuanta.get(i); if (abs(q.x - camX) <= width * 0.6 && abs(q.y - camY) <= height * 0.6) { stroke(qCol); strokeWeight(a11yMode ? 2.2 : 1.2); fill(8, 30, 36); if (a11yMode) { quad(q.x, q.y - 11, q.x + 11, q.y, q.x, q.y + 11, q.x - 11, q.y); fill(255); textSize(9); textAlign(CENTER, CENTER); text("Q", q.x, q.y); } else ellipse(q.x, q.y, 18, 18); strokeWeight(1.0); } } for (int i = 0; i < spaceRifts.size(); i++) { SingularityRift r = (SingularityRift) spaceRifts.get(i); if (abs(r.x - camX) <= width * 0.6 && abs(r.y - camY) <= height * 0.6) { stroke(rCol); strokeWeight(a11yMode ? 2.4 : 1.2); fill(35, 6, 14); if (a11yMode) { triangle(r.x, r.y - 16, r.x - 15, r.y + 13, r.x + 15, r.y + 13); fill(255); textSize(11); textAlign(CENTER, CENTER); text("!", r.x, r.y + 3); } else ellipse(r.x, r.y, 26, 26); strokeWeight(1.0); } } int pCol = getKindColor(a11yMode, 1), nCol = getKindColor(a11yMode, 2), eCol = getKindColor(a11yMode, 3), goldCol = getKindColor(a11yMode, 4); for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); if (abs(a.x - camX) > width * 0.65 || abs(a.y - camY) > height * 0.65) continue; // Kapitel 2.2 & 2.3: Asymptotic Tensile Stress Halo (I < I_crit -> 1/r Rotationsfeld) int totalNuc = a.protons + a.neutrons; if (totalNuc >= 10 || a.bondCount > 0) { noFill(); stroke(255, 195, 55, 85 + sin(simTime * 3.0 + i) * 35); strokeWeight(1.4); ellipse(a.x, a.y, 134, 134); strokeWeight(1.0); } // Kapitel 1.3: Sichtbarer Quanten-Zeno-Beobachtungsring (friert Zerfall ein) if (a.zenoObserved) { noFill(); stroke(0, 255, 220, 175); strokeWeight(1.6); ellipse(a.x, a.y, 106, 106); strokeWeight(1.0); } // Fusion-Permit-Ring für im Atom-Konstruktor gebaute Kerne if (a.hasFusionPermit) { noFill(); stroke(255, 215, 0, 210); strokeWeight(2.0); ellipse(a.x, a.y, 44 + sin(simTime * 5.0) * 5.0, 44 + sin(simTime * 5.0) * 5.0); strokeWeight(1.0); } if (a.claimedBy > 0) { noFill(); stroke(a.claimedBy < 100 ? color(0, 255, 180, 140) : color(255, 225, 55, 140)); strokeWeight(a11yMode ? 2.0 : 1.0); ellipse(a.x, a.y, 96, 96); strokeWeight(1.0); } int e1 = min(2, a.electrons), e2 = max(0, min(8, a.electrons - 2)), e3 = 0; if (a.excitedLevel == 1 && e1 > 0) { e1--; e2++; } else if (a.excitedLevel >= 2 && a.electrons > 0) { if (e2 > 0) { e2--; e3++; } else if (e1 > 0) { e1--; e3++; } } noFill(); stroke(eCol); strokeWeight(a11yMode ? 1.8 : 1.2); ellipse(a.x, a.y, 56, 56); if (e2 > 0) { stroke(a.excitedLevel == 1 ? goldCol : eCol); ellipse(a.x, a.y, 88, 88); } if (e3 > 0) { stroke(goldCol); strokeWeight(2.0); ellipse(a.x, a.y, 118, 118); strokeWeight(1.0); } for (int k = 0; k < e1; k++) { float ang = a.orbitPhase * 1.4 + (TWO_PI * k) / max(1, e1); noStroke(); fill(eCol); ellipse(a.x + cos(ang) * 28.0, a.y + sin(ang) * 28.0, 8, 8); } for (int k = 0; k < e2; k++) { float ang = -a.orbitPhase + (TWO_PI * k) / max(1, e2); noStroke(); fill(a.excitedLevel == 1 ? goldCol : eCol); ellipse(a.x + cos(ang) * 44.0, a.y + sin(ang) * 44.0, 9, 9); } for (int k = 0; k < e3; k++) { float ang = a.orbitPhase * 0.8 + k; noStroke(); fill(goldCol); ellipse(a.x + cos(ang) * 59.0, a.y + sin(ang) * 59.0, 10, 10); } for (int k = 0; k < totalNuc; k++) { float offX = 0.0, offY = 0.0; if (totalNuc > 1) { float kAng = (TWO_PI * k) / float(totalNuc) + simTime * 0.8, kRad = min(14.0, 3.5 + totalNuc * 0.75); offX = cos(kAng) * kRad; offY = sin(kAng) * kRad; } boolean isProton = (k < a.protons); fill(isProton ? pCol : nCol); stroke(a11yMode ? color(0) : color(255, 140)); if (a11yMode && !isProton) { rectMode(CENTER); rect(a.x + offX, a.y + offY, 10, 10); rectMode(CORNER); } else ellipse(a.x + offX, a.y + offY, 12, 12); } fill(255); textSize(10); textAlign(CENTER, TOP); String zenoTag = a.zenoObserved ? " [ZENO]" : (a.hasFusionPermit ? " [PERMIT]" : ""); text(a.getSymbol() + zenoTag + " · " + tr("Erz:", "Ore:") + a.oreReserve + ((a.claimedBy > 0) ? (" [" + a.claimLabel + "]") : ""), a.x, a.y + (e3 > 0 ? 64.0 : (e2 > 0 ? 50.0 : 34.0))); } for (int i = 0; i < spaceShots.size(); i++) { BosonShot s = (BosonShot) spaceShots.get(i); fill(getKindColor(a11yMode, s.kind)); stroke(255); ellipse(s.x, s.y, 11, 11); } for (int i = 0; i < shockRings.size(); i++) { ShockRing r = (ShockRing) shockRings.get(i); noFill(); stroke(red(r.col), green(r.col), blue(r.col), r.alpha); strokeWeight(a11yMode ? 2.0 : 1.0); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } strokeWeight(1.0); } void drawFloatingTags() { for (int i = 0; i < floatingTags.size(); i++) { FloatingTag ft = (FloatingTag) floatingTags.get(i); fill(red(ft.col), green(ft.col), blue(ft.col), ft.life); textSize(12); textAlign(CENTER, CENTER); text(ft.txt, ft.x, ft.y); } } void drawFlightHUD() { rectMode(CORNER); int hudTop = height - 130; fill(getUiPalette(a11yMode, 1)); noStroke(); rect(0, hudTop, width, 130); stroke(getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.0 : 1.0); line(0, hudTop, width, hudTop); strokeWeight(1.0); fill(255); textSize(11); textAlign(LEFT, TOP); String driveTag = drivesActive ? tr("Antrieb: AN [Space]", "Drives: ON [Space]") : tr("Antrieb: AUS [Space]", "Drives: OFF [Space]"); text(driveTag + tr(" | Hülle: ", " | Hull: ") + hullHP + "/" + maxHullHP + tr(" | Roh-Erz: ", " | Raw Ore: ") + rawErz + "/" + rawOreCap + " | Quanta: " + rawQuanta + tr(" | Fracht: ", " | Cargo: ") + getCargoUsed() + "/" + cargoCap + tr(" | Würfel: ", " | Cubes: ") + tradeCubesCount, 16, hudTop + 8); drawWpnSlot(16, hudTop + 30, 1, "[1] Photon", getKindColor(a11yMode, 4)); drawWpnSlot(122, hudTop + 30, 2, "[2] Gluon", getKindColor(a11yMode, 5)); drawWpnSlot(228, hudTop + 30, 3, "[3] W-Boson", getKindColor(a11yMode, 6)); drawWpnSlot(334, hudTop + 30, 4, tr("[4] Elektron", "[4] Electron"), getKindColor(a11yMode, 3)); drawWpnSlot(440, hudTop + 30, 5, tr("[5] Mesonen", "[5] Mesons"), getKindColor(a11yMode, 9)); drawNavBtn(548, hudTop + 30, 102, 26, zeroClick ? tr("0-Klick: AN", "0-Click: ON") : tr("0-Klick: AUS", "0-Click: OFF"), zeroClick ? color(20, 125, 75) : color(35, 45, 65), zeroClick); drawNavBtn(655, hudTop + 30, 108, 26, tr("Atom-Bau [N]", "Atom Lab [N]"), color(18, 82, 125), false); drawNavBtn(768, hudTop + 30, 102, 26, tr("Mars [R]", "Mars [R]"), marsHomeworldUnlocked ? color(20, 125, 75) : getUiPalette(a11yMode, 2), false); drawNavBtn(875, hudTop + 30, 102, 26, tr("Handel [G]", "Trade [G]"), getUiPalette(a11yMode, 3), false); fill(a11yMode ? color(0) : color(8, 10, 18)); stroke(a11yMode ? color(255, 225, 45) : color(55, 68, 95)); strokeWeight(a11yMode ? 1.8 : 1.0); rect(16, hudTop + 62, 961, 58, 5); strokeWeight(1.0); fill(getKindColor(a11yMode, 4)); textAlign(LEFT, TOP); text("SENSOR: " + sensorInfo, 26, hudTop + 68); fill(255); textSize(12); text(bannerHead, 26, hudTop + 86); fill(220, 232, 250); textSize(11); text(bannerSub, 26, hudTop + 104); int mapSize = 110, mapX = width - mapSize - 16, mapY = hudTop + 10; fill(0); stroke(getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.0 : 1.0); rect(mapX, mapY, mapSize, mapSize, 4); strokeWeight(1.0); fill(marsHomeworldUnlocked ? color(0, 235, 175) : color(255, 165, 0)); noStroke(); rect(map(MARS_BASE_X, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6) - 6, map(MARS_BASE_Y, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6) - 4, 12, 8); for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); fill(a11yMode ? color(86, 195, 255) : st.accentCol); rect(map(st.x, -HALF_WORLD, HALF_WORLD, mapX + 5, mapX + mapSize - 5) - 3, map(st.y, -HALF_WORLD, HALF_WORLD, mapY + 5, mapY + mapSize - 5) - 3, 6, 6); } fill(170, 205, 255, 190); for (int i = 0; i < spaceAtoms.size(); i++) { MultiShellAtom a = (MultiShellAtom) spaceAtoms.get(i); rect(map(a.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3), map(a.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3), 2, 2); } for (int i = 0; i < npcShips.size(); i++) { NpcShip npc = (NpcShip) npcShips.get(i); fill(a11yMode ? color(255, 235, 55) : npc.shipCol); ellipse(map(npc.x, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4), map(npc.y, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4), 3, 3); } fill(255); ellipse(map(shipX, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4), map(shipY, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4), 5, 5); } void drawWpnSlot(int bx, int by, int id, String lbl, int c) { rectMode(CORNER); boolean sel = (activeWeapon == id); fill(sel ? getUiPalette(a11yMode, 2) : (a11yMode ? color(12, 16, 26) : color(20, 25, 38))); stroke(sel ? getUiPalette(a11yMode, 4) : (a11yMode ? color(160, 180, 210) : color(60, 75, 105))); strokeWeight(sel && a11yMode ? 2.2 : 1.0); rect(bx, by, 102, 26, 4); strokeWeight(1.0); fill(c); noStroke(); if (a11yMode && id % 2 == 0) rect(bx + 7, by + 9, 8, 8); else ellipse(bx + 11, by + 13, 9, 9); fill(255); textSize(11); textAlign(LEFT, CENTER); text(lbl, bx + 20, by + 13); } // ============================================================================================== // VIEWMODE 6: KAPITALISTISCHER DAMTP ATOM- & MOLEKÜL-KONSTRUKTOR AN DER BASIS ([N]) // ============================================================================================== void addLabParticle(int pType) { if (pType == 1) { // Proton (+1 e): 2u, 1d if (!devModeActive && (refinedErz < COST_PROTON_ERZ || creditsEUR < COST_PROTON_EUR)) { pushBanner(tr("Zu wenig Ressourcen für Proton!", "Not enough resources for Proton!"), tr("Benötigt: 4 Erz + 2 EUR (oder [C] 4s für Dev-Modus).", "Requires: 4 Ore + 2 EUR (or hold [C] 4s for Dev Mode).")); return; } if (!devModeActive) { refinedErz -= COST_PROTON_ERZ; creditsEUR -= COST_PROTON_EUR; } labProtons = min(14, labProtons + 1); } else if (pType == 2) { // Neutron (0 e): 1u, 2d if (!devModeActive && (refinedErz < COST_NEUTRON_ERZ || researchFP < COST_NEUTRON_FP)) { pushBanner(tr("Zu wenig Ressourcen für Neutron!", "Not enough resources for Neutron!"), tr("Benötigt: 4 Erz + 1 FP.", "Requires: 4 Ore + 1 RP.")); return; } if (!devModeActive) { refinedErz -= COST_NEUTRON_ERZ; researchFP -= COST_NEUTRON_FP; } labNeutrons = min(16, labNeutrons + 1); } else if (pType == 3) { // Elektron (-1 e) if (!devModeActive && (researchFP < COST_ELEC_FP || creditsEUR < COST_ELEC_EUR)) { pushBanner(tr("Zu wenig Ressourcen für Elektron!", "Not enough resources for Electron!"), tr("Benötigt: 2 FP + 1 EUR.", "Requires: 2 RP + 1 EUR.")); return; } if (!devModeActive) { researchFP -= COST_ELEC_FP; creditsEUR -= COST_ELEC_EUR; } labElectrons = min(14, labElectrons + 1); } } void releaseConstructedAtomToCosmos() { if (labProtons <= 0) return; SpaceStation st = getActiveOrNearestStation(); float B_MeV = calcBetheWeizsaecker(labProtons, labNeutrons); float divMult = 1.0 + tLevel[11] * 0.25; int eurReward = int((10.0 + B_MeV * 0.45) * divMult); int fpReward = int((6.0 + B_MeV * 0.25) * divMult); float spawnX = shipX + cos(shipAngle) * 115.0; float spawnY = shipY + sin(shipAngle) * 115.0; if (labBuildMode == 0) { // Kern-Modus: Ein einzelnes Atom mit aktivem Fusion-Permit MultiShellAtom created = new MultiShellAtom(spawnX, spawnY, labProtons, labNeutrons, labElectrons); created.hasFusionPermit = true; spaceAtoms.add(created); } else { // Molekül-Modus: Zwei kovalent verschränkte Atome mit EPR-Matrix-Shortcut int p1 = max(1, labProtons / 2), p2 = max(1, labProtons - p1); int n1 = labNeutrons / 2, n2 = labNeutrons - n1; int e1 = max(1, labElectrons / 2), e2 = max(1, labElectrons - e1); MultiShellAtom m1 = new MultiShellAtom(spawnX - 42, spawnY, p1, n1, e1); MultiShellAtom m2 = new MultiShellAtom(spawnX + 42, spawnY, p2, n2, e2); m1.hasFusionPermit = false; m2.hasFusionPermit = false; spaceAtoms.add(m1); spaceAtoms.add(m2); eurReward = int(eurReward * 1.25); } creditsEUR += eurReward; addResearchFP(fpReward); st.addTradeRevenue(eurReward * 0.55, "ATOM-LAB"); spawnEvmCounterState(spawnX, spawnY, B_MeV); shockRings.add(new ShockRing(spawnX, spawnY, color(0, 255, 180))); spawnFloatingTag(spawnX, spawnY - 30, "+" + eurReward + " EUR / +" + fpReward + " FP", color(0, 255, 180)); pushBanner(tr("Atom/Molekül im Kosmos freigesetzt! Dividende: +" + eurReward + " EUR & +" + fpReward + " FP", "Atom/Molecule released to Cosmos! Dividend: +" + eurReward + " EUR & +" + fpReward + " RP"), tr("Stationskasse " + st.nameDe + " erhält Umsatz · E_bind = " + nf(B_MeV, 1, 2) + " MeV", "Station Treasury " + st.nameEn + " receives revenue · E_bind = " + nf(B_MeV, 1, 2) + " MeV")); labProtons = 1; labNeutrons = 1; labElectrons = 1; } void drawAtomConstructorBaseMode() { rectMode(CORNER); fill(getUiPalette(a11yMode, 1)); stroke(getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.2 : 1.2); rect(16, 48, width - 32, 676, 8); strokeWeight(1.0); // Linke Konstruktions-Werkbank (wie TLW_Atom_simulator_2.pde) fill(12, 16, 26); stroke(56, 189, 248); strokeWeight(1.6); rect(30, 62, 310, 646, 8); strokeWeight(1.0); fill(56, 189, 248); textSize(14); textAlign(CENTER, TOP); text(tr("ATOM-KONSTRUKTIONS-BOX [N]", "ATOM ASSEMBLY WORKBENCH [N]"), 185, 74); fill(220, 232, 250); textSize(11); text(tr("Kapitalistische Nukleosynthese · " + (devModeActive ? "DEV: KOSTENLOS" : "Erz/FP/EUR"), "Capitalist Nucleosynthesis · " + (devModeActive ? "DEV: FREE" : "Ore/RP/EUR")), 185, 95); drawNavBtn(44, 120, 136, 32, tr("Kern-Modus (Permit)", "Nucleus (Permit)"), labBuildMode == 0 ? getUiPalette(a11yMode, 2) : color(28, 36, 54), labBuildMode == 0); drawNavBtn(190, 120, 136, 32, tr("Molekül-Modus (EPR)", "Molecule (EPR)"), labBuildMode == 1 ? getUiPalette(a11yMode, 2) : color(28, 36, 54), labBuildMode == 1); String pCostLbl = devModeActive ? "0 (DEV)" : (COST_PROTON_ERZ + " Erz + " + COST_PROTON_EUR + "€"); String nCostLbl = devModeActive ? "0 (DEV)" : (COST_NEUTRON_ERZ + " Erz + " + COST_NEUTRON_FP + " FP"); String eCostLbl = devModeActive ? "0 (DEV)" : (COST_ELEC_FP + " FP + " + COST_ELEC_EUR + "€"); drawNavBtn(44, 168, 282, 40, tr("+ Proton (2u, 1d) [", "+ Proton (2u, 1d) [") + pCostLbl + "]", getKindColor(a11yMode, 1), true); drawNavBtn(44, 218, 282, 40, tr("+ Neutron (1u, 2d) [", "+ Neutron (1u, 2d) [") + nCostLbl + "]", color(75, 90, 115), true); drawNavBtn(44, 268, 282, 40, tr("+ Elektron / Hülle [", "+ Electron / Shell [") + eCostLbl + "]", getKindColor(a11yMode, 3), true); drawNavBtn(44, 320, 282, 32, labExpertMatrix ? tr("DAMTP Matrix L_Gamma = D - A: AN", "DAMTP Matrix L_Gamma = D - A: ON") : tr("DAMTP Matrix L_Gamma = D - A: AUS", "DAMTP Matrix L_Gamma = D - A: OFF"), labExpertMatrix ? color(18, 82, 125) : color(32, 40, 58), labExpertMatrix); float B_MeV = calcBetheWeizsaecker(labProtons, labNeutrons); float divMult = 1.0 + tLevel[11] * 0.25; int estEur = int((10.0 + B_MeV * 0.45) * divMult * (labBuildMode == 1 ? 1.25 : 1.0)); int estFp = int((6.0 + B_MeV * 0.25) * divMult); fill(16, 24, 38); stroke(80, 245, 175); rect(44, 366, 282, 118, 6); fill(80, 245, 175); textSize(12); textAlign(LEFT, TOP); text(tr("ZEC-MARKTDIVIDENDE BEI FREISETZUNG:", "ZEC MARKET DIVIDEND ON RELEASE:"), 56, 376); fill(255); textSize(12); text("• E_bind (Bethe-Weizsäcker): " + nf(B_MeV, 1, 2) + " MeV", 56, 398); text(tr("• Auszahlung: +", "• Payout: +") + estEur + " EUR & +" + estFp + " FP", 56, 418); text(tr("• Stationskasse: +", "• Station Treasury: +") + int(estEur * 0.55) + " EUR Umsatz", 56, 438); fill(255, 225, 55); textSize(10); text("• ZEC: Tr(rho_0 * H_hat) = 0.0000 eV (-E -> Void)", 56, 460); drawNavBtn(44, 500, 282, 48, tr("IN KOSMOS FREISETZEN (+EUR/+FP) ▶", "RELEASE TO COSMOS (+EUR/+RP) ▶"), color(16, 125, 75), true); drawNavBtn(44, 560, 282, 34, tr("WERKBANK ZURÜCKSETZEN (H-2)", "RESET WORKBENCH (H-2)"), color(120, 32, 42), false); drawNavBtn(44, 656, 282, 36, tr("← ZURÜCK ZUM RAUMSCHIFF [1]", "← BACK TO STARSHIP [1]"), getUiPalette(a11yMode, 3), false); // Mittlere Live-Vorschau des gebauten Atoms/Moleküls mit Quark-Triplets (2u,1d / 1u,2d) float cx = 565.0, cy = 265.0; fill(8, 11, 18); stroke(59, 110, 194); rect(356, 62, 420, 410, 8); fill(255); textSize(13); textAlign(LEFT, TOP); text(tr("SUBATOMARE LIVE-TOPOLOGIE (SU(3) QUARK-TRIPLETS)", "SUBATOMIC LIVE TOPOLOGY (SU(3) QUARK TRIPLETS)"), 370, 72); pushMatrix(); translate(cx, cy); if (labBuildMode == 0) { noFill(); stroke(255, 215, 0, 190); strokeWeight(2.0); ellipse(0, 0, 195 + sin(simTime * 4.0) * 6.0, 195 + sin(simTime * 4.0) * 6.0); fill(255, 215, 0); textSize(10); textAlign(CENTER, CENTER); text("FUSION PERMIT ACTIVE", 0, -112); } else { noFill(); stroke(195, 125, 255, 190); strokeWeight(2.0); ellipse(0, 0, 240, 130); fill(195, 125, 255); textSize(10); textAlign(CENTER, CENTER); text("EPR MATRIX SHORTCUT A_ij^(eff)", 0, -82); } // Elektronenschalen noFill(); stroke(86, 195, 255, 90); strokeWeight(1.2); ellipse(0, 0, 120, 120); if (labElectrons > 2) ellipse(0, 0, 168, 168); if (labElectrons > 10) ellipse(0, 0, 212, 212); for (int e = 0; e < labElectrons; e++) { int sh = (e < 2) ? 1 : ((e < 10) ? 2 : 3); float rad = (sh == 1) ? 60.0 : ((sh == 2) ? 84.0 : 106.0); float ang = simTime * (2.2 / sh) + (TWO_PI * e) / max(1, labElectrons); fill(getKindColor(a11yMode, 3)); noStroke(); ellipse(cos(ang) * rad, sin(ang) * rad, 11, 11); } // Nukleonen mit inneren Up/Down-Quark-Dreiecken (wie in TLW_Atom_simulator_2.pde) int totalN = labProtons + labNeutrons; for (int k = 0; k < totalN; k++) { boolean isP = (k < labProtons); float ang = (TWO_PI * k) / max(1, totalN) + simTime * 0.4; float rad = (totalN == 1) ? 0.0 : min(42.0, 10.0 + totalN * 1.6); float offX = (labBuildMode == 1) ? ((k % 2 == 0) ? -34.0 : 34.0) + cos(ang) * (rad * 0.55) : cos(ang) * rad; float offY = sin(ang) * (rad * (labBuildMode == 1 ? 0.55 : 1.0)); pushMatrix(); translate(offX, offY); fill(isP ? color(220, 50, 50, 150) : color(130, 145, 165, 150)); stroke(255, 160); ellipse(0, 0, 26, 26); stroke(255, 235, 55, 200); float q1x = sin(0) * 6.0, q1y = cos(0) * 6.0; float q2x = sin(TWO_PI / 3.0) * 6.0, q2y = cos(TWO_PI / 3.0) * 6.0; float q3x = sin(2.0 * TWO_PI / 3.0) * 6.0, q3y = cos(2.0 * TWO_PI / 3.0) * 6.0; line(q1x, q1y, q2x, q2y); line(q2x, q2y, q3x, q3y); line(q3x, q3y, q1x, q1y); noStroke(); fill(255, 200, 0); ellipse(q1x, q1y, 5, 5); ellipse(q2x, q2y, 5, 5); fill(isP ? color(255, 200, 0) : color(0, 220, 255)); ellipse(q3x, q3y, 5, 5); popMatrix(); } popMatrix(); //Rechts oben: Nuklid-Inspektor & Periodensystem fill(12, 16, 26); stroke(56, 189, 248); rect(790, 62, 298, 410, 8); String[] syms = { "--", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si" }; String[] namesDe = { "Vakuum", "Wasserstoff", "Helium", "Lithium", "Beryllium", "Bor", "Kohlenstoff", "Stickstoff", "Sauerstoff", "Fluor", "Neon", "Natrium", "Magnesium", "Aluminium", "Silizium" }; int dZ = constrain(labProtons, 0, 14); int massA = labProtons + labNeutrons; fill(56, 189, 248); textSize(13); textAlign(LEFT, TOP); text(tr("NUKLID-INSPEKTOR (BETHE-WEIZSÄCKER)", "NUCLIDE INSPECTOR (BETHE-WEIZSÄCKER)"), 804, 74); fill(18, 36, 62); stroke(86, 195, 255); rect(804, 102, 76, 86, 6); fill(255); textSize(11); text("Z = " + labProtons, 812, 108); textSize(24); textAlign(CENTER, CENTER); text(syms[dZ], 842, 142); textSize(10); text(namesDe[dZ], 842, 174); textAlign(LEFT, TOP); fill(235, 242, 255); textSize(12); text("Protonen (Z): " + labProtons + " | Neutronen (N): " + labNeutrons, 892, 106); text("Massenzahl (A): " + massA + " | Elektronen: " + labElectrons, 892, 128); float bPerA = (massA > 0) ? (B_MeV / float(massA)) : 0.0; fill(0, 255, 180); text("E_bind: " + nf(B_MeV, 1, 2) + " MeV (" + nf(bPerA, 1, 2) + " MeV/A)", 892, 150); float nz = (labProtons > 0) ? float(labNeutrons) / float(labProtons) : 0.0; boolean stbl = (labProtons == 1 && labNeutrons <= 2) || (labProtons > 1 && nz >= 0.6 && nz <= 1.6 && massA <= 18); fill(stbl ? color(80, 245, 175) : color(255, 120, 120)); text(stbl ? tr("Status: KERN STABIL (Zeno-geschützt)", "Status: NUCLEUS STABLE (Zeno-protected)") : tr("Status: INSTABIL (Beta-Zerfall / I_max)", "Status: UNSTABLE (Beta Decay / I_max)"), 804, 202); fill(210, 225, 245); textSize(11); text(tr("AXIOMATISCHE DAMTP-EFFEKTE IM KOSMOS:\n" + "• Kap. 1.2: Jede Reaktion erzeugt -E Counter-States,\n die in kosmische Voids abwandern (Tr(rho_0 H) = 0).\n" + "• Kap. 1.3: Dein Schiff friert als interner Beobachter\n O c Gamma den Zerfall per Quanten-Zeno-Effekt ein.\n" + "• Kap. 2.2/2.3: Schwere Kerne (A >= 10) wölben das\n Sechseck-Gitter und erzeugen 1/r Tensile-Stress-Halos.\n" + "• Kap. 3.1: Moleküle zeigen nicht-lokale EPR-Blitze.\n" + "• Kap. 3.2: Bei A > 18 verhindert I_max Singularitäten\n durch deterministische Lambda_0 Phasen-Inversion.", "AXIOMATIC DAMTP EFFECTS IN COSMOS:\n" + "• Ch. 1.2: Reactions spawn -E Counter-States to Voids.\n" + "• Ch. 1.3: Ship freezes decay via Quantum Zeno Effect.\n" + "• Ch. 2.2/2.3: Heavy nuclei warp lattice & 1/r Halos.\n" + "• Ch. 3.1: Molecules display non-local EPR shortcuts.\n" + "• Ch. 3.2: A > 18 triggers I_max Lambda_0 inversion."), 804, 232); // Unten: DAMTP Closed Graph Laplacian Matrix L_Gamma = D - A & Reaktor-Kritikalität k_eff fill(10, 14, 22); stroke(0, 220, 255); rect(356, 484, 732, 224, 8); fill(0, 220, 255); textSize(12); textAlign(LEFT, TOP); text("DAMTP CLOSED GRAPH LAPLACIAN OPERATOR: L_Gamma = D - A | FIELD EQ: L_Gamma * Psi_ij - Lambda_0 * gamma_ij = (8*pi*G/c^4) * I_ij", 370, 496); if (labExpertMatrix) { fill(0, 255, 180); textSize(11); text("Laplacian Submatrix [L_ij] (6x6) für A=" + massA + ":", 370, 522); fill(215, 230, 250); textSize(11); int dim = min(6, max(2, totalN)); for (int r = 0; r < dim; r++) { String rowS = ""; for (int c = 0; c < dim; c++) { float val = (r == c) ? (dim * 0.85) : -0.85; rowS += (val >= 0 ? " " : " ") + nf(val, 1, 2) + " "; } text(rowS, 370, 544 + r * 20); } float k_eff = 0.88 + labNeutrons * 0.04; fill(255, 220, 80); text("IAEA ZENO SAFEGUARD & KRITIKALITÄT:", 710, 522); fill(235, 242, 255); text("• Multiplikationsfaktor k_eff = " + nf(k_eff, 1, 3), 710, 546); text("• ZEC Invarianz: Tr(rho_0 * H_hat) = 0.000000 eV", 710, 568); text("• Beryllium-Sättigung I_max = c^5 / (G * hbar)", 710, 590); text("• Beobachter-Dekomposition: H_Gamma = H_O x H_S x H_E", 710, 612); text("• Aktive Atome im Kosmos: " + spaceAtoms.size() + " | Bindungen: " + spaceBonds.size(), 710, 634); } } void drawMarsBaseDetailMode() { rectMode(CORNER); float mx = getNormMouseX(), my = getNormMouseY(); int overall = getMarsOverallProgress(); fill(getUiPalette(a11yMode, 1)); stroke(marsHomeworldUnlocked ? color(0, 235, 175) : getUiPalette(a11yMode, 4)); strokeWeight(a11yMode ? 2.2 : 1.0); rect(16, 48, width - 32, 676, 8); strokeWeight(1.0); fill(a11yMode ? color(16, 22, 36) : lerpColor(color(72, 22, 18), color(16, 52, 38), map(overall, 0, 100, 0.0, 1.0))); noStroke(); rect(34, 60, width - 68, 54, 6); fill(255); textSize(16); textAlign(LEFT, TOP); text(marsHomeworldUnlocked ? tr("NORN HEIMATWELT — LEBENDIGE 0-KLICK FARM & MANUFAKTUR (60 Norns)", "NORN HOMEWORLD — LIVING 0-CLICK FARM & MANUFACTORY (60 Norns)") : tr("MARS-AUFBAUBASIS (" + overall + "%) — KARTE ANKLICKEN ZUM LIEFERN", "MARS CONSTRUCTION BASE (" + overall + "%) — CLICK CARD TO DELIVER"), 48, 68); fill(240, 246, 255); textSize(12); text(tr("Fracht: CNT-Aerogel: " + cargoQty[0] + " | Bariumtitanat: " + cargoQty[1] + " | Zeno-Stasis: " + cargoQty[2] + " | Plasma-Döner: " + cargoQty[3] + " | Erz: " + refinedErz, "Cargo: CNT Aerogel: " + cargoQty[0] + " | Barium Titanate: " + cargoQty[1] + " | Zeno Stasis: " + cargoQty[2] + " | Plasma Doner: " + cargoQty[3] + " | Ore: " + refinedErz), 48, 91); if (!marsHomeworldUnlocked) { for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = getMarsMenuCardY(i), qw = 340, qh = 156; boolean done = (marsPadProg[i] >= 100.0), ready = canDeliverToMarsSquare(i); boolean cardHover = (mx >= qx && mx <= qx + qw && my >= qy && my <= qy + qh); fill(done ? color(14, 68, 46) : (cardHover ? color(24, 34, 54) : color(16, 21, 34))); stroke(cardHover ? color(255) : (done ? color(0, 235, 175) : (ready ? color(255, 235, 55) : color(110, 145, 210)))); strokeWeight(cardHover || a11yMode ? 2.2 : 1.3); rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(14); textAlign(LEFT, TOP); text(getMarsSquareName(i), qx + 14, qy + 12); textAlign(RIGHT, TOP); text(int(marsPadProg[i]) + "%", qx + qw - 14, qy + 12); fill(230, 240, 255); textSize(12); textAlign(LEFT, TOP); text(tr("Bau-Bedarf: ", "Required: ") + getMarsSquareReqLabel(i), qx + 14, qy + 42); fill(6, 10, 18); noStroke(); rect(qx + 14, qy + 68, qw - 28, 16, 4); fill(done ? color(0, 235, 175) : color(86, 195, 255)); rect(qx + 14, qy + 68, constrain(map(marsPadProg[i], 0, 100, 0, qw - 28), 0, qw - 28), 16, 4); if (done) drawNavBtn(qx + 14, qy + 98, qw - 28, 42, tr("✓ QUADRAT FERTIG (100%)", "✓ SQUARE COMPLETE (100%)"), color(16, 105, 62), true); else drawNavBtn(qx + 14, qy + 98, qw - 28, 42, ready ? tr("★ PRODUKT LIEFERN (+25%)", "★ DELIVER PRODUCT (+25%)") : tr("Fehlt -> [G] Handel", "Missing -> [G] Trade"), ready ? getUiPalette(a11yMode, 2) : color(36, 44, 64), ready); } } else { if (my > 125 && my < 640) { hwWalkerX = lerp(hwWalkerX, mx, 0.09); hwWalkerY = lerp(hwWalkerY, my, 0.09); hwWalkAnim += 0.22; } int hoveredSq = -1; for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = 130 + getGridRow(i) * 165, qw = 340, qh = 152; boolean over = (hwWalkerX >= qx && hwWalkerX <= qx + qw && hwWalkerY >= qy && hwWalkerY <= qy + qh); if (over) hoveredSq = i; String[] fTitleDe = { "1. Korn-Feld (" + int(hwKornGrow) + "%)", "2. Tomaten-Feld (" + int(hwTomGrow) + "%)", "3. Brunnen (" + hwWasser + ")", hwStallBuilt ? "4. Kuhstall (" + int(hwStallWork) + "%)" : "4. Kuhstall (15€)", hwKaeseBuilt ? "5. Käserei (" + int(hwKaeseWork) + "%)" : "5. Käserei (30€)", hwMuehleBuilt ? "6. Mühle (" + int(hwMuehleWork) + "%)" : "6. Mühle (25€)", "7. Pizza-Ofen (" + int(hwPizzaWork) + "%)", "8. Heimat-Markt", "9. Norn-Siedlung (60)" }; String[] fSubDe = { "Korn: " + hwKorn + " | Stroh: " + hwHeu, "Tomaten: " + hwTom + " | Stroh: " + hwHeu, "Wasser: " + hwWasser, "Milch: " + hwMilch, "Käse: " + hwKaese, "Mehl: " + hwMehl, "Pizza: " + hwPizza + " + Plasma-Döner", "Verkauft Waren für EUR", "Guthaben: " + creditsEUR + " EUR" }; String[] fTitleEn = { "1. Grain Field (" + int(hwKornGrow) + "%)", "2. Tomato Field (" + int(hwTomGrow) + "%)", "3. Well (" + hwWasser + ")", hwStallBuilt ? "4. Barn (" + int(hwStallWork) + "%)" : "4. Barn (15€)", hwKaeseBuilt ? "5. Creamery (" + int(hwKaeseWork) + "%)" : "5. Creamery (30€)", hwMuehleBuilt ? "6. Mill (" + int(hwMuehleWork) + "%)" : "6. Mill (25€)", "7. Pizza Oven (" + int(hwPizzaWork) + "%)", "8. Home Market", "9. Norn Village (60)" }; String[] fSubEn = { "Grain: " + hwKorn + " | Straw: " + hwHeu, "Tomatoes: " + hwTom + " | Straw: " + hwHeu, "Water: " + hwWasser, "Milk: " + hwMilch, "Cheese: " + hwKaese, "Flour: " + hwMehl, "Pizza: " + hwPizza + " + Plasma Doner", "Sells goods for EUR", "Balance: " + creditsEUR + " EUR" }; fill(over ? color(22, 98, 62) : color(16, 54, 40)); stroke(over ? color(255, 235, 55) : color(0, 235, 175)); strokeWeight(a11yMode ? 2.2 : 1.2); rect(qx, qy, qw, qh, 7); strokeWeight(1.0); fill(255); textSize(14); textAlign(CENTER, TOP); text(tr(fTitleDe[i], fTitleEn[i]), qx + qw * 0.5, qy + 24); fill(235, 248, 242); textSize(11); text(tr(fSubDe[i], fSubEn[i]), qx + qw * 0.5, qy + 64); } if (hoveredSq >= 0) runHomeworldSquareStep(hoveredSq); float sw = sin(hwWalkAnim) * 10.0; stroke(255); strokeWeight(2.2); fill(235, 185, 110); triangle(hwWalkerX - 10, hwWalkerY - 30, hwWalkerX - 18, hwWalkerY - 42, hwWalkerX - 4, hwWalkerY - 34); triangle(hwWalkerX + 10, hwWalkerY - 30, hwWalkerX + 18, hwWalkerY - 42, hwWalkerX + 4, hwWalkerY - 34); ellipse(hwWalkerX, hwWalkerY - 24, 24, 22); line(hwWalkerX, hwWalkerY - 13, hwWalkerX, hwWalkerY + 16); line(hwWalkerX, hwWalkerY - 6, hwWalkerX - 14, hwWalkerY + 8 + sw); line(hwWalkerX, hwWalkerY - 6, hwWalkerX + 14, hwWalkerY + 8 - sw); line(hwWalkerX, hwWalkerY + 16, hwWalkerX - 10, hwWalkerY + 38 - sw); line(hwWalkerX, hwWalkerY + 16, hwWalkerX + 10, hwWalkerY + 38 + sw); strokeWeight(1.0); } drawNavBtn(int(width * 0.5 - 150), height - 62, 300, 34, tr("← ZURÜCK ZUM MIKROKOSMOS [1]", "← BACK TO MICRO-COSMOS [1]"), getUiPalette(a11yMode, 3), false); } void drawHomeworldVictoryOverlay() { rectMode(CORNER); fill(4, 5, 12, 226); noStroke(); rect(0, 38, width, height - 38); int mx = 210, my = 155, mw = width - 420, mh = 360; fill(getUiPalette(a11yMode, 1)); stroke(color(0, 235, 175)); strokeWeight(2.8); rect(mx, my, mw, mh, 10); strokeWeight(1.0); fill(color(16, 105, 62)); noStroke(); rect(mx + 1, my + 1, mw - 2, 52, 9); fill(255); textSize(19); textAlign(CENTER, CENTER); text(tr("DIE NORN HABEN IHRE ERSTE HEIMATWELT!", "THE NORNS HAVE FOUNDED THEIR FIRST HOMEWORLD!"), width * 0.5, my + 27); fill(245, 250, 255); textSize(14); textAlign(CENTER, TOP); text(tr("Alle 9 Mars-Quadrate sind vollständig errichtet.\nDie Mars-Basis ist jetzt eure lebendige 0-Klick-Heimatwelt!", "All 9 Mars squares are fully constructed.\nThe Mars Base is now your living 0-Click Homeworld!"), mx + 30, my + 84, mw - 60, 180); drawNavBtn(int(width * 0.5 - 190), my + 282, 380, 48, tr("HEIMATWELT BETRETEN (0-KLICK) ▶", "ENTER HOMEWORLD (0-CLICK) ▶"), getUiPalette(a11yMode, 2), true); } // ============================================================================================== // VIEWMODE 4: ELITE-HANDELSKONTOR MIT AUTONOMEN STATIONSKASSEN (KEIN MANUELLER WÜRFELKAUF) // ============================================================================================== void drawEliteTradeMode() { rectMode(CORNER); fill(getUiPalette(a11yMode, 1)); stroke(a11yMode ? color(255, 225, 45) : color(59, 110, 194)); strokeWeight(a11yMode ? 2.0 : 1.0); rect(16, 48, width - 32, 676, 8); strokeWeight(1.0); float mult = getTradeMultiplier(); int bonusPct = int((mult - 1.0) * 100.0); fill(255); textSize(16); textAlign(LEFT, TOP); text(tr("ELITE-HANDELSKONTOR — AUTONOME STATIONS-WÜRFEL: " + tradeCubesCount + " (HANDELSBONUS: +" + bonusPct + "%)", "ELITE TRADE EXCHANGE — AUTONOMOUS STATION CUBES: " + tradeCubesCount + " (TRADE BONUS: +" + bonusPct + "%)"), 32, 60); fill(230, 240, 255); textSize(12); text(tr("Fracht: " + getCargoUsed() + "/" + cargoCap + " t | Erz: " + refinedErz + " | FP: " + researchFP + " | " + creditsEUR + " EUR · Würfel werden automatisch aus Stationskassen (Spieler- & NPC-Handel) gebaut!", "Cargo: " + getCargoUsed() + "/" + cargoCap + " t | Ore: " + refinedErz + " | RP: " + researchFP + " | " + creditsEUR + " EUR · Cubes are auto-financed by station treasuries!"), 32, 84); // Übersicht der 5 autonomen Stationskassen String[] sShort = { "Alpha (Erz)", "Beta (FP)", "Gamma (Erz+FP)", "Delta (Erz)", "Epsilon (Erz+FP)" }; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); int sx = 32 + i * 212, sy = 112, sw = 204, sh = 98; fill(14, 19, 32); stroke(a11yMode ? color(255, 225, 45) : st.accentCol); strokeWeight(1.5); rect(sx, sy, sw, sh, 6); strokeWeight(1.0); fill(255); textSize(12); textAlign(LEFT, TOP); text(sShort[i], sx + 10, sy + 8); fill(255, 225, 55); textSize(11); text(tr("Würfel: ", "Cubes: ") + st.stationCubes, sx + 130, sy + 8); fill(215, 228, 248); textSize(10); text(tr("Kasse: ", "Treasury: ") + int(st.treasuryEUR) + " / " + int(st.getNextCubeCost()) + " EUR", sx + 10, sy + 30); text(tr("Netto-Marge: ", "Net Margin: ") + int(st.getProfitRetentionFactor() * 100) + "%", sx + 10, sy + 46); fill(6, 10, 18); noStroke(); rect(sx + 10, sy + 68, sw - 20, 14, 3); fill(st.accentCol); rect(sx + 10, sy + 68, constrain(map(st.treasuryEUR, 0, st.getNextCubeCost(), 0, sw - 20), 0, sw - 20), 14, 3); } for (int g = 0; g < 4; g++) { int ry = 226 + g * 108; fill(16, 21, 34); stroke(a11yMode ? color(175, 200, 240) : color(59, 110, 194)); strokeWeight(a11yMode ? 1.8 : 1.0); rect(32, ry, width - 64, 94, 6); strokeWeight(1.0); int sellPrice = int(goodBasePrice[g] * mult), buyPrice = max(8, int(goodBasePrice[g] * 0.72)); fill(255); textSize(14); textAlign(LEFT, TOP); text(tr(goodNameDe[g], goodNameEn[g]) + " [" + cargoQty[g] + " t]", 48, ry + 12); fill(225, 238, 255); textSize(12); text(tr("Synthese: " + (devModeActive ? "0 (DEV)" : (goodOreCost[g] + " Erz + " + goodFpCost[g] + " FP")) + " | Kauf: " + (devModeActive ? "0 EUR (DEV)" : (buyPrice + " EUR")) + " | Verkauf: +" + sellPrice + " EUR (+Stationskasse)", "Synthesize: " + (devModeActive ? "0 (DEV)" : (goodOreCost[g] + " Ore + " + goodFpCost[g] + " RP")) + " | Buy: " + (devModeActive ? "0 EUR (DEV)" : (buyPrice + " EUR")) + " | Sell: +" + sellPrice + " EUR (+Station Treasury)"), 48, ry + 42); boolean canSynth = (getCargoUsed() < cargoCap) && (devModeActive || (refinedErz >= goodOreCost[g] && researchFP >= goodFpCost[g])); boolean canBuy = (getCargoUsed() < cargoCap) && (devModeActive || creditsEUR >= buyPrice); boolean canSell = (cargoQty[g] > 0); drawNavBtn(width - 540, ry + 24, 160, 44, tr("Synthese (-Erz/-FP)", "Synthesize (-Ore/-RP)"), canSynth ? getUiPalette(a11yMode, 3) : color(36, 44, 64), canSynth); drawNavBtn(width - 370, ry + 24, 155, 44, tr("Kaufen (-" + (devModeActive ? 0 : buyPrice) + " EUR)", "Buy (-" + (devModeActive ? 0 : buyPrice) + " EUR)"), canBuy ? color(0, 72, 145) : color(36, 44, 64), canBuy); drawNavBtn(width - 205, ry + 24, 155, 44, tr("Verkaufen (+" + sellPrice + " EUR)", "Sell (+" + sellPrice + " EUR)"), canSell ? getUiPalette(a11yMode, 2) : color(36, 44, 64), canSell); } drawNavBtn(int(width * 0.5 - 150), height - 66, 300, 34, tr("← ZURÜCK ZUM MIKROKOSMOS [1]", "← BACK TO MICRO-COSMOS [1]"), getUiPalette(a11yMode, 3), false); } void drawTechTreeMode() { rectMode(CORNER); fill(getUiPalette(a11yMode, 1)); stroke(a11yMode ? color(255, 225, 45) : color(59, 110, 194)); strokeWeight(a11yMode ? 2.0 : 1.0); rect(16, 48, width - 32, 676, 8); strokeWeight(1.0); fill(255); textSize(16); textAlign(LEFT, TOP); text(tr("NORN-FORSCHUNGSBAUM — FP: " + researchFP + " | " + creditsEUR + " EUR", "NORN RESEARCH TREE — RP: " + researchFP + " | " + creditsEUR + " EUR"), 32, 62); drawNavBtn(width - 420, 58, 195, 28, (freeTechMode || devModeActive) ? tr("Freies Klicken [M]: AN", "Free Click [M]: ON") : tr("FP-Kosten [M]: AN", "RP Cost [M]: ON"), (freeTechMode || devModeActive) ? color(20, 125, 75) : getUiPalette(a11yMode, 2), freeTechMode || devModeActive); drawNavBtn(width - 215, 58, 185, 28, tr("30 EUR -> +25 FP", "30 EUR -> +25 RP"), getUiPalette(a11yMode, 3), devModeActive || creditsEUR >= 30); for (int i = 0; i < NUM_TECH; i++) { float nx = 32 + tBranchId[i] * 268, ny = 108 + tTier[i] * 195, nw = 252, nh = 176; boolean unlocked = freeTechMode || devModeActive || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int lvl = tLevel[i]; fill(lvl > 0 ? color(18, 32, 54) : color(14, 18, 28)); stroke(lvl > 0 ? getUiPalette(a11yMode, 4) : (a11yMode ? color(150, 175, 215) : color(55, 68, 95))); strokeWeight(lvl > 0 && a11yMode ? 2.2 : 1.0); rect(nx, ny, nw, nh, 6); strokeWeight(1.0); fill(255); textSize(12); textAlign(LEFT, TOP); text(tCode[i] + " · " + tr(tBranchDe[i], tBranchEn[i]), nx + 10, ny + 8); textAlign(RIGHT, TOP); text(tr("Stufe ", "Level ") + lvl + "/3", nx + nw - 10, ny + 8); textAlign(LEFT, TOP); textSize(13); text(tr(tTitleDe[i], tTitleEn[i]), nx + 10, ny + 30, nw - 20, 36); fill(225, 238, 255); textSize(11); text(tr(tDescDe[i], tDescEn[i]), nx + 10, ny + 68, nw - 20, 62); int cost = tCost[i] * (lvl + 1); if (lvl >= 3) drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, "✓ MAX (3/3)", color(16, 105, 62), true); else if (!unlocked) drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, tr("Benötigt ", "Requires ") + tCode[tPrereq[i]], color(36, 44, 64), false); else { boolean canBuyTech = (freeTechMode || devModeActive || researchFP >= cost); drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, (freeTechMode || devModeActive) ? ("-> St. " + (lvl + 1) + " (0 FP)") : (cost + " FP"), canBuyTech ? getUiPalette(a11yMode, 2) : color(40, 48, 68), canBuyTech); } } } void drawIsometricBaseMode() { rectMode(CORNER); fill(getUiPalette(a11yMode, 1)); stroke(a11yMode ? color(255, 225, 45) : color(59, 110, 194)); strokeWeight(a11yMode ? 2.0 : 1.0); rect(16, 48, width - 32, 676, 8); strokeWeight(1.0); fill(255); textSize(15); textAlign(LEFT, TOP); text(tr("3D-RAUMBASIS — ERZ-WÜRFEL: " + erzCubesCount + " | FORSCHUNG: " + fpCubesCount + " | STATIONS-WÜRFEL: " + tradeCubesCount, "3D SPACE BASE — ORE CUBES: " + erzCubesCount + " | RESEARCH: " + fpCubesCount + " | STATION CUBES: " + tradeCubesCount), 32, 62); drawNavBtn(width - 165, 58, 135, 30, tr("Drehen [Q/E]", "Rotate [Q/E]"), getUiPalette(a11yMode, 3), false); float originX = width * 0.5, originY = 230.0, hw = 22.0, hh = 11.0, ch = 22.0; stroke(a11yMode ? color(120, 150, 200) : color(55, 72, 105)); for (int i = 0; i <= BASE_DIM; i++) { line(originX + (0 - i) * hw, originY + (0 + i) * hh, originX + (BASE_DIM - i) * hw, originY + (BASE_DIM + i) * hh); line(originX + (i - 0) * hw, originY + (i + 0) * hh, originX + (i - BASE_DIM) * hw, originY + (i + BASE_DIM) * hh); } for (int z = 0; z < BASE_HEIGHT; z++) for (int py = 0; py < BASE_DIM; py++) for (int px = 0; px < BASE_DIM; px++) { int vx = (isoRotation == 1) ? py : ((isoRotation == 2) ? BASE_DIM - 1 - px : ((isoRotation == 3) ? BASE_DIM - 1 - py : px)); int vy = (isoRotation == 1) ? BASE_DIM - 1 - px : ((isoRotation == 2) ? BASE_DIM - 1 - py : ((isoRotation == 3) ? px : py)); int vType = getBaseVoxel(vx, vy, z); if (vType > 0) { int cubeCol = a11yMode ? ((vType == 1) ? color(255, 165, 0) : ((vType == 2) ? color(86, 195, 255) : color(0, 235, 175))) : ((vType == 1) ? color(210, 42, 74) : ((vType == 2) ? color(65, 155, 255) : color(250, 195, 45))); drawIsoCubeSolid(originX + (px - py) * hw, originY + (px + py) * hh - z * ch, hw, hh, ch, cubeCol); } } drawNavBtn(int(width * 0.5 - 170), height - 66, 340, 36, tr("BASIS JETZT IN 3D BEGEHEN [V] >>", "WALK INSIDE 3D BASE NOW [V] >>"), getUiPalette(a11yMode, 2), true); } void drawIsoCubeSolid(float sx, float sy, float hw, float hh, float ch, int c) { stroke(a11yMode ? color(0) : color(12, 16, 26)); fill(c); beginShape(); vertex(sx, sy); vertex(sx + hw, sy + hh); vertex(sx, sy + 2 * hh); vertex(sx - hw, sy + hh); endShape(CLOSE); fill(red(c) * 0.75, green(c) * 0.75, blue(c) * 0.75); beginShape(); vertex(sx - hw, sy + hh); vertex(sx, sy + 2 * hh); vertex(sx, sy + 2 * hh + ch); vertex(sx - hw, sy + hh + ch); endShape(CLOSE); fill(red(c) * 0.52, green(c) * 0.52, blue(c) * 0.52); beginShape(); vertex(sx, sy + 2 * hh); vertex(sx + hw, sy + hh); vertex(sx + hw, sy + hh + ch); vertex(sx, sy + 2 * hh + ch); endShape(CLOSE); } void enterWalk3DBaseMode() { viewMode = 3; walkX = 7.5; walkY = 7.5; walkDirX = 1.0; walkDirY = 0.0; walkPlaneX = 0.0; walkPlaneY = 0.66; } void drawWalk3DBaseMode() { rectMode(CORNER); int startX = 340, viewW = width - startX, viewH = height - 38, topY = 38; float spd = 0.065; if (keyTurnL) rotateWalkCam(-0.045); if (keyTurnR) rotateWalkCam(0.045); if (keyW) { if (!isWalkWall(int(walkX + walkDirX * spd), int(walkY))) walkX += walkDirX * spd; if (!isWalkWall(int(walkX), int(walkY + walkDirY * spd))) walkY += walkDirY * spd; } if (keyS) { if (!isWalkWall(int(walkX - walkDirX * spd), int(walkY))) walkX -= walkDirX * spd; if (!isWalkWall(int(walkX), int(walkY - walkDirY * spd))) walkY -= walkDirY * spd; } if (keyA) { float sx = walkDirY, sy = -walkDirX; if (!isWalkWall(int(walkX + sx * spd), int(walkY))) walkX += sx * spd; if (!isWalkWall(int(walkX), int(walkY + sy * spd))) walkY += sy * spd; } if (keyD) { float sx = -walkDirY, sy = walkDirX; if (!isWalkWall(int(walkX + sx * spd), int(walkY))) walkX += sx * spd; if (!isWalkWall(int(walkX), int(walkY + sy * spd))) walkY += sy * spd; } noStroke(); fill(18, 6, 12); rect(startX, topY, viewW, viewH / 2); fill(10, 16, 30); rect(startX, topY + viewH / 2, viewW, viewH / 2); for (int x = 0; x < viewW; x++) { float camXNorm = 2.0 * x / float(viewW) - 1.0, rdx = walkDirX + walkPlaneX * camXNorm, rdy = walkDirY + walkPlaneY * camXNorm; int mapX = int(walkX), mapY = int(walkY); float ddx = (rdx == 0.0) ? 1e30 : abs(1.0 / rdx), ddy = (rdy == 0.0) ? 1e30 : abs(1.0 / rdy); int stepX = (rdx < 0) ? -1 : 1, stepY = (rdy < 0) ? -1 : 1; float sdx = (rdx < 0) ? (walkX - mapX) * ddx : (mapX + 1.0 - walkX) * ddx, sdy = (rdy < 0) ? (walkY - mapY) * ddy : (mapY + 1.0 - walkY) * ddy; int hit = 0, side = 0, wallType = 0, guard = 0; while (hit == 0 && guard < 40) { guard++; if (sdx < sdy) { sdx += ddx; mapX += stepX; side = 0; } else { sdy += ddy; mapY += stepY; side = 1; } if (mapX <= 0 || mapX >= BASE_DIM - 1 || mapY <= 0 || mapY >= BASE_DIM - 1) { hit = 1; wallType = 4; } else { int v = getBaseVoxel(mapX, mapY, 0); if (v > 0) { hit = 1; wallType = v; } } } float distW = (side == 0) ? max(0.08, (mapX - walkX + (1 - stepX) * 0.5) / rdx) : max(0.08, (mapY - walkY + (1 - stepY) * 0.5) / rdy); int lh = int(viewH / distW), y0 = max(0, -lh / 2 + viewH / 2), y1 = min(viewH - 1, lh / 2 + viewH / 2); int col = a11yMode ? ((wallType == 1) ? color(255, 165, 0) : ((wallType == 2) ? color(86, 195, 255) : ((wallType == 3) ? color(0, 235, 175) : color(180, 195, 220)))) : ((wallType == 1) ? color(210, 42, 74) : ((wallType == 2) ? color(65, 155, 255) : ((wallType == 3) ? color(250, 195, 45) : color(110, 125, 150)))); float shade = constrain(1.0 / (1.0 + distW * 0.16), 0.28, 1.0) * ((side == 1) ? 0.72 : 1.0); fill(red(col) * shade, green(col) * shade, blue(col) * shade); rect(startX + x, topY + y0, 1, max(1, y1 - y0 + 1)); } fill(getUiPalette(a11yMode, 1)); noStroke(); rect(0, topY, startX, viewH); stroke(getUiPalette(a11yMode, 4)); line(startX, topY, startX, height); fill(255); textSize(15); textAlign(LEFT, TOP); text(tr("3D-BASIS BEGEHUNG", "3D BASE WALKTHROUGH"), 16, topY + 14); fill(230, 240, 255); textSize(12); text(tr("Erz-Blöcke: " + erzCubesCount + " · FP-Blöcke: " + fpCubesCount + "\nStations-Würfel: " + tradeCubesCount + "\n\n[W/A/S/D] Laufen · [Maus/Pfeile] Drehen", "Ore Blocks: " + erzCubesCount + " · RP Blocks: " + fpCubesCount + "\nStation Cubes: " + tradeCubesCount + "\n\n[W/A/S/D] Move · [Mouse/Arrows] Turn"), 16, topY + 44); drawNavBtn(24, height - 62, 290, 38, tr("← ZURÜCK ZUM RAUMSCHIFF [1]", "← BACK TO STARSHIP [1]"), getUiPalette(a11yMode, 2), false); } boolean isWalkWall(int gx, int gy) { return (gx <= 0 || gx >= BASE_DIM - 1 || gy <= 0 || gy >= BASE_DIM - 1) || (getBaseVoxel(gx, gy, 0) > 0); } void rotateWalkCam(float rot) { float od = walkDirX; walkDirX = walkDirX * cos(rot) - walkDirY * sin(rot); walkDirY = od * sin(rot) + walkDirY * cos(rot); float op = walkPlaneX; walkPlaneX = walkPlaneX * cos(rot) - walkPlaneY * sin(rot); walkPlaneY = op * sin(rot) + walkPlaneY * cos(rot); } void syncNornLobby() { try { String stParam = ""; for (int i = 0; i < spaceStations.size(); i++) { SpaceStation st = (SpaceStation) spaceStations.get(i); if (i > 0) stParam += ","; stParam += st.stationCubes + "," + int(st.treasuryEUR); } String[] lines = loadStrings("norn_lobby.php?action=sync&cid=" + myClientId + "&x=" + nf(shipX, 1, 1) + "&y=" + nf(shipY, 1, 1) + "&a=" + nf(shipAngle, 1, 2) + "&m=" + viewMode + "&ec=" + erzCubesCount + "&fc=" + fpCubesCount + "&tc=" + tradeCubesCount + "&st=" + stParam); if (lines == null) return; for (int i = 0; i < lines.length; i++) { String line = trim(lines[i]); int eq = line.indexOf('='); if (eq <= 0) continue; String k = line.substring(0, eq), v = line.substring(eq + 1); if (k.equals("STATUS") && v.equals("OK")) lobbyOnline = true; else if (k.equals("ONLINE")) onlinePlayers = int(v); else if (k.equals("ERZ_CUBES")) { int rE = int(v); while (erzCubesCount < rE) { erzCubesCount++; growVoxelCubeInBase(1); } } else if (k.equals("FP_CUBES")) { int rF = int(v); while (fpCubesCount < rF) { fpCubesCount++; growVoxelCubeInBase(2); } } else if (k.equals("TRADE_CUBES")) { int rT = int(v); while (tradeCubesCount < rT) { tradeCubesCount++; growVoxelCubeInBase(3); } } else if (k.equals("STATIONS")) { String[] stParts = split(v, ','); if (stParts != null && stParts.length >= 10) { for (int s = 0; s < spaceStations.size(); s++) { SpaceStation st = (SpaceStation) spaceStations.get(s); int rC = int(stParts[s * 2]), rT = int(stParts[s * 2 + 1]); if (rC > st.stationCubes) { st.stationCubes = rC; st.treasuryEUR = rT; } else if (rC == st.stationCubes && rT > st.treasuryEUR) st.treasuryEUR = rT; } } } else if (k.equals("PEERS")) { remotePeers.clear(); if (v.length() > 2) { String[] entries = split(v, ';'); for (int p = 0; p < entries.length; p++) { String[] c = split(entries[p], ','); if (c != null && c.length >= 4) remotePeers.add(new RemotePeer(float(c[0]), float(c[1]), float(c[2]), int(c[3]))); } } } } } catch (Exception e) {} } class VacuumQuantum { float x, y; VacuumQuantum(float qx, float qy) { x = qx; y = qy; } } class SingularityRift { float x, y, phase; SingularityRift(float rx, float ry) { x = rx; y = ry; phase = random(TWO_PI); } } class BosonShot { float x, y, vx, vy; int kind, life; BosonShot(float sx, float sy, float svx, float svy, int k) { x = sx; y = sy; vx = svx; vy = svy; kind = k; life = 110; } } class ShockRing { float x, y, r; int col, alpha; ShockRing(float rx, float ry, int c) { x = rx; y = ry; r = 12.0; col = c; alpha = 235; } } class FloatingTag { float x, y; String txt; int col, life; FloatingTag(float fx, float fy, String t, int c) { x = fx; y = fy; txt = t; col = c; life = 255; } } class RemotePeer { float x, y, angle; int mode; RemotePeer(float px, float py, float pa, int pm) { x = px; y = py; angle = pa; mode = pm; } } void mouseMoved() { if (languageChosen && viewMode == 0 && getNormMouseY() > 38 && getNormMouseY() < height - 130) mouseSteer = true; } void mousePressed() { if (devPopupTimer > 0) { devPopupTimer = 0; return; } float mx = getNormMouseX(), my = getNormMouseY(); if (!languageChosen) { int bx = 200, by = 110; if (my >= by + 350 && my <= by + 412) { if (mx >= bx + 35 && mx <= bx + 340) { langMode = 0; languageChosen = true; setWelcomeBanner(); return; } if (mx >= bx + 380 && mx <= bx + 685) { langMode = 1; languageChosen = true; setWelcomeBanner(); return; } } if (my >= by + 430 && my <= by + 468) { if (mx >= bx + 35 && mx <= bx + 340) { languageChosen = true; loadSavedGameSlot(); return; } if (mx >= bx + 380 && mx <= bx + 685) { toggleGlobalA11yMode(); return; } } return; } if (showHomeworldBanner) { if (mx >= width * 0.5 - 190 && mx <= width * 0.5 + 190 && my >= 437 && my <= 485) { showHomeworldBanner = false; viewMode = 5; } return; } if (my <= 38) { if (mx >= 6 && mx <= 84) { viewMode = 0; return; } if (mx >= 88 && mx <= 184) { viewMode = 5; return; } if (mx >= 188 && mx <= 282){ viewMode = 6; return; } if (mx >= 286 && mx <= 368){ viewMode = 1; return; } if (mx >= 372 && mx <= 456){ viewMode = 4; return; } if (mx >= 460 && mx <= 552){ viewMode = 2; return; } if (mx >= 556 && mx <= 630){ enterWalk3DBaseMode(); return; } if (mx >= 634 && mx <= 698){ saveCurrentGameSlot(); return; } if (mx >= 702 && mx <= 760){ loadSavedGameSlot(); return; } if (mx >= 912 && mx <= 960){ langMode = (langMode + 1) % 2; setWelcomeBanner(); return; } if (mx >= 964 && mx <= 1114){ toggleGlobalA11yMode(); return; } return; } // VIEWMODE 6: ATOM-KONSTRUKTOR KLICKS if (viewMode == 6) { if (mx >= 44 && mx <= 180 && my >= 120 && my <= 152) { labBuildMode = 0; return; } if (mx >= 190 && mx <= 326 && my >= 120 && my <= 152){ labBuildMode = 1; return; } if (mx >= 44 && mx <= 326) { if (my >= 168 && my <= 208) { addLabParticle(1); return; } if (my >= 218 && my <= 258) { addLabParticle(2); return; } if (my >= 268 && my <= 308) { addLabParticle(3); return; } if (my >= 320 && my <= 352) { labExpertMatrix = !labExpertMatrix; return; } if (my >= 500 && my <= 548) { releaseConstructedAtomToCosmos(); return; } if (my >= 560 && my <= 594) { labProtons = 1; labNeutrons = 1; labElectrons = 1; return; } if (my >= 656 && my <= 692) { viewMode = 0; return; } } return; } if (viewMode == 5) { if (!marsHomeworldUnlocked) { for (int i = 0; i < 9; i++) { int qx = getMarsMenuCardX(i), qy = getMarsMenuCardY(i), qw = 340, qh = 156; if (mx >= qx && mx <= qx + qw && my >= qy && my <= qy + qh && marsPadProg[i] < 100.0) { if (canDeliverToMarsSquare(i)) { if (!devModeActive) { int gA = marsReqGoodA[i], gB = marsReqGoodB[i]; cargoQty[gA]--; if (gB >= 0) cargoQty[gB]--; else refinedErz -= 10; } deliverProductsToMarsSquare(i, tr("NORN", "NORN"), 25.0); } else viewMode = 4; return; } } } if (my >= height - 62 && my <= height - 28 && mx >= width * 0.5 - 150 && mx <= width * 0.5 + 150) viewMode = 0; return; } if (viewMode == 1) { if (mx >= width - 420 && mx <= width - 225 && my >= 58 && my <= 86) { freeTechMode = !freeTechMode; return; } if (mx >= width - 215 && mx <= width - 30 && my >= 58 && my <= 86) { if (devModeActive || creditsEUR >= 30) { if (!devModeActive) creditsEUR -= 30; addResearchFP(25); } return; } for (int i = 0; i < NUM_TECH; i++) { float nx = 32 + tBranchId[i] * 268, ny = 108 + tTier[i] * 195; if (mx >= nx && mx <= nx + 252 && my >= ny && my <= ny + 176) { boolean unlocked = freeTechMode || devModeActive || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int cost = tCost[i] * (tLevel[i] + 1); if (unlocked && tLevel[i] < 3 && (freeTechMode || devModeActive || researchFP >= cost)) { if (!freeTechMode && !devModeActive) researchFP -= cost; tLevel[i]++; recalcShipCapabilities(); if (i == 6) hullHP = min(maxHullHP, hullHP + 45); } return; } } return; } if (viewMode == 4) { float mult = getTradeMultiplier(); SpaceStation activeSt = getActiveOrNearestStation(); for (int g = 0; g < 4; g++) { int ry = 226 + g * 108; if (my >= ry + 24 && my <= ry + 68) { int sellPrice = int(goodBasePrice[g] * mult), buyPrice = max(8, int(goodBasePrice[g] * 0.72)); if (mx >= width - 540 && mx <= width - 380 && getCargoUsed() < cargoCap && (devModeActive || (refinedErz >= goodOreCost[g] && researchFP >= goodFpCost[g]))) { if (!devModeActive) { refinedErz -= goodOreCost[g]; researchFP -= goodFpCost[g]; } cargoQty[g]++; activeSt.addTradeRevenue(goodOreCost[g] * 0.8, "SYNTH"); return; } if (mx >= width - 370 && mx <= width - 215 && getCargoUsed() < cargoCap && (devModeActive || creditsEUR >= buyPrice)) { if (!devModeActive) creditsEUR -= buyPrice; cargoQty[g]++; activeSt.addTradeRevenue(buyPrice * 0.45, "BUY"); return; } if (mx >= width - 205 && mx <= width - 50 && cargoQty[g] > 0) { cargoQty[g]--; creditsEUR += sellPrice; activeSt.addTradeRevenue(sellPrice * 0.45, "SELL"); return; } } } if (my >= height - 66 && my <= height - 32 && mx >= width * 0.5 - 150 && mx <= width * 0.5 + 150) viewMode = 0; return; } if (viewMode == 2) { if (my >= 58 && my <= 88 && mx >= width - 165 && mx <= width - 30) { isoRotation = (isoRotation + 1) % 4; return; } if (my >= height - 66 && my <= height - 30 && mx >= width * 0.5 - 170 && mx <= width * 0.5 + 170) { enterWalk3DBaseMode(); return; } return; } if (viewMode == 3) { if (mx >= 24 && mx <= 314 && my >= height - 62 && my <= height - 24) viewMode = 0; return; } int hudTop = height - 130; if (my >= hudTop) { if (my >= hudTop + 30 && my <= hudTop + 56) { if (mx >= 16 && mx <= 118) activeWeapon = 1; else if (mx >= 122 && mx <= 224) activeWeapon = 2; else if (mx >= 228 && mx <= 330) activeWeapon = 3; else if (mx >= 334 && mx <= 436) activeWeapon = 4; else if (mx >= 440 && mx <= 542) activeWeapon = 5; else if (mx >= 548 && mx <= 650) zeroClick = !zeroClick; else if (mx >= 655 && mx <= 763) viewMode = 6; else if (mx >= 768 && mx <= 870) viewMode = 5; else if (mx >= 875 && mx <= 977) viewMode = 4; } return; } if (my > 38 && my < hudTop && mouseButton == LEFT) fireActiveWeapon(); } void mouseDragged() { if (languageChosen && viewMode == 3 && getNormMouseX() > 340) rotateWalkCam(-(getNormMouseX() - pmouseX) * 0.012); } void keyPressed() { if (key == 'c' || key == 'C') keyCHeld = true; if (!languageChosen) { if (key == '1' || key == 'd' || key == 'D') { langMode = 0; languageChosen = true; setWelcomeBanner(); } if (key == '2' || key == 'e' || key == 'E') { langMode = 1; languageChosen = true; setWelcomeBanner(); } if (key == 'o' || key == 'O') { languageChosen = true; loadSavedGameSlot(); } if (key == 'h' || key == 'H') toggleGlobalA11yMode(); return; } if (key == ' ') { if (devPopupTimer > 0) { devPopupTimer = 0; return; } if (showHomeworldBanner) { showHomeworldBanner = false; viewMode = 5; return; } drivesActive = !drivesActive; spawnFloatingTag(shipX, shipY - 26, drivesActive ? tr("Antrieb AN", "Drives ON") : tr("Antrieb AUS", "Drives OFF"), drivesActive ? color(0, 255, 180) : color(255, 180, 60)); return; } if (key == '1') { if (viewMode != 0) viewMode = 0; else activeWeapon = 1; } if (key == '2') activeWeapon = 2; if (key == '3') activeWeapon = 3; if (key == '4') activeWeapon = 4; if (key == '5') activeWeapon = 5; if (key == '0') zeroClick = !zeroClick; if (key == 'k' || key == 'K') saveCurrentGameSlot(); if (key == 'o' || key == 'O') loadSavedGameSlot(); if (key == 'r' || key == 'R') viewMode = (viewMode == 5) ? 0 : 5; if (key == 'n' || key == 'N') viewMode = (viewMode == 6) ? 0 : 6; if (key == 't' || key == 'T') viewMode = (viewMode == 1) ? 0 : 1; if (key == 'g' || key == 'G') viewMode = (viewMode == 4) ? 0 : 4; if (key == 'b' || key == 'B') viewMode = (viewMode == 2) ? 0 : 2; if (key == 'v' || key == 'V') { if (viewMode == 3) viewMode = 0; else enterWalk3DBaseMode(); } if (key == 'm' || key == 'M') freeTechMode = !freeTechMode; if (key == 'q' || key == 'Q') isoRotation = (isoRotation + 3) % 4; if (key == 'e' || key == 'E') isoRotation = (isoRotation + 1) % 4; if (key == 'l' || key == 'L') { langMode = (langMode + 1) % 2; setWelcomeBanner(); } if (key == 'h' || key == 'H') toggleGlobalA11yMode(); if (key == 'w' || key == 'W') keyW = true; if (key == 's' || key == 'S') keyS = true; if (key == 'a' || key == 'A') keyA = true; if (key == 'd' || key == 'D') keyD = true; if (key == CODED) { if (keyCode == UP) keyW = true; if (keyCode == DOWN) keyS = true; if (keyCode == LEFT) keyTurnL = true; if (keyCode == RIGHT) keyTurnR = true; } } void keyReleased() { if (key == 'c' || key == 'C') keyCHeld = false; if (key == 'w' || key == 'W') keyW = false; if (key == 's' || key == 'S') keyS = false; if (key == 'a' || key == 'A') keyA = false; if (key == 'd' || key == 'D') keyD = false; if (key == CODED) { if (keyCode == UP) keyW = false; if (keyCode == DOWN) keyS = false; if (keyCode == LEFT) keyTurnL = false; if (keyCode == RIGHT) keyTurnR = false; } }