/** * ============================================================================================== * Modul: DTIM-ZEC MICRO-COSMOS STARSHIP (OPEN-WORLD QUANTUM & BOSON SANDBOX) * Datei: TLW_Atom_simulator_2.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Architektur: Bühring-Metrik Ring-Starship + Bohr-Slater Quantensprünge + Bethe-Weizsäcker * Copyright: (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI) * Lizenz: MIT License (Quellcode) / CC0 1.0 Universal (Offene Daten & Modelle) * Plattform: Processing 4.5.6 (Linux x64) & Processing.js (processing.min.js) * Steuerung: [Maus bewegen] Kurs & Auto-Aim | [Linksklick / Leertaste] Boson abfeuern * [W/A/S/D oder Pfeile] Schub & Drehung | [1-4] Waffe (Photon/Gluon/W-Boson/Elektron) * [E] Auto-Aim AN/AUS | [H] Sehhilfe (Standard / Farbenblind / Max-Kontrast) * ============================================================================================== */ // ============================================================================================== // MODUL 1: SYSTEMKONSTANTEN & OPEN-WORLD ZUSTAND (100% PROCESSING.JS-KOMPATIBEL) // ============================================================================================== float WORLD_SIZE = 3200.0; float HALF_WORLD = 1600.0; // Starship Zustand in Weltkoordinaten 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; // Gameplay & Energie-Werte int ladung = 15; // 0 .. 100 % Akkumulator int score = 0; int schild = 100; // 0 .. 100 % Hüllenintegrität float simTime = 0.0; boolean gameOver = false; boolean missionWon = false; // Waffen- & Auto-Aim-System int activeWeapon = 1; // 1: Photon, 2: Gluon, 3: W-Boson, 4: Elektron boolean autoAim = true; float aimAngle = 0.0; float currentShotEv = 10.20; MicroAtom lockedTarget = null; String targetInfoText = "Kein Ziel im Sensorradius"; // Schockwelle (Raumzeit-Verzerrung beim Quanten-Kollaps) float shockX = 0.0; float shockY = 0.0; float shockRadius = 0.0; float shockIntensity = 0.0; // Entitäten-Listen (untypisiert für 100% Processing.js-Kompatibilität) ArrayList worldQuanta; ArrayList worldRifts; ArrayList worldAtoms; ArrayList worldShots; ArrayList worldRings; // Steuerung & UI-Modi boolean keyUp = false; boolean keyDown = false; boolean keyLeft = false; boolean keyRight = false; boolean mouseSteer = true; int a11yTheme = 0; // 0: DTIM Standard (Schwarz/Blutrot/Nachtblau), 1: Farbenblind, 2: Max-Kontrast boolean briefingOpen = true; String sectorName = "SEKTOR I: WASSERSTOFF-NEBEL (QUANTENSPRÜNGE)"; String logHeadline = "Bordcomputer bereit: Ziele auf Atome und feuere Bosonen ab!"; String logSubtext = "Tipp: Photonen [1] regen Elektronen an -> bei Rücksprung entstehen grüne Vakuum-Quanten."; int logFlashTimer = 0; // ============================================================================================== // MODUL 2: FARB-PALETTEN & PHYSIKALISCHE FORMELN (BOHR-SLATER & BETHE-WEIZSÄCKER) // ============================================================================================== int getUiPalette(int theme, int role) { // role: 0=Bg, 1=HudBg, 2=Blood/Primary, 3=Blue/Secondary, 4=Accent, 5=Text if (theme == 1) { // Farbenblind-Optimiert (Blau / Gold-Amber) 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) { // Maximal-Kontrast 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); } // Standard: Tiefschwarz, Dunkles Blutrot, Dunkles Nachtblau, Helles Silbergrau if (role == 0) return color(6, 8, 14); if (role == 1) return color(12, 15, 24); 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(Grün), 8: Rift(Rot) if (theme == 1) { if (kind == 1) return color(230, 159, 0); if (kind == 2) return color(195, 210, 230); if (kind == 3) return color(56, 189, 248); if (kind == 4) return color(253, 224, 71); if (kind == 5) return color(45, 212, 191); if (kind == 6) return color(244, 114, 182); if (kind == 7) return color(52, 211, 153); return color(245, 158, 11); } 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); // Proton: Blutrot if (kind == 2) return color(185, 198, 220); // Neutron: Silbergrau if (kind == 3) return color(65, 145, 255); // Elektron: Blau if (kind == 4) return color(255, 215, 55); // Photon: Goldgelb if (kind == 5) return color(35, 215, 155); // Gluon: Smaragd if (kind == 6) return color(205, 85, 235); // W-Boson: Violett if (kind == 7) return color(0, 255, 180); // Vakuum-Quantum: Grün return color(255, 45, 65); // Singularitäts-Riss: Warnrot } float calcShellEnergyEv(int Z, int electrons, int n) { if (Z <= 0) return -1.5; float zEff = 1.0; if (electrons <= 2) zEff = max(1.0, float(Z) - 0.30 * float(electrons - 1)); else zEff = max(1.15, float(Z) - 0.85 * float(electrons - 1)); return -13.6 * (zEff * zEff) / float(n * n); } float calcBetheWeizsaecker(int Z, int N) { int A = Z + N; if (A <= 1 || Z <= 0) return 0.0; float av = 15.8; float as = 18.3; float ac = 0.714; float aa = 23.2; float 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); } String getElementName(int Z) { if (Z == 0) return "Neutron"; if (Z == 1) return "Wasserstoff (H)"; if (Z == 2) return "Helium (He)"; if (Z == 3) return "Lithium (Li)"; if (Z == 4) return "Beryllium (Be)"; if (Z == 5) return "Bor (B)"; if (Z == 6) return "Kohlenstoff (C-12)"; return "Kern Z=" + Z; } void pushPhysicsLog(String head, String sub) { logHeadline = head; logSubtext = sub; logFlashTimer = 90; } // ============================================================================================== // MODUL 3: INITIALISIERUNG & OPEN-WORLD SEEDING // ============================================================================================== void setup() { size(960, 660); noSmooth(); frameRate(60); worldQuanta = new ArrayList(); worldRifts = new ArrayList(); worldAtoms = new ArrayList(); worldShots = new ArrayList(); worldRings = new ArrayList(); resetMicroCosmos(); } void resetMicroCosmos() { shipX = 0.0; shipY = 0.0; shipVX = 0.0; shipVY = 0.0; shipAngle = 0.0; camX = 0.0; camY = 0.0; ladung = 15; score = 0; schild = 100; gameOver = false; missionWon = false; worldQuanta.clear(); worldRifts.clear(); worldAtoms.clear(); worldShots.clear(); worldRings.clear(); // 1. Grüne Vakuum-Quanten im gesamten Mikrokosmos verteilen for (int i = 0; i < 36; i++) { float qx = random(-HALF_WORLD + 120, HALF_WORLD - 120); float qy = random(-HALF_WORLD + 120, HALF_WORLD - 120); worldQuanta.add(new VacuumQuantum(qx, qy)); } // 2. Rote Singularitäts-Risse (Anomalien zum Ausweichen) for (int i = 0; i < 22; 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) { worldRifts.add(new SingularityRift(rx, ry)); } } // 3. Open-World Atome & Kerne in den 4 Sektoren ansiedeln // Direkt vor dem Startpunkt: Ein Wasserstoff-Atom zum sofortigen Testen! worldAtoms.add(new MicroAtom(260, -40, 1, 0, 1, false)); worldAtoms.add(new MicroAtom(340, 110, 1, 0, 0, false)); for (int i = 0; i < 26; 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) { // Sektor NW: Wasserstoff- & Ionen-Wolke int eCount = (i % 2 == 0) ? 1 : 0; worldAtoms.add(new MicroAtom(ax, ay, 1, 0, eCount, false)); } else if (ax >= 0 && ay < 0) { // Sektor NO: Fusions-Schmiede (freie Protonen & Neutronen) if (i % 2 == 0) worldAtoms.add(new MicroAtom(ax, ay, 1, 0, 0, false)); else worldAtoms.add(new MicroAtom(ax, ay, 0, 1, 0, false)); } else if (ax < 0 && ay >= 0) { // Sektor SW: Instabile Isotope (Gegner-Kerne, die Wellen aussenden -> mit W-Boson [3] entschärfen!) worldAtoms.add(new MicroAtom(ax, ay, 3, 1, 2, true)); } else { // Sektor SO: Kohlenstoff C-12 & Helium-4 Cluster if (i % 3 == 0) worldAtoms.add(new MicroAtom(ax, ay, 6, 6, 6, false)); else worldAtoms.add(new MicroAtom(ax, ay, 2, 2, 2, false)); } } pushPhysicsLog("Systeme online: Bühring-Metrik-Ring aktiv (Ladung: 15%)", "Steuere mit Maus oder W/A/S/D · Klicke zum Abfeuern der Bosonen-Kanone!"); } // ============================================================================================== // MODUL 4: HAUPTSCHLEIFE & TOPOLOGISCHES HEXAGON-GITTER MIT SCHOCKWELLE // ============================================================================================== void draw() { background(getUiPalette(a11yTheme, 0)); float shipScale = 1.0 + (ladung / 100.0) * 0.25; float rootFactor = 1.0 + sqrt(float(ladung)) * 0.14; // Skalierung per Wurzelfunktion if (!briefingOpen && !gameOver && !missionWon) { simTime += 0.02; updateStarshipMotion(rootFactor); updateSectorTelemetry(); if (shockIntensity > 0.0) { shockRadius += 12.0; shockIntensity -= 5.5; } updateAutoAimSensor(); updateWorldEntities(shipScale); } // Kamera folgt dem Schiff weich durch den offenen Mikrokosmos camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); // Welt-Ansicht zeichnen pushMatrix(); translate(width * 0.5 - camX, (height - 135) * 0.5 - camY); drawSpacetimeHexGrid(); drawSectorBoundaries(); drawShockwaves(); drawWorldEntities(); drawAutoAimLaser(); // Starship mit Matrix-Rotation & Wurzel-Skalierung rendern pushMatrix(); translate(shipX, shipY); rotate(shipAngle); scale(shipScale); drawStarship(0, 0); popMatrix(); popMatrix(); // HUD, Radar & Bordcomputer-Texte zeichnen drawPilotHUD(rootFactor); if (gameOver) { drawEndOverlay("HÜLLENKOLLAPS IM VAKUUM", "Zu viele Singularitäts-Risse getroffen. Klicke auf NEUSTART."); } else if (missionWon) { drawEndOverlay("MISSION ERFOLGREICH (100% LADUNG)", "Dein Starship ist vollständig mit topologischer Vakuum-Energie geladen!"); } else if (briefingOpen) { drawBriefingModal(); } } void drawSpacetimeHexGrid() { 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 = sqrt(dx * dx + dy * dy); if (d < 0.1) d = 0.1; float compression = (d < 190.0) ? map(d, 0, 190, 20.0 * (ladung / 100.0), 0.0) : 0.0; float sDx = gx - shockX; float sDy = gy - shockY; float sDist = sqrt(sDx * sDx + sDy * sDy); float shockShift = 0.0; if (shockIntensity > 0.0 && abs(sDist - shockRadius) < 45.0) { shockShift = map(abs(sDist - shockRadius), 0, 45, 22.0 * (shockIntensity / 255.0), 0.0); } float denom = (sDist < 0.1) ? 1.0 : sDist; float px = gx + (dx / d) * compression + (sDx / denom) * shockShift; float py = gy + (dy / d) * compression + (sDy / denom) * shockShift; float glow = (shockIntensity > 0.0 && abs(sDist - shockRadius) < 55.0) ? map(abs(sDist - shockRadius), 0, 55, shockIntensity, 0.0) : 0.0; if (a11yTheme == 2) { stroke(70 + glow * 0.6); } else if (a11yTheme == 1) { stroke(30 + glow * 0.5, 110 + glow * 0.4, 210, map(d, 0, 460, 46, 12)); } else { stroke(45 + glow * 0.6, 85 + glow * 0.3, 195, map(d, 0, 460, 48, 12)); } strokeWeight(glow > 18.0 ? 1.5 : 1.0); 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); } } strokeWeight(1.0); } void drawSectorBoundaries() { stroke(a11yTheme == 2 ? color(255) : color(179, 25, 56, 130)); strokeWeight(2.0); noFill(); rect(-HALF_WORLD, -HALF_WORLD, WORLD_SIZE, WORLD_SIZE); // Sektor-Achsen stroke(59, 110, 194, 65); line(-HALF_WORLD, 0, HALF_WORLD, 0); line(0, -HALF_WORLD, 0, HALF_WORLD); strokeWeight(1.0); } // ============================================================================================== // MODUL 5: STARSHIP-KINEMATIK, BÜHRING-METRIK RING-DESIGN & AUTO-AIM // ============================================================================================== void updateStarshipMotion(float rootFactor) { float maxSpeed = 4.2 * rootFactor; if (keyLeft) shipAngle -= 0.055; if (keyRight) shipAngle += 0.055; if (keyUp || keyDown) { mouseSteer = false; float thrust = keyUp ? 0.24 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && mouseY < height - 135) { float screenShipX = width * 0.5 + (shipX - camX); float screenShipY = (height - 135) * 0.5 + (shipY - camY); float dx = mouseX - screenShipX; float dy = mouseY - screenShipY; float d = sqrt(dx * dx + dy * dy); if (d > 18.0) { float desiredAng = atan2(dy, dx); float diff = atan2(sin(desiredAng - shipAngle), cos(desiredAng - 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 curSpd = sqrt(shipVX * shipVX + shipVY * shipVY); if (curSpd > maxSpeed) { shipVX = (shipVX / curSpd) * maxSpeed; shipVY = (shipVY / curSpd) * maxSpeed; } shipX = constrain(shipX + shipVX, -HALF_WORLD + 60, HALF_WORLD - 60); shipY = constrain(shipY + shipVY, -HALF_WORLD + 60, HALF_WORLD - 60); } void updateSectorTelemetry() { String nextSector; if (shipX < 0 && shipY < 0) nextSector = "SEKTOR I (NW): WASSERSTOFF-NEBEL — Quantensprünge mit Photon [1]"; else if (shipX >= 0 && shipY < 0) nextSector = "SEKTOR II (NO): FUSIONS-SCHMIEDE — Kerne binden mit Gluon [2]"; else if (shipX < 0 && shipY >= 0) nextSector = "SEKTOR III (SW): ISOTOPEN-RISS — Instabile Kerne wandeln mit W-Boson [3]"; else nextSector = "SEKTOR IV (SO): KOHLENSTOFF-CLUSTER — Ionen stabilisieren mit Elektron [4]"; if (!nextSector.equals(sectorName)) { sectorName = nextSector; pushPhysicsLog("Sektor-Eintritt: " + sectorName, "Sensoren kalibriert · Auto-Aim sucht passende Resonanz-Energien."); } } void updateAutoAimSensor() { lockedTarget = null; float bestD = 340.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) { if (lockedTarget.electrons > 0) { int curN = lockedTarget.excitedShell; if (curN < 3) { float e1 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, curN); float e2 = calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, curN + 1); currentShotEv = max(0.5, e2 - e1); targetInfoText = getElementName(lockedTarget.protons) + " | Sprung n=" + curN + "->" + (curN + 1) + ": " + nf(currentShotEv, 1, 2) + " eV"; } else { float eIon = abs(calcShellEnergyEv(lockedTarget.protons, lockedTarget.electrons, 3)); currentShotEv = eIon; targetInfoText = getElementName(lockedTarget.protons) + " | Ionisation (n=3->frei): " + nf(currentShotEv, 1, 2) + " eV"; } } else { currentShotEv = 13.6; targetInfoText = getElementName(lockedTarget.protons) + " (Ionisiert · kein Elektron)"; } } else if (activeWeapon == 2) { float bMeV = calcBetheWeizsaecker(lockedTarget.protons, lockedTarget.neutrons); targetInfoText = getElementName(lockedTarget.protons) + " | Gluon-Fusion (Bindung: " + nf(bMeV, 1, 1) + " MeV)"; } else if (activeWeapon == 3) { targetInfoText = getElementName(lockedTarget.protons) + (lockedTarget.hostile ? " [INSTABIL] -> W-Boson wandelt p->n!" : " -> Schwache Wechselwirkung bereit"); } else { int q = lockedTarget.protons - lockedTarget.electrons; targetInfoText = getElementName(lockedTarget.protons) + " | Ladung: " + (q > 0 ? "+" + q : "" + q) + " (Elektronen-Injektion)"; } } else { aimAngle = shipAngle; targetInfoText = autoAim ? "Sensoren scannen Mikrokosmos..." : "Manuelles Zielen in Flugrichtung"; } } void drawAutoAimLaser() { if (!autoAim || lockedTarget == null) return; int wCol = getEntityColor(a11yTheme, activeWeapon == 1 ? 4 : (activeWeapon == 2 ? 5 : (activeWeapon == 3 ? 6 : 3))); stroke(wCol); strokeWeight(1.5); line(shipX, shipY, lockedTarget.x, lockedTarget.y); noFill(); ellipse(lockedTarget.x, lockedTarget.y, 76, 76); strokeWeight(1.0); } // Physikalisch korrektes topologisches Ring-Schiff (Bühring-Metrik) void drawStarship(float cx, float cy) { int ringCol = getEntityColor(a11yTheme, 7); stroke(ringCol); strokeWeight(2.5); fill(18, 28, 45); ellipse(cx - 26, cy, 18, 54); if (ladung > 0) { fill(red(ringCol), green(ringCol), blue(ringCol), 110 + sin(simTime * 22.0) * 80); noStroke(); ellipse(cx - 26, cy, 8, 30); } // Hauptchassis: Symmetrische Nadel-Kapsel fill(238, 243, 252); stroke(30, 42, 60); strokeWeight(1.5); beginShape(); vertex(cx - 32, cy - 10); vertex(cx + 38, cy - 8); vertex(cx + 104, cy); vertex(cx + 38, cy + 8); vertex(cx - 32, cy + 10); vertex(cx - 18, cy); endShape(CLOSE); // Seitliche Stabilisierungs-Leiterflächen fill(75, 88, 108); stroke(30, 42, 60); rect(cx - 14, cy - 16, 24, 4); rect(cx - 14, cy + 12, 24, 4); // Bug-Deflektoraura bei hoher Ladung if (ladung > 45) { noFill(); stroke(getEntityColor(a11yTheme, 3)); arc(cx + 109, cy, 16, 16, -HALF_PI, HALF_PI); } strokeWeight(1.0); } // ============================================================================================== // MODUL 6: MIKROKOSMOS-ENTITÄTEN & PHYSIKALISCHE WECHSELWIRKUNGEN // ============================================================================================== class VacuumQuantum { float x, y, phase; VacuumQuantum(float qx, float qy) { x = qx; y = qy; phase = random(TWO_PI); } } 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; int excitedShell; int exciteTimer; boolean hostile; int attackCooldown; boolean destroyed; MicroAtom(float ax, float ay, int p, int n, int e, boolean isHostile) { x = ax; y = ay; vx = random(-0.4, 0.4); vy = random(-0.4, 0.4); protons = p; neutrons = n; electrons = e; excitedShell = 1; exciteTimer = 0; hostile = isHostile; attackCooldown = int(random(90, 180)); destroyed = false; } } class BosonProjectile { float x, y, vx, vy; int kind; // 4=Photon, 5=Gluon, 6=W-Boson, 3=Elektron, 8=Feind-Strahlung float energyEv; boolean fromPlayer; int life; BosonProjectile(float sx, float sy, float svx, float svy, int k, float ev, boolean playerOwned) { x = sx; y = sy; vx = svx; vy = svy; kind = k; energyEv = ev; fromPlayer = playerOwned; 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 = 240; } } void fireStarshipWeapon() { if (briefingOpen || gameOver || missionWon) return; float noseX = shipX + cos(shipAngle) * 45.0; float noseY = shipY + sin(shipAngle) * 45.0; float spd = 10.5; int shotKind = 3; if (activeWeapon == 1) shotKind = 4; else if (activeWeapon == 2) shotKind = 5; else if (activeWeapon == 3) shotKind = 6; worldShots.add(new BosonProjectile(noseX, noseY, cos(aimAngle) * spd, sin(aimAngle) * spd, shotKind, currentShotEv, true)); } void updateWorldEntities(float shipScale) { // 1. Grüne Vakuum-Quanten einsammeln for (int i = worldQuanta.size() - 1; i >= 0; i--) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); q.y += sin(simTime * 3.0 + q.phase) * 0.45; if (dist(shipX, shipY, q.x, q.y) < 38.0 * shipScale) { shockX = q.x; shockY = q.y; shockRadius = 0.0; shockIntensity = 255.0; score += 50; ladung = constrain(ladung + 10, 0, 100); worldRings.add(new ShockRing(q.x, q.y, getEntityColor(a11yTheme, 7))); pushPhysicsLog("QUANT COLLAPSED! +10% Vakuum-Energie geladen (Score: " + score + ")", "Die Raumzeit-Krümmung des Bühring-Rings absorbiert Nullpunkt-Energie."); q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); if (ladung >= 100) missionWon = true; } } // 2. Rote Singularitäts-Risse (Ausweichen!) for (int i = 0; i < worldRifts.size(); 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) < 34.0 * shipScale) { schild = max(0, schild - 34); worldRings.add(new ShockRing(r.x, r.y, getEntityColor(a11yTheme, 8))); pushPhysicsLog("ANOMALIE-EINSCHLAG! Schildintegrität auf " + schild + "% gesunken!", "Singularitäts-Risse verzerren die Metrik — halte Abstand!"); r.x = shipX + cos(shipAngle + PI) * 420.0 + random(-150, 150); r.y = shipY + sin(shipAngle + PI) * 420.0 + random(-150, 150); if (schild <= 0) gameOver = true; } } // 3. Atome & Kerne im Mikrokosmos 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; // Spontane Emission: Angeregtes Elektron fällt auf n=1 zurück und erzeugt ein Vakuum-Quantum! if (a.excitedShell > 1 && a.electrons > 0) { a.exciteTimer--; if (a.exciteTimer <= 0) { int oldN = a.excitedShell; a.excitedShell = 1; worldQuanta.add(new VacuumQuantum(a.x + random(-24, 24), a.y + random(-24, 24))); worldRings.add(new ShockRing(a.x, a.y, getEntityColor(a11yTheme, 4))); pushPhysicsLog("SPONTANE EMISSION! Elektron fällt n=" + oldN + " -> n=1", "Freigesetztes Photon-Paket erzeugt einsammelbares Vakuum-Quantum!"); } } // Instabile Isotope senden Strahlung aus, wenn das Schiff nahe ist if (a.hostile && dist(shipX, shipY, a.x, a.y) < 380.0) { a.attackCooldown--; if (a.attackCooldown <= 0) { a.attackCooldown = 140; float ang = atan2(shipY - a.y, shipX - a.x); worldShots.add(new BosonProjectile(a.x, a.y, cos(ang) * 4.6, sin(ang) * 4.6, 8, 2.0, false)); } } } // 4. Projektile bewegen & Treffer auswerten for (int i = worldShots.size() - 1; i >= 0; i--) { BosonProjectile s = (BosonProjectile) worldShots.get(i); s.x += s.vx; s.y += s.vy; s.life--; if (s.life <= 0) { worldShots.remove(i); continue; } if (!s.fromPlayer) { if (dist(s.x, s.y, shipX, shipY) < 26.0 * shipScale) { schild = max(0, schild - 15); worldRings.add(new ShockRing(shipX, shipY, getEntityColor(a11yTheme, 8))); pushPhysicsLog("ISOTOPEN-STRAHLUNG GETROFFEN! Schild: " + schild + "%", "Nutze W-Bosonen [3], um instabile Protonen in Neutronen umzuwandeln!"); worldShots.remove(i); if (schild <= 0) gameOver = true; } continue; } boolean consumed = false; for (int j = 0; j < worldAtoms.size(); j++) { MicroAtom target = (MicroAtom) worldAtoms.get(j); if (target.destroyed) continue; if (dist(s.x, s.y, target.x, target.y) < 42.0) { handlePlayerBosonHit(s, target); consumed = true; break; } } if (consumed) worldShots.remove(i); } // 5. Schockwellen-Ringe aktualisieren 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 handlePlayerBosonHit(BosonProjectile s, MicroAtom target) { if (s.kind == 4) { // PHOTON: Quantensprung oder Ionisation if (target.electrons > 0) { if (target.excitedShell < 3) { target.excitedShell++; target.exciteTimer = 110; score += 25; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 3))); pushPhysicsLog("QUANTENSPRUNG! Elektron auf Schale n=" + target.excitedShell + " (" + nf(s.energyEv, 1, 2) + " eV)", "Gleich fällt das Elektron zurück und setzt ein Vakuum-Quantum frei!"); } else { target.electrons--; target.excitedShell = 1; score += 40; worldQuanta.add(new VacuumQuantum(target.x + 25, target.y)); worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 4))); pushPhysicsLog("PHOTO-IONISATION! Elektron aus " + getElementName(target.protons) + " gelöst!", "Das Atom ist jetzt ein positiv geladenes Ion (+1)."); } } else { pushPhysicsLog("Photon passiert nackten Kern (" + getElementName(target.protons) + ")", "Kein gebundenes Elektron vorhanden — wechsle auf Gluon [2] oder Elektron [4]!"); } } else if (s.kind == 5) { // GLUON: Starke Kernkraft -> Verschmilzt mit benachbartem Kern! MicroAtom partner = null; float bestD = 220.0; for (int k = 0; k < worldAtoms.size(); k++) { MicroAtom other = (MicroAtom) worldAtoms.get(k); if (other != target && !other.destroyed) { float d = dist(target.x, target.y, other.x, other.y); if (d < bestD) { bestD = d; partner = other; } } } if (partner != null) { target.protons += partner.protons; target.neutrons += partner.neutrons; target.electrons += partner.electrons; target.hostile = false; partner.destroyed = true; float bindMeV = calcBetheWeizsaecker(target.protons, target.neutrons); ladung = constrain(ladung + 15, 0, 100); score += 120; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 5))); pushPhysicsLog("KERNFUSION! " + getElementName(target.protons) + " gebildet (" + nf(bindMeV, 1, 1) + " MeV)", "Gluon überwindet Coulomb-Abstoßung -> +15% Batterie-Ladung!"); if (ladung >= 100) missionWon = true; } else { score += 15; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 5))); pushPhysicsLog("Gluon verstärkt Quark-Bindung im Kern", "Fliege in Gebiete mit mehreren Kernen (Sektor II), um sie zu fusionieren!"); } } else if (s.kind == 6) { // W-BOSON: Schwache Wechselwirkung (p <-> n Umwandlung, entschärft instabile Kerne) if (target.protons > 0) { target.protons--; target.neutrons++; boolean wasHostile = target.hostile; target.hostile = false; score += wasHostile ? 100 : 35; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 6))); pushPhysicsLog("SCHWACHE WECHSELWIRKUNG: Proton -> Neutron + Positron + Neutrino!", wasHostile ? "Instabiles Isotop erfolgreich stabilisiert (+100 Punkte)!" : "Kernladung Z um 1 reduziert."); } else if (target.neutrons > 0) { target.neutrons--; target.protons++; score += 35; worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 6))); pushPhysicsLog("BETA-ZERFALL: Neutron -> Proton + Elektron + Anti-Neutrino!", "Neues Proton erzeugt — bereit für Fusion oder Elektroneneinfang."); } } else { // ELEKTRON: Wird von positivem Ion eingefangen if (target.protons > target.electrons) { target.electrons++; score += 45; ladung = constrain(ladung + 6, 0, 100); worldRings.add(new ShockRing(target.x, target.y, getEntityColor(a11yTheme, 3))); pushPhysicsLog("ELEKTRONEN-EINFANG! Schale von " + getElementName(target.protons) + " aufgefüllt", "Elektrische Neutralität hergestellt (+6% Energie)."); if (ladung >= 100) missionWon = true; } else { pushPhysicsLog("Schale bereits gesättigt", "Das Elektron wird abgestoßen — suche positiv geladene Ionen (e < Z)!"); } } } void drawWorldEntities() { // 1. Grüne Vakuum-Quanten 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); strokeWeight(1.8); fill(8, 30, 36); ellipse(q.x, q.y, 20, 20); noStroke(); fill(255); ellipse(q.x, q.y, 6, 6); } // 2. Rote Singularitäts-Risse 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); strokeWeight(2.0); fill(35, 6, 14); ellipse(r.x, r.y, 26, 26); noStroke(); fill(rCol); ellipse(r.x, r.y, 10 + sin(simTime * 12.0 + r.phase) * 4.0, 10 + sin(simTime * 12.0 + r.phase) * 4.0); } // 3. Atome & Schalen int eCol = getEntityColor(a11yTheme, 3); int pCol = getEntityColor(a11yTheme, 1); int nCol = getEntityColor(a11yTheme, 2); 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; float shellR = 22.0 + a.excitedShell * 11.0; noFill(); stroke(a.hostile ? rCol : eCol); strokeWeight(1.2); ellipse(a.x, a.y, shellR * 2.0, shellR * 2.0); // Elektronen auf der Schale for (int e = 0; e < a.electrons; e++) { float ang = simTime * 2.2 + (TWO_PI * e) / max(1, a.electrons); noStroke(); fill(eCol); ellipse(a.x + cos(ang) * shellR, a.y + sin(ang) * shellR, 8, 8); } // Nukleonen im Kern int totalNuc = a.protons + a.neutrons; for (int k = 0; k < totalNuc; k++) { float offX = 0.0; float offY = 0.0; if (totalNuc > 1) { float kAng = (TWO_PI * k) / float(totalNuc) + simTime; offX = cos(kAng) * 6.5; offY = sin(kAng) * 6.5; } fill(k < a.protons ? pCol : nCol); stroke(255, 150); ellipse(a.x + offX, a.y + offY, 12, 12); } fill(245); textSize(10); textAlign(CENTER, TOP); String tag = getElementName(a.protons) + (a.hostile ? " [!]" : ""); text(tag, a.x, a.y + shellR + 4); } // 4. Bosonen-Projektile for (int i = 0; i < worldShots.size(); i++) { BosonProjectile s = (BosonProjectile) worldShots.get(i); fill(getEntityColor(a11yTheme, s.kind)); stroke(255); ellipse(s.x, s.y, 11, 11); } strokeWeight(1.0); } 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); strokeWeight(2.0); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } strokeWeight(1.0); } // ============================================================================================== // MODUL 7: PILOT-HUD, MINIMAP-RADAR & KLEINE ERKLÄR-TEXTE // ============================================================================================== void drawPilotHUD(float rootFactor) { int hudTop = height - 135; // Obere Sektor- & Telemetrie-Leiste fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 34); stroke(getUiPalette(a11yTheme, 4)); line(0, 34, width, 34); fill(255); textSize(12); textAlign(LEFT, CENTER); text(sectorName, 14, 17); textAlign(RIGHT, CENTER); text("Pos: (" + int(shipX) + ", " + int(shipY) + ") | v_TLW: " + nf(4.2 * rootFactor, 1, 2) + " c_eff", width - 14, 17); // Unteres Cockpit-Deck fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hudTop, width, 135); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); line(0, hudTop, width, hudTop); strokeWeight(1.0); // 1. Statuswerte: Score, Schild, Batterie-Balken fill(255); textSize(12); textAlign(LEFT, TOP); text("SCORE: " + score, 16, hudTop + 10); text("SCHILD: " + schild + "%", 130, hudTop + 10); fill(35, 42, 60); stroke(120, 145, 195); rect(235, hudTop + 10, 140, 15, 3); noStroke(); fill(getEntityColor(a11yTheme, 7)); rect(236, hudTop + 11, map(ladung, 0, 100, 0, 138), 13, 2); fill(255); text("BATTERIE: " + ladung + "%", 385, hudTop + 10); // 2. Waffenwahl [1]..[4] drawWeaponSlot(16, hudTop + 34, 1, "[1] Photon", getEntityColor(a11yTheme, 4)); drawWeaponSlot(142, hudTop + 34, 2, "[2] Gluon", getEntityColor(a11yTheme, 5)); drawWeaponSlot(268, hudTop + 34, 3, "[3] W-Boson", getEntityColor(a11yTheme, 6)); drawWeaponSlot(394, hudTop + 34, 4, "[4] Elektron", getEntityColor(a11yTheme, 3)); // 3. Auto-Aim & Sehhilfe Buttons drawCockpitBtn(526, hudTop + 8, 135, 24, autoAim ? "Auto-Aim [E]: AN" : "Auto-Aim [E]: AUS", autoAim ? color(20, 125, 75) : color(55, 65, 85)); String a11yLbl = (a11yTheme == 0) ? "Sehhilfe [H]" : ((a11yTheme == 1) ? "Farbenblind" : "Max-Kontrast"); drawCockpitBtn(668, hudTop + 8, 135, 24, a11yLbl, getUiPalette(a11yTheme, 3)); // 4. Kleiner DTIM-ZEC Bordcomputer-Text (Physik-Feedback & Ziel-Energie) if (logFlashTimer > 0) logFlashTimer--; fill(a11yTheme == 2 ? color(0) : color(8, 10, 18)); stroke(logFlashTimer > 0 ? getUiPalette(a11yTheme, 4) : color(55, 68, 95)); rect(16, hudTop + 66, 787, 58, 5); fill(getEntityColor(a11yTheme, 4)); textSize(11); textAlign(LEFT, TOP); text("SENSOR-ZIEL: " + targetInfoText, 26, hudTop + 72); fill(255); textSize(12); text(logHeadline, 26, hudTop + 90); fill(200, 215, 240); textSize(11); text(logSubtext, 26, hudTop + 108); // 5. Open-World Minimap-Radar unten rechts (115 x 115 px) 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); // Sektor-Kreuz im Radar stroke(45, 60, 90); line(mapX + mapSize * 0.5, mapY, mapX + mapSize * 0.5, mapY + mapSize); line(mapX, mapY + mapSize * 0.5, mapX + mapSize, mapY + mapSize * 0.5); noStroke(); // Quanta auf Radar fill(getEntityColor(a11yTheme, 7)); for (int i = 0; i < worldQuanta.size(); i++) { VacuumQuantum q = (VacuumQuantum) worldQuanta.get(i); float rx = map(q.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(q.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Risse auf Radar fill(getEntityColor(a11yTheme, 8)); for (int i = 0; i < worldRifts.size(); i++) { SingularityRift r = (SingularityRift) worldRifts.get(i); float rx = map(r.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(r.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Atome auf Radar fill(getEntityColor(a11yTheme, 3)); for (int i = 0; i < worldAtoms.size(); i++) { MicroAtom a = (MicroAtom) worldAtoms.get(i); float rx = map(a.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3); float ry = map(a.y, -HALF_WORLD, HALF_WORLD, mapY + 3, mapY + mapSize - 3); rect(rx, ry, 2, 2); } // Schiff auf Radar float sx = map(shipX, -HALF_WORLD, HALF_WORLD, mapX + 4, mapX + mapSize - 4); float sy = map(shipY, -HALF_WORLD, HALF_WORLD, mapY + 4, mapY + mapSize - 4); fill(255); ellipse(sx, sy, 5, 5); } void drawWeaponSlot(int bx, int by, int id, String label, int dotCol) { boolean sel = (activeWeapon == id); if (a11yTheme == 2) { fill(0); stroke(sel ? color(255, 255, 0) : color(255)); } else { fill(sel ? getUiPalette(a11yTheme, 2) : color(20, 25, 38)); stroke(sel ? getUiPalette(a11yTheme, 4) : color(60, 75, 105)); } rect(bx, by, 120, 26, 4); fill(dotCol); stroke(255); ellipse(bx + 14, by + 13, 10, 10); fill(255); textSize(11); textAlign(LEFT, CENTER); text(label, bx + 25, by + 13); } void drawCockpitBtn(int bx, int by, int bw, int bh, String label, int bgCol) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bgCol); stroke(120, 145, 195); } rect(bx, by, bw, bh, 4); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(11); textAlign(CENTER, CENTER); text(label, bx + bw * 0.5, by + bh * 0.5); } void drawBriefingModal() { fill(4, 5, 12, 225); noStroke(); rect(0, 0, width, height); fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(150, 130, 660, 350, 8); strokeWeight(1.0); fill(getUiPalette(a11yTheme, 2)); noStroke(); rect(151, 131, 658, 42, 7); fill(255); textSize(16); textAlign(LEFT, CENTER); text("SPACEX ULTIMATE: DTIM-ZEC MIKROKOSMOS-TRANSIT", 175, 152); fill(235, 240, 250); textSize(13); textAlign(LEFT, TOP); text("Willkommen im freien Open-World-Mikrokosmos (4 Sektoren):\n\n" + "1. Sammle gruene Vakuum-Quanten, um die Batterie auf 100% zu laden.\n" + "2. Weiche roten Singularitaets-Rissen aus (sie verzerren die Raumzeit).\n" + "3. Nutze deine Elementarteilchen-Kanone (Tasten 1 bis 4):\n" + " [1] Photon: Regt Elektronen an -> setzt neue Vakuum-Quanten frei!\n" + " [2] Gluon: Verschmilzt Protonen/Neutronen (Kernfusion +MeV)!\n" + " [3] W-Boson: Wandelt instabile Gegner-Protonen in Neutronen um!\n" + " [4] Elektron: Neutralisiert Ionen und laedt das Ring-Feld auf.", 175, 190); drawCockpitBtn(360, 415, 240, 42, "SYSTEME STARTEN >>", getUiPalette(a11yTheme, 2)); } void drawEndOverlay(String title, String sub) { fill(4, 5, 12, 220); noStroke(); rect(0, 0, width, height - 135); fill(getUiPalette(a11yTheme, 1)); stroke(getUiPalette(a11yTheme, 4)); strokeWeight(2.0); rect(210, 180, 540, 210, 8); strokeWeight(1.0); fill(255); textSize(20); textAlign(CENTER, CENTER); text(title, width * 0.5, 225); fill(220, 230, 245); textSize(13); text(sub + "\nEndstand: " + score + " Punkte", width * 0.5, 275); drawCockpitBtn(380, 325, 200, 40, "NEUSTART", getUiPalette(a11yTheme, 2)); } // ============================================================================================== // MODUL 8: MAUS- & TASTATUR-STEUERUNG // ============================================================================================== void mouseMoved() { if (!briefingOpen && !gameOver && !missionWon && mouseY < height - 135) { mouseSteer = true; } } void mousePressed() { if (briefingOpen) { if (mouseX >= 360 && mouseX <= 600 && mouseY >= 415 && mouseY <= 457) { briefingOpen = false; } return; } if (gameOver || missionWon) { if (mouseX >= 380 && mouseX <= 580 && mouseY >= 325 && mouseY <= 365) { resetMicroCosmos(); } return; } int hudTop = height - 135; if (mouseY >= hudTop) { // Waffen-Slots [1]..[4] if (mouseY >= hudTop + 34 && mouseY <= hudTop + 60) { if (mouseX >= 16 && mouseX <= 136) { activeWeapon = 1; return; } if (mouseX >= 142 && mouseX <= 262) { activeWeapon = 2; return; } if (mouseX >= 268 && mouseX <= 388) { activeWeapon = 3; return; } if (mouseX >= 394 && mouseX <= 514) { activeWeapon = 4; return; } } // Auto-Aim & Sehhilfe Buttons if (mouseY >= hudTop + 8 && mouseY <= hudTop + 32) { if (mouseX >= 526 && mouseX <= 661) { autoAim = !autoAim; return; } if (mouseX >= 668 && mouseX <= 803) { a11yTheme = (a11yTheme + 1) % 3; return; } } return; } // Klick ins Spielfeld feuert aktives Boson ab if (mouseY > 34 && mouseY < hudTop && mouseButton == LEFT) { fireStarshipWeapon(); } } void keyPressed() { if (key == '1') activeWeapon = 1; if (key == '2') activeWeapon = 2; if (key == '3') activeWeapon = 3; if (key == '4') activeWeapon = 4; if (key == 'e' || key == 'E') autoAim = !autoAim; if (key == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == ' ') { if (briefingOpen) briefingOpen = false; else fireStarshipWeapon(); } 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; } }