/** * ============================================================================================== * Modul: DTIM-ZEC NORN ATOM-STARSHIP SANDBOX (STAGE-2 EXPANSION + INTEGRATED TECH-TREE) * Datei: TLW_Atom_Starship_Norn.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Copyright: (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * Lizenz: MIT License * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * Steuerung: [Maus bewegen] Kurs & Auto-Aim | [Linksklick / Space] Waffe [1-5] abfeuern * [1] Photon | [2] Gluon | [3] W-Boson | [4] Elektron | [5] Mesonenkanone * [T] Norn-Forschungsbaum öffnen | [0] 0-Klick-Steuerung AN/AUS | [F] Station * [H] Sehhilfe (DTIM Standard / Farbenblind / Max-Kontrast) * ============================================================================================== */ // ============================================================================================== // MODUL 1: WELT-, SCHIFFS- & TECH-TREE-VARIABLEN (100% PROCESSING.JS-SICHER) // ============================================================================================== float WORLD_SIZE = 3200.0; float HALF_WORLD = 1600.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; // Ressourcen, Chargo, Waste & Forschungspunkte int foldBattery = 15; // 0 .. 100 % int researchFP = 45; // Forschungspunkte für den integrierten Tech-Tree int hullHP = 100; int maxHullHP = 100; int chargoLoad = 1; // Gesammelte Isotope im Frachtraum int chargoMax = 6; int wasteEntropy = 0; // Entropie-Abfall (durch Plasma-Synthesizer in FP umwandelbar) int score = 0; float simTime = 0.0; // Tech-Tree Ausbaustufen (0..3) — direkt gekoppelt an Schiffs-Eigenschaften! int lvlDrive = 1; // Gitter-Antrieb & YBCO-Ring int lvlMeson = 1; // Mesonenkanone [5] int lvlArmor = 0; // CNT-Panzerung & Zeno-Schild int lvlTraktor = 1; // Quanten-Traktorstrahl & Chargo-Kompressor int lvlNornSynth = 1; // Norn-Biochemie & Plasma-Synthesizer (Waste -> FP) boolean freeTechClick = false; boolean techModalOpen = false; // Steuerung & Modi int activeWeapon = 5; // Startet direkt mit Mesonenkanone [5] boolean autoAim = true; boolean zeroClickMode = false; // 0-Klick-Modus [0]: Zielen, Traktor & Feuern ohne Klicken! int autoFireCooldown = 0; float aimAngle = 0.0; float currentShotEv = 10.20; MicroAtom lockedTarget = null; String sensorLabel = "Norn-Sensoren aktiv"; // Andock-Stationen float reactorX = 640.0; float reactorY = -580.0; float vaultX = -640.0; float vaultY = 580.0; float dockRadius = 98.0; int dockedAt = 0; float repairAcc = 0.0; // Schockwelle float shockX = 0.0, shockY = 0.0, shockRadius = 0.0, shockIntensity = 0.0; ArrayList worldQuanta; ArrayList worldRifts; ArrayList worldAtoms; ArrayList worldShots; ArrayList worldRings; boolean keyUp = false, keyDown = false, keyLeft = false, keyRight = false; boolean mouseSteer = true; int a11yTheme = 0; boolean gameOver = false; boolean missionWon = false; String sectorName = "SEKTOR I (NW): WASSERSTOFF-NEBEL"; String logHead = "Norn-Crew bereit: Teste die Mesonenkanone [5] oder öffne den Forschungsbaum [T]!"; String logSub = "[0] aktiviert 0-Klick-Steuerung | [F] wandelt Isotope an Reaktor/Speicher um"; int logTimer = 0; // ============================================================================================== // FARB-PALETTEN & FORMELN // ============================================================================================== int getUiPalette(int theme, int role) { if (theme == 1) { if (role == 0) return color(5, 9, 17); if (role == 1) return color(11, 17, 29); if (role == 2) return color(180, 120, 10); if (role == 3) return color(10, 75, 130); if (role == 4) return color(251, 191, 36); return color(255, 255, 255); } if (theme == 2) { if (role == 0) return color(0, 0, 0); if (role == 1) return color(0, 0, 0); if (role == 2) return color(0, 0, 0); if (role == 3) return color(0, 0, 0); if (role == 4) return color(255, 255, 0); 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 getEntityColor(int theme, int kind) { // 1=Proton, 2=Neutron, 3=Elektron, 4=Photon, 5=Gluon, 6=W-Boson, 7=Quantum, 8=Rift, 9=Meson if (theme == 1) { if (kind == 9) return color(251, 191, 36); if (kind == 7) return color(52, 211, 153); if (kind == 8) return color(244, 114, 182); return color(56, 189, 248); } if (theme == 2) { if (kind == 8) return color(255, 0, 255); if (kind == 7) return color(0, 255, 255); return color(255, 255, 0); } if (kind == 1) return color(220, 42, 74); if (kind == 2) return color(185, 198, 220); if (kind == 3) return color(65, 145, 255); if (kind == 4) return color(255, 215, 55); if (kind == 5) return color(35, 215, 155); if (kind == 6) return color(205, 85, 235); if (kind == 7) return color(0, 255, 180); if (kind == 8) return color(255, 45, 65); return color(255, 130, 50); // Mesonen-Strahl: Leucht-Orange/Blutrot } float calcShellEnergyEv(int Z, int electrons, int n) { if (Z <= 0) return -1.5; float zEff = (electrons <= 2) ? max(1.0, float(Z) - 0.30 * float(electrons - 1)) : max(1.15, float(Z) - 0.85 * float(electrons - 1)); return -13.6 * (zEff * zEff) / float(n * n); } void pushLog(String h, String s) { logHead = h; logSub = s; logTimer = 95; } // ============================================================================================== // INITIALISIERUNG // ============================================================================================== void setup() { size(1060, 720); noSmooth(); frameRate(60); worldQuanta = new ArrayList(); worldRifts = new ArrayList(); worldAtoms = new ArrayList(); worldShots = new ArrayList(); worldRings = new ArrayList(); resetNornMission(); } void resetNornMission() { shipX = 0.0; shipY = 0.0; shipVX = 0.0; shipVY = 0.0; shipAngle = 0.0; camX = 0.0; camY = 0.0; foldBattery = 15; researchFP = 45; lvlDrive = 1; lvlMeson = 1; lvlArmor = 0; lvlTraktor = 1; lvlNornSynth = 1; recalcShipStats(); hullHP = maxHullHP; chargoLoad = 1; wasteEntropy = 0; score = 0; gameOver = false; missionWon = false; worldQuanta.clear(); worldRifts.clear(); worldAtoms.clear(); worldShots.clear(); worldRings.clear(); for (int i = 0; i < 38; i++) { worldQuanta.add(new VacuumQuantum(random(-HALF_WORLD + 120, HALF_WORLD - 120), random(-HALF_WORLD + 120, HALF_WORLD - 120))); } for (int i = 0; i < 24; i++) { float rx = random(-HALF_WORLD + 160, HALF_WORLD - 160); float ry = random(-HALF_WORLD + 160, HALF_WORLD - 160); if (dist(0, 0, rx, ry) > 260.0 && dist(reactorX, reactorY, rx, ry) > 220.0 && dist(vaultX, vaultY, rx, ry) > 220.0) { worldRifts.add(new SingularityRift(rx, ry)); } } worldAtoms.add(new MicroAtom(250, -40, 1, 0, 1, false)); worldAtoms.add(new MicroAtom(330, 110, 1, 0, 0, false)); for (int i = 0; i < 28; i++) { float ax = random(-HALF_WORLD + 180, HALF_WORLD - 180); float ay = random(-HALF_WORLD + 180, HALF_WORLD - 180); if (dist(0, 0, ax, ay) < 220.0) continue; if (ax < 0 && ay < 0) worldAtoms.add(new MicroAtom(ax, ay, 1, 0, (i % 2 == 0) ? 1 : 0, false)); else if (ax >= 0 && ay < 0) worldAtoms.add(new MicroAtom(ax, ay, (i % 2 == 0) ? 1 : 0, (i % 2 == 0) ? 0 : 1, 0, false)); else if (ax < 0 && ay >= 0) worldAtoms.add(new MicroAtom(ax, ay, 3, 1, 2, true)); else worldAtoms.add(new MicroAtom(ax, ay, (i % 3 == 0) ? 6 : 2, (i % 3 == 0) ? 6 : 2, (i % 3 == 0) ? 6 : 2, false)); } } void recalcShipStats() { maxHullHP = 100 + lvlArmor * 45; chargoMax = 6 + lvlTraktor * 4; } // ============================================================================================== // HAUPTSCHLEIFE // ============================================================================================== void draw() { background(getUiPalette(a11yTheme, 0)); float speedMult = 1.0 + (lvlDrive - 1) * 0.25 + sqrt(float(foldBattery)) * 0.12; if (!techModalOpen && !gameOver && !missionWon) { simTime += 0.02; updateShipMovement(speedMult); updateDockingAndWaste(); updateSectorName(); if (shockIntensity > 0.0) { shockRadius += 12.0; shockIntensity -= 5.5; } updateAutoAim(); updateEntities(); // 0-Klick-Modus: Feuert automatisch, sobald ein Ziel im Sensor erfasst ist! if (zeroClickMode) { if (autoFireCooldown > 0) autoFireCooldown--; if (lockedTarget != null && autoFireCooldown <= 0) { fireShipWeapon(); autoFireCooldown = 24; } } } camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); pushMatrix(); translate(width * 0.5 - camX, (height - 135) * 0.5 - camY); drawHexLattice(); drawDockingBases(); drawShockwaves(); drawEntities(); drawAimBeam(); pushMatrix(); translate(shipX, shipY); rotate(shipAngle); drawNornAtomStarship(); popMatrix(); popMatrix(); drawCockpitHUD(speedMult); if (techModalOpen) { drawInlineTechTreeModal(); } else if (gameOver) { drawEndScreen("HÜLLENKOLLAPS IM ATOM-GITTER", "Die CNT-Panzerung wurde durchbrochen. Klicke auf NEUSTART."); } else if (missionWon) { drawEndScreen("FOLD-DRIVE AUF 100% GELADEN!", "Das Norn-Atom-Schiff ist bereit für den interstellaren Sprung!"); } } void drawHexLattice() { int step = 44; int startX = floor((camX - width * 0.6) / step) * step; int endX = ceil((camX + width * 0.6) / step) * step; int startY = floor((camY - height * 0.6) / step) * step; int 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; float dy = shipY - gy; float d = max(0.1, sqrt(dx * dx + dy * dy)); float comp = (d < 190.0) ? map(d, 0, 190, 18.0 * (foldBattery / 100.0), 0.0) : 0.0; float px = gx + (dx / d) * comp; float py = gy + (dy / d) * comp; 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) * 22.0, py + sin(a) * 22.0); } endShape(CLOSE); } } } void updateShipMovement(float speedMult) { float maxSpd = 4.2 * speedMult; if (keyLeft) shipAngle -= 0.055; if (keyRight) shipAngle += 0.055; if (keyUp || keyDown) { mouseSteer = false; float thrust = keyUp ? 0.25 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && mouseY > 36 && mouseY < height - 135) { float sx = width * 0.5 + (shipX - camX); float sy = (height - 135) * 0.5 + (shipY - camY); float dx = mouseX - sx; float dy = mouseY - sy; float d = sqrt(dx * dx + dy * dy); if (d > 18.0) { float targetA = atan2(dy, dx); float diff = atan2(sin(targetA - shipAngle), cos(targetA - shipAngle)); shipAngle += diff * 0.12; float throttle = constrain((d - 18.0) / 140.0, 0.0, 1.0) * 0.22; shipVX += cos(shipAngle) * throttle; shipVY += sin(shipAngle) * throttle; } } shipVX *= 0.95; shipVY *= 0.95; 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 updateDockingAndWaste() { // Plasma-Synthesizer wandelt Waste automatisch in FP um (ab Stufe 1) if (wasteEntropy >= 3 && lvlNornSynth > 0) { wasteEntropy -= 3; int fpGain = 6 * lvlNornSynth; researchFP += fpGain; pushLog("Norn-Plasma-Synthesizer: Waste in +" + fpGain + " Forschungspunkte (FP) umgewandelt!", "Drücke [T], um neue Schiffs-Technologien freizuschalten."); } float dR = dist(shipX, shipY, reactorX, reactorY); float dV = dist(shipX, shipY, vaultX, vaultY); if (dR <= dockRadius) { dockedAt = 1; if (hullHP < maxHullHP) { repairAcc += 0.35; if (repairAcc >= 1.0) { hullHP = min(maxHullHP, hullHP + 1); repairAcc -= 1.0; } } } else if (dV <= dockRadius) { dockedAt = 2; if (hullHP < maxHullHP) { repairAcc += 0.50; if (repairAcc >= 1.0) { hullHP = min(maxHullHP, hullHP + 1); repairAcc -= 1.0; } } } else { dockedAt = 0; } } void convertChargoAtStation() { if (dockedAt == 0 || chargoLoad <= 0) return; chargoLoad--; if (dockedAt == 1) { foldBattery = constrain(foldBattery + 25, 0, 100); researchFP += 15; score += 250; pushLog("Reaktor-Fusion: +25% Fold-Akku & +15 FP gewonnen!", "Verbleibende Chargo-Isotope: " + chargoLoad + "/" + chargoMax); } else { foldBattery = constrain(foldBattery + 15, 0, 100); researchFP += 12; for (int k = 0; k < 3; k++) { float a = simTime + k * (TWO_PI / 3.0); worldQuanta.add(new VacuumQuantum(vaultX + cos(a) * 130.0, vaultY + sin(a) * 130.0)); } pushLog("Quanten-Speicher: +15% Akku, +12 FP & 3 neue Vakuum-Quanten!", "Verbleibende Chargo-Isotope: " + chargoLoad + "/" + chargoMax); } if (foldBattery >= 100) missionWon = true; } void updateSectorName() { if (shipX < 0 && shipY < 0) sectorName = "SEKTOR I (NW): WASSERSTOFF-NEBEL"; else if (shipX >= 0 && shipY < 0) sectorName = "SEKTOR II (NO): FUSIONS-REAKTOR & KERNE"; else if (shipX < 0 && shipY >= 0) sectorName = "SEKTOR III (SW): QUANTEN-SPEICHER & RISS-ZONE"; else sectorName = "SEKTOR IV (SO): KOHLENSTOFF-CLUSTER"; } void updateAutoAim() { lockedTarget = null; float bestD = 360.0; for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (a.destroyed) continue; float d = dist(shipX, shipY, a.x, a.y); if (d < bestD) { bestD = d; lockedTarget = a; } } if (autoAim && lockedTarget != null) { aimAngle = atan2(lockedTarget.y - shipY, lockedTarget.x - shipX); if (activeWeapon == 1 && lockedTarget.electrons > 0) { int curN = lockedTarget.excitedShell; float e1 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, curN); float e2 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, min(3, curN + 1)); currentShotEv = max(0.5, e2 - e1); sensorLabel = "Ziel: Z=" + lockedTarget.protons + " | dE = " + nf(currentShotEv, 1, 2) + " eV"; } else if (activeWeapon == 5) { sensorLabel = "Mesonenkanone (Stufe " + lvlMeson + ") erfasst Z=" + lockedTarget.protons; } else { sensorLabel = "Ziel: Z=" + lockedTarget.protons + " (N=" + lockedTarget.neutrons + ", e=" + lockedTarget.electrons + ")"; } } else { aimAngle = shipAngle; sensorLabel = "Norn-Sensoren scannen Umgebung..."; } } void drawAimBeam() { if (!autoAim || lockedTarget == null) return; int c = getEntityColor(a11yTheme, activeWeapon == 5 ? 9 : 4); stroke(c); strokeWeight(1.5); line(shipX, shipY, lockedTarget.x, lockedTarget.y); noFill(); ellipse(lockedTarget.x, lockedTarget.y, 74, 74); strokeWeight(1.0); } // Zeichnet das atomgroße Norn-Raumschiff mit allen erforschten Upgrades void drawNornAtomStarship() { // Zeno-Stasis-Schild (ab lvlArmor >= 2) if (lvlArmor >= 2) { noFill(); stroke(45, 210, 145, 160); strokeWeight(1.8); ellipse(0, 0, 118, 72); } // YBCO-Heckring stroke(0, 255, 180); strokeWeight(2.0 + lvlDrive * 0.5); fill(18, 28, 45); ellipse(-26, 0, 16, 48 + lvlDrive * 4); // Rumpf + CNT-Panzerung fill(235, 240, 250); stroke(lvlArmor > 0 ? color(45, 210, 145) : color(30, 42, 60)); strokeWeight(1.5 + lvlArmor * 0.8); beginShape(); vertex(-30, -10 - lvlArmor); vertex(24, -8 - lvlArmor); vertex(64, 0); vertex(24, 8 + lvlArmor); vertex(-30, 10 + lvlArmor); vertex(-16, 0); endShape(CLOSE); // Zwillings-Mesonenkanonen (lvlMeson > 0) if (lvlMeson > 0) { fill(getEntityColor(a11yTheme, 9)); stroke(255); rect(8, -16, 20 + lvlMeson * 4, 4); rect(8, 12, 20 + lvlMeson * 4, 4); } // Norn-Pilot im Cockpit fill(235, 185, 110); noStroke(); ellipse(-2, 0, 10, 8); strokeWeight(1.0); } void fireShipWeapon() { if (techModalOpen || gameOver || missionWon) return; float nx = shipX + cos(shipAngle) * 42.0; float ny = shipY + sin(shipAngle) * 42.0; if (activeWeapon == 5) { // Mesonenkanone: Feuert bei Stufe >= 2 eine Doppelsalve! if (lvlMeson >= 2) { float perpX = -sin(aimAngle) * 8.0; float perpY = cos(aimAngle) * 8.0; worldShots.add(new BosonShot(nx + perpX, ny + perpY, cos(aimAngle) * 11.5, sin(aimAngle) * 11.5, 9, 140.0, true)); worldShots.add(new BosonShot(nx - perpX, ny - perpY, cos(aimAngle) * 11.5, sin(aimAngle) * 11.5, 9, 140.0, true)); } else { worldShots.add(new BosonShot(nx, ny, cos(aimAngle) * 11.5, sin(aimAngle) * 11.5, 9, 140.0, true)); } return; } int kind = 3; if (activeWeapon == 1) kind = 4; else if (activeWeapon == 2) kind = 5; else if (activeWeapon == 3) kind = 6; worldShots.add(new BosonShot(nx, ny, cos(aimAngle) * 10.5, sin(aimAngle) * 10.5, kind, currentShotEv, true)); } void updateEntities() { float traktorRadius = 42.0 + lvlTraktor * 48.0; // 1. Grüne Vakuum-Quanten (werden vom Traktorstrahl angezogen!) for (int i = worldQuanta.size() - 1; i >= 0; i--) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); float d = dist(shipX, shipY, q.x, q.y); if (d < traktorRadius && d > 1.0) { q.x += ((shipX - q.x) / d) * (1.8 + lvlTraktor * 0.9); q.y += ((shipY - q.y) / d) * (1.8 + lvlTraktor * 0.9); } if (d < 34.0) { shockX = q.x; shockY = q.y; shockRadius = 0.0; shockIntensity = 220.0; foldBattery = constrain(foldBattery + 9, 0, 100); researchFP += 4; score += 50; q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); if (foldBattery >= 100) missionWon = true; } } // 2. Rote Singularitäts-Risse for (int i = worldRifts.size() - 1; i >= 0; i--) { SingularityRift r = (SingularityRift) worldRifts.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) { int dmg = max(8, 28 - lvlArmor * 6); hullHP = max(0, hullHP - dmg); wasteEntropy++; pushLog("Riss-Kollision (-" + dmg + " HP) · CNT-Panzerung & Norn-Crew halten stand!", "Tipp: Mesonenkanone [5] kann Risse aus der Distanz auflösen!"); r.x = shipX + cos(shipAngle + PI) * 420.0; r.y = shipY + sin(shipAngle + PI) * 420.0; if (hullHP <= 0) gameOver = true; } } // 3. Atome for (int i = worldAtoms.size() - 1; i >= 0; i--) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (a.destroyed) { worldAtoms.remove(i); continue; } a.x += a.vx; a.y += a.vy; if (a.x < -HALF_WORLD + 90 || a.x > HALF_WORLD - 90) a.vx = -a.vx; if (a.y < -HALF_WORLD + 90 || a.y > HALF_WORLD - 90) a.vy = -a.vy; } // 4. Projektile & Mesonen-Treffer for (int i = worldShots.size() - 1; i >= 0; i--) { BosonShot s = (BosonShot) worldShots.get(i); s.x += s.vx; s.y += s.vy; s.life--; if (s.life <= 0) { worldShots.remove(i); continue; } // Mesonenkanone [5] kann Singularitäts-Risse zerstören! if (s.kind == 9) { boolean brokeRift = false; for (int r = worldRifts.size() - 1; r >= 0; r--) { SingularityRift rf = (SingularityRift) worldRifts.get(r); if (dist(s.x, s.y, rf.x, rf.y) < 30.0) { worldRings.add(new ShockRing(rf.x, rf.y, getEntityColor(a11yTheme, 9))); rf.x = random(-HALF_WORLD + 160, HALF_WORLD - 160); rf.y = random(-HALF_WORLD + 160, HALF_WORLD - 160); researchFP += 8; score += 80; pushLog("MESONEN-TREFFER! Singularitäts-Riss aufgelöst (+8 FP)!", "Yukawa-Kopplung neutralisiert die Anomalie."); brokeRift = true; break; } } if (brokeRift) { worldShots.remove(i); continue; } } for (int j = 0; j < worldAtoms.size(); j++) { MicroAtom target = (MicroAtom) worldAtoms.get(j); if (!target.destroyed && dist(s.x, s.y, target.x, target.y) < 42.0) { if (s.kind == 4 && target.electrons > 0) { worldQuanta.add(new VacuumQuantum(target.x + 22, target.y)); researchFP += 5; pushLog("Quantensprung ausgelöst (+5 FP & +1 Vakuum-Quantum)!", "Bohr-Slater Resonanz erfolgreich."); } else if (s.kind == 5 || s.kind == 6 || s.kind == 9) { if (chargoLoad < chargoMax) { chargoLoad++; researchFP += 7; pushLog("Isotop in den Chargo-Frachtraum geladen (" + chargoLoad + "/" + chargoMax + ") · +7 FP!", "Bringe Isotope zum Reaktor (NO) oder Speicher (SW)!"); } else { wasteEntropy++; pushLog("Chargo-Frachtraum voll (" + chargoLoad + "/" + chargoMax + ")! Überschuss als Waste gespeichert.", "Baue D2 (Traktor/Chargo) im Tech-Tree [T] aus!"); } } else if (s.kind == 3 && target.protons > target.electrons) { target.electrons++; foldBattery = constrain(foldBattery + 6, 0, 100); researchFP += 5; if (foldBattery >= 100) missionWon = true; } worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, s.kind))); worldShots.remove(i); break; } } } for (int i = worldRings.size() - 1; i >= 0; i--) { ShockRing r = (ShockRing) worldRings.get(i); r.r += 2.8; r.alpha -= 10; if (r.alpha <= 0) worldRings.remove(i); } } void drawDockingBases() { int goldCol = getEntityColor(a11yTheme, 4); int quantCol = getEntityColor(a11yTheme, 7); noFill(); stroke(goldCol); ellipse(reactorX, reactorY, dockRadius * 2.0, dockRadius * 2.0); fill(255); textSize(11); textAlign(CENTER, TOP); text("FUSIONS-REAKTOR [F]", reactorX, reactorY + dockRadius + 6); noFill(); stroke(quantCol); ellipse(vaultX, vaultY, dockRadius * 2.0, dockRadius * 2.0); fill(255); text("QUANTEN-SPEICHER [F]", vaultX, vaultY + dockRadius + 6); } void drawEntities() { int qCol = getEntityColor(a11yTheme, 7); for (int i = 0; i < worldQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); if (abs(q.x - camX) > width * 0.6 || abs(q.y - camY) > height * 0.6) continue; stroke(qCol); fill(8, 30, 36); ellipse(q.x, q.y, 18, 18); } int rCol = getEntityColor(a11yTheme, 8); for (int i = 0; i < worldRifts.size(); i++) { SingularityRift r = (SingularityRift) worldRifts.get(i); if (abs(r.x - camX) > width * 0.6 || abs(r.y - camY) > height * 0.6) continue; stroke(rCol); fill(35, 6, 14); ellipse(r.x, r.y, 26, 26); } int eCol = getEntityColor(a11yTheme, 3); int pCol = getEntityColor(a11yTheme, 1); for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); if (abs(a.x - camX) > width * 0.65 || abs(a.y - camY) > height * 0.65) continue; noFill(); stroke(eCol); ellipse(a.x, a.y, 58, 58); fill(pCol); noStroke(); ellipse(a.x, a.y, 14, 14); } for (int i = 0; i < worldShots.size(); i++) { BosonShot s = (BosonShot) worldShots.get(i); fill(getEntityColor(a11yTheme, s.kind)); stroke(255); ellipse(s.x, s.y, 11, 11); } } void drawShockwaves() { for (int i = 0; i < worldRings.size(); i++) { ShockRing r = (ShockRing) worldRings.get(i); noFill(); stroke(red(r.col), green(r.col), blue(r.col), r.alpha); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } } void drawCockpitHUD(float speedMult) { int hudTop = height - 135; // Top-Leiste fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 36); stroke(getUiPalette(a11yTheme, 4)); line(0, 36, width, 36); fill(255); textSize(12); textAlign(LEFT, CENTER); text(sectorName + " | Tempo: " + nf(speedMult, 1, 2) + "x", 14, 18); drawUiBtn(width - 430, 6, 155, 24, "Tech-Tree [T] (" + researchFP + " FP)", getUiPalette(a11yTheme, 2)); drawUiBtn(width - 268, 6, 132, 24, zeroClickMode ? "0-Klick [0]: AN" : "0-Klick [0]: AUS", zeroClickMode ? color(20, 125, 75) : color(45, 55, 78)); drawUiBtn(width - 128, 6, 116, 24, a11yTheme == 0 ? "Sehhilfe [H]" : (a11yTheme == 1 ? "Farbenblind" : "Max-Kontrast"), getUiPalette(a11yTheme, 3)); // Unteres Cockpit-Deck fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hudTop, width, 135); stroke(getUiPalette(a11yTheme, 4)); line(0, hudTop, width, hudTop); fill(255); textSize(11); textAlign(LEFT, TOP); text("PANZERUNG: " + hullHP + "/" + maxHullHP, 16, hudTop + 10); text("CHARGO: " + chargoLoad + "/" + chargoMax, 165, hudTop + 10); text("WASTE: " + wasteEntropy, 275, hudTop + 10); text("FP: " + researchFP, 355, hudTop + 10); text("FOLD-AKKU: " + foldBattery + "%", 435, hudTop + 10); // 5 Waffen-Buttons inkl. Mesonenkanone [5] drawWeaponBtn(16, hudTop + 34, 1, "[1] Photon", getEntityColor(a11yTheme, 4)); drawWeaponBtn(134, hudTop + 34, 2, "[2] Gluon", getEntityColor(a11yTheme, 5)); drawWeaponBtn(252, hudTop + 34, 3, "[3] W-Boson", getEntityColor(a11yTheme, 6)); drawWeaponBtn(370, hudTop + 34, 4, "[4] Elektron", getEntityColor(a11yTheme, 3)); drawWeaponBtn(488, hudTop + 34, 5, "[5] Mesonen", getEntityColor(a11yTheme, 9)); if (dockedAt > 0) { drawUiBtn(616, hudTop + 34, 290, 26, "[F] CHARGO-ISOTOP AN STATION UMWANDELN", getUiPalette(a11yTheme, 2)); } else { drawUiBtn(616, hudTop + 34, 290, 26, "Stationen: Reaktor (NO) / Speicher (SW)", color(24, 30, 44)); } fill(8, 10, 18); stroke(55, 68, 95); rect(16, hudTop + 66, 890, 58, 5); fill(getEntityColor(a11yTheme, 4)); textAlign(LEFT, TOP); text("SENSOR: " + sensorLabel, 26, hudTop + 72); fill(255); textSize(12); text(logHead, 26, hudTop + 90); fill(200, 215, 240); textSize(11); text(logSub, 26, hudTop + 108); // Radar rechts unten int mapSize = 115; int mapX = width - mapSize - 16; int mapY = hudTop + 10; fill(4, 6, 12); stroke(getUiPalette(a11yTheme, 4)); rect(mapX, mapY, mapSize, mapSize, 4); noStroke(); fill(getEntityColor(a11yTheme, 7)); for (int i = 0; i < worldQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); rect(map(q.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3), map(q.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3), 2, 2); } 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 drawWeaponBtn(int bx, int by, int id, String lbl, int dotC) { boolean sel = (activeWeapon == id); fill(sel ? getUiPalette(a11yTheme, 2) : color(20, 25, 38)); stroke(sel ? getUiPalette(a11yTheme, 4) : color(60, 75, 105)); rect(bx, by, 112, 26, 4); fill(dotC); noStroke(); ellipse(bx + 12, by + 13, 9, 9); fill(255); textSize(11); textAlign(LEFT, CENTER); text(lbl, bx + 22, by + 13); } void drawUiBtn(int bx, int by, int bw, int bh, String lbl, int bg) { fill(bg); stroke(125, 160, 220); rect(bx, by, bw, bh, 4); fill(255); textSize(11); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } // ============================================================================================== // INTEGRIERTER NORN TECH-TREE DIALOG [T] // ============================================================================================== void drawInlineTechTreeModal() { fill(4, 5, 12, 232); noStroke(); rect(0, 36, width, height - 36); int mx = 110; int my = 66; int mw = width - 220; int mh = 560; fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(mx, my, mw, mh, 8); strokeWeight(1.0); fill(getUiPalette(a11yTheme, 2)); noStroke(); rect(mx + 1, my + 1, mw - 2, 40, 7); fill(255); textSize(15); textAlign(LEFT, CENTER); text("NORN-FORSCHUNGSBAUM — VERFÜGBARE FORSCHUNGSPUNKTE: " + researchFP + " FP", mx + 18, my + 21); drawUiBtn(mx + mw - 310, my + 8, 175, 26, freeTechClick ? "Freies Klicken: AN" : "Freies Klicken: AUS", color(24, 54, 112)); drawUiBtn(mx + mw - 125, my + 8, 110, 26, "Schließen [T]", color(40, 48, 68)); drawTechRow(mx + 24, my + 64, mw - 48, "1. ALDI-YBCO Gitter-Antrieb", "Erhöht Fluggeschwindigkeit im Atom-Gitter (+25% / Stufe)", lvlDrive, 20 * lvlDrive); drawTechRow(mx + 24, my + 150, mw - 48, "2. Mesonenkanone (Pi+/- Salven)", "Zerstört Singularitäts-Risse; ab Stufe 2 Doppelsalve!", lvlMeson, 25 * lvlMeson); drawTechRow(mx + 24, my + 236, mw - 48, "3. CNT-Panzerung & Zeno-Schild", "+45 Max-Panzerung pro Stufe & Zeno-Deflektor ab Stufe 2", lvlArmor, 20 * (lvlArmor + 1)); drawTechRow(mx + 24, my + 322, mw - 48, "4. Quanten-Traktor & Chargo-Pod", "Erhöht Traktor-Reichweite & Isotope-Frachtraum (+4 / Stufe)", lvlTraktor, 20 * lvlTraktor); drawTechRow(mx + 24, my + 408, mw - 48, "5. Norn-Plasma-Synthesizer", "Wandelt Waste-Entropie automatisch in +6 FP / Stufe um", lvlNornSynth, 25 * lvlNornSynth); } void drawTechRow(int rx, int ry, int rw, String title, String desc, int lvl, int cost) { fill(18, 23, 36); stroke(59, 110, 194); rect(rx, ry, rw, 74, 6); fill(255); textSize(14); textAlign(LEFT, TOP); text(title + " [Stufe " + lvl + " / 3]", rx + 14, ry + 10); fill(210, 225, 245); textSize(12); text(desc, rx + 14, ry + 36); if (lvl >= 3) { drawUiBtn(rx + rw - 195, ry + 16, 180, 42, "MAXIMAL (3/3)", color(20, 115, 70)); } else { String lbl = freeTechClick ? "AUSBAUEN (Gratis)" : ("FORSCHEN (" + cost + " FP)"); int bg = (freeTechClick || researchFP >= cost) ? getUiPalette(a11yTheme, 2) : color(45, 52, 72); drawUiBtn(rx + rw - 195, ry + 16, 180, 42, lbl, bg); } } void drawEndScreen(String title, String sub) { fill(4, 5, 12, 225); noStroke(); rect(0, 36, width, height - 171); fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); rect(260, 190, 540, 210, 8); fill(255); textSize(20); textAlign(CENTER, CENTER); text(title, width * 0.5, 235); fill(220, 230, 245); textSize(13); text(sub + "\nScore: " + score, width * 0.5, 285); drawUiBtn(430, 335, 200, 40, "NEUSTART", getUiPalette(a11yTheme, 2)); } // ============================================================================================== // KLASSEN & EINGABEN // ============================================================================================== 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 MicroAtom { float x, y, vx, vy; int protons, neutrons, electrons, excitedShell; boolean hostile, destroyed; MicroAtom(float ax, float ay, int p, int n, int e, boolean h) { x = ax; y = ay; vx = random(-0.4, 0.4); vy = random(-0.4, 0.4); protons = p; neutrons = n; electrons = e; excitedShell = 1; hostile = h; destroyed = false; } } class BosonShot { float x, y, vx, vy, ev; int kind, life; boolean player; BosonShot(float sx, float sy, float svx, float svy, int k, float e, boolean pl) { x = sx; y = sy; vx = svx; vy = svy; kind = k; ev = e; player = pl; life = 115; } } 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; } } void mouseMoved() { if (!techModalOpen && !gameOver && !missionWon && mouseY > 36 && mouseY < height - 135) mouseSteer = true; } void mousePressed() { if (gameOver || missionWon) { if (mouseX >= 430 && mouseX <= 630 && mouseY >= 335 && mouseY <= 375) resetNornMission(); return; } if (mouseY <= 36) { if (mouseX >= width - 430 && mouseX <= width - 275) { techModalOpen = !techModalOpen; return; } if (mouseX >= width - 268 && mouseX <= width - 136) { zeroClickMode = !zeroClickMode; return; } if (mouseX >= width - 128 && mouseX <= width - 12) { a11yTheme = (a11yTheme + 1) % 3; return; } return; } if (techModalOpen) { int mx = 110; int my = 66; int mw = width - 220; if (mouseX >= mx + mw - 310 && mouseX <= mx + mw - 135 && mouseY >= my + 8 && mouseY <= my + 34) { freeTechClick = !freeTechClick; return; } if (mouseX >= mx + mw - 125 && mouseX <= mx + mw - 15 && mouseY >= my + 8 && mouseY <= my + 34) { techModalOpen = false; return; } int rx = mx + 24; int rw = mw - 48; if (mouseX >= rx + rw - 195 && mouseX <= rx + rw - 15) { if (mouseY >= my + 80 && mouseY <= my + 122 && lvlDrive < 3) { int c = 20 * lvlDrive; if (freeTechClick || researchFP >= c) { if (!freeTechClick) researchFP -= c; lvlDrive++; } } else if (mouseY >= my + 166 && mouseY <= my + 208 && lvlMeson < 3) { int c = 25 * lvlMeson; if (freeTechClick || researchFP >= c) { if (!freeTechClick) researchFP -= c; lvlMeson++; } } else if (mouseY >= my + 252 && mouseY <= my + 294 && lvlArmor < 3) { int c = 20 * (lvlArmor + 1); if (freeTechClick || researchFP >= c) { if (!freeTechClick) researchFP -= c; lvlArmor++; recalcShipStats(); hullHP = min(maxHullHP, hullHP + 45); } } else if (mouseY >= my + 338 && mouseY <= my + 380 && lvlTraktor < 3) { int c = 20 * lvlTraktor; if (freeTechClick || researchFP >= c) { if (!freeTechClick) researchFP -= c; lvlTraktor++; recalcShipStats(); } } else if (mouseY >= my + 424 && mouseY <= my + 466 && lvlNornSynth < 3) { int c = 25 * lvlNornSynth; if (freeTechClick || researchFP >= c) { if (!freeTechClick) researchFP -= c; lvlNornSynth++; } } } return; } int hudTop = height - 135; if (mouseY >= hudTop) { if (mouseY >= hudTop + 34 && mouseY <= hudTop + 60) { if (mouseX >= 16 && mouseX <= 128) { activeWeapon = 1; return; } if (mouseX >= 134 && mouseX <= 246) { activeWeapon = 2; return; } if (mouseX >= 252 && mouseX <= 364) { activeWeapon = 3; return; } if (mouseX >= 370 && mouseX <= 482) { activeWeapon = 4; return; } if (mouseX >= 488 && mouseX <= 600) { activeWeapon = 5; return; } if (mouseX >= 616 && mouseX <= 906 && dockedAt > 0) { convertChargoAtStation(); return; } } return; } if (mouseY > 36 && mouseY < hudTop && mouseButton == LEFT) fireShipWeapon(); } void keyPressed() { if (key == '1') activeWeapon = 1; if (key == '2') activeWeapon = 2; if (key == '3') activeWeapon = 3; if (key == '4') activeWeapon = 4; if (key == '5') activeWeapon = 5; if (key == 't' || key == 'T') techModalOpen = !techModalOpen; if (key == '0') zeroClickMode = !zeroClickMode; if (key == 'f' || key == 'F') convertChargoAtStation(); if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == ' ') fireShipWeapon(); if (key == 'w' || key == 'W') keyUp = true; if (key == 's' || key == 'S') keyDown = true; if (key == 'a' || key == 'A') keyLeft = true; if (key == 'd' || key == 'D') keyRight = true; if (key == CODED) { if (keyCode == UP) keyUp = true; if (keyCode == DOWN) keyDown = true; if (keyCode == LEFT) keyLeft = true; if (keyCode == RIGHT) keyRight = true; } } void keyReleased() { if (key == 'w' || key == 'W') keyUp = false; if (key == 's' || key == 'S') keyDown = false; if (key == 'a' || key == 'A') keyLeft = false; if (key == 'd' || key == 'D') keyRight = false; if (key == CODED) { if (keyCode == UP) keyUp = false; if (keyCode == DOWN) keyDown = false; if (keyCode == LEFT) keyLeft = false; if (keyCode == RIGHT) keyRight = false; } }