/** * ============================================================================================== * Modul: DTIM-ZEC NORN ATOM-STARSHIP, ZERO-CLICK BASES & 3D VOXEL CITADEL * Datei: TLW_Atom_Starship_Norn.pde * Framework: DTIM-ZEC MODULAR PHYSICS FRAMEWORK (DAMTP ACADEMIC STANDARD) * Architektur: Micro-Cosmos Flight + Norn Tech-Tree + 0-Click Space Bases + Isometric Voxel Builder * + Pure Software 3D DDA-Raycaster Walkthrough (ohne P3D) * 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] feuern | [0] 0-Klick-Modus * [1] Photon | [2] Gluon | [3] W-Boson | [4] Elektron | [5] Mesonenkanone * [T] Norn Tech-Tree | [B] 3D-Basis Isometrie | [V] Basis in 3D begehen | [H] Sehhilfe * ============================================================================================== */ // ============================================================================================== // MODUL 1: GLOBALE SYSTEM- & RESSOURCEN-VARIABLEN (100% PROCESSING.JS-SICHER) // ============================================================================================== int viewMode = 0; // 0 = Mikrokosmos-Flug, 1 = Tech-Tree [T], 2 = 3D-Isometrie [B], 3 = 3D-Begehung [V] int a11yTheme = 0; // 0 = DTIM Standard (Schwarz/Blutrot/Nachtblau), 1 = Farbenblind, 2 = Max-Kontrast float simTime = 0.0; // Welt & Schiff 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; // Rohstoffe, Handel & Forschung int rawErz = 45; // Geerntetes Roh-Erz im Frachtraum int refinedErz = 60; // Verarbeitetes Bau-Erz (alle 100 -> +1 Erz-Würfel in 3D-Basis!) int totalErzBuilt = 60; // Kumuliertes Erz für 3D-Würfel-Meilensteine int rawQuanta = 3; // Gesammelte Vakuum-Quanten für das Forschungslabor int researchFP = 65; // Verfügbare Forschungspunkte (FP) int totalFPBuilt = 65; // Kumulierte FP (alle 100 -> +1 Forschungs-Würfel in 3D-Basis!) int creditsEUR = 40; // Handelsguthaben (EUR) int wasteEntropy = 0; // Entropie-Abfall (durch Plasma-Pad verwertbar) int hullHP = 100; int maxHullHP = 100; int chargoMax = 80; // Kampf & Steuerung int activeWeapon = 5; // 1=Photon, 2=Gluon, 3=W-Boson, 4=Elektron, 5=Mesonenkanone boolean autoAim = true; boolean zeroClick = false; int autoFireTimer = 0; float aimAngle = 0.0; float currentEv = 10.20; SpaceNode lockedNode = null; String sensorInfo = "Norn-Sensoren aktiv"; boolean keyW = false, keyA = false, keyS = false, keyD = false; boolean keyTurnL = false, keyTurnR = false; boolean mouseSteer = true; // Zwei 0-Klick-Raumbasen im Mikrokosmos float baseAlphaX = 540.0; // Basis Alpha (NO): Erz-Raffinerie, Markt & Werft float baseAlphaY = -440.0; float baseBetaX = -540.0; // Basis Beta (SW): Norn-Forschungsstation & Plasma-Synthese float baseBetaY = 440.0; float padWorkAlpha = 0.0; float padWorkBeta = 0.0; // Entitäten-Listen ArrayList spaceNodes; ArrayList spaceQuanta; ArrayList spaceRifts; ArrayList spaceShots; ArrayList shockRings; String bannerHead = "Norn-Crew bereit: Fliege über Basis Alpha (NO) & Beta (SW) für 0-Klick-Verarbeitung!"; String bannerSub = "Alle 100 Erz = 1 Erz-Würfel | Alle 100 FP = 1 Forschungs-Würfel · [B] 3D-Basis | [V] Begehung"; int bannerFlash = 0; // ============================================================================================== // MODUL 2: NORN TECH-TREE VARIABLEN (12 KNOTEN IN 4 ZWEIGEN) // ============================================================================================== int NUM_TECH = 12; String[] tCode = new String[12]; String[] tTitle = new String[12]; String[] tBranch = new String[12]; String[] tDesc = 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]; int selectedTech = 0; boolean freeTechMode = false; float nornAtpPulse = 40.0; // ============================================================================================== // MODUL 3: 3D VOXEL-BASIS & SOFTWARE 3D-RAYCASTER VARIABLEN (OHNE P3D!) // ============================================================================================== int BASE_DIM = 14; int BASE_HEIGHT = 6; // baseVoxels[x + y*14 + z*196]: 0 = Frei, 1 = Erz-Würfel (Blutrot/Titan), 2 = Forschungs-Würfel (Nachtblau/Gold) int[] baseVoxels = new int[14 * 14 * 6]; int erzCubesCount = 0; int fpCubesCount = 0; int isoRotation = 0; // 0..3 (0°, 90°, 180°, 270°) // Ego-Perspektive in der 3D-Basis-Begehung (Mode 3) float walkX = 7.5; float walkY = 7.5; float walkDirX = 1.0; float walkDirY = 0.0; float walkPlaneX = 0.0; float walkPlaneY = 0.66; float[] walkZBuf = new float[760]; // ============================================================================================== // FARB-PALETTEN (SCHWARZ / DUNKLES BLUTROT / NACHTBLAU / SILBERGRAU + SEHHILFE) // ============================================================================================== 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 getKindColor(int theme, int k) { // 1=Proton, 2=Neutron, 3=Elektron, 4=Photon, 5=Gluon, 6=W-Boson, 7=Quantum, 8=Rift, 9=Meson, 10=Erz-Asteroid if (theme == 1) { if (k == 9 || k == 10) return color(251, 191, 36); if (k == 7) return color(52, 211, 153); if (k == 8) return color(244, 114, 182); return color(56, 189, 248); } if (theme == 2) { if (k == 8) return color(255, 0, 255); if (k == 7 || k == 10) return color(0, 255, 255); return color(255, 255, 0); } 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); if (k == 9) return color(255, 135, 55); return color(175, 130, 85); // Erz-Asteroid } void pushBanner(String h, String s) { bannerHead = h; bannerSub = s; bannerFlash = 90; } // ============================================================================================== // INITIALISIERUNG // ============================================================================================== void setup() { size(1120, 740); noSmooth(); frameRate(60); spaceNodes = new ArrayList(); spaceQuanta = new ArrayList(); spaceRifts = new ArrayList(); spaceShots = new ArrayList(); shockRings = new ArrayList(); initTechNodes(); initVoxelBase(); seedCosmosWorld(); } void initTechNodes() { setTech(0, "A1", "120°-Waben-Kopplung", "Antrieb", 0, 0, -1, 15, "Verankert das Norn-Schiff auf dem diskreten Gitter (+15% Tempo)."); setTech(1, "A2", "ALDI-YBCO Supraleiter-Ring", "Antrieb", 0, 1, 0, 30, "Spartanischer Heckring für asymmetrischen Phasengradienten (+30% Schub)."); setTech(2, "A3", "Adjacency-Fold-Drive (0.0 G)", "Antrieb", 0, 2, 1, 55, "Trägheitslose Gitter-Faltung im Sub-Atomraum (+40% Max-Tempo)."); setTech(3, "B1", "Bohr-Slater Resonanz-Photon", "Waffen", 1, 0, -1, 15, "Stimmt Photonen automatisch auf Elektronenschalen-Übergänge ab."); setTech(4, "B2", "Mesonenkanone (Pi+/- Salve)", "Waffen", 1, 1, 3, 30, "Zerstört Singularitäts-Risse & sprengt Erz-Asteroiden; ab St. 2 Doppelsalve!"); setTech(5, "B3", "Gluon- & W-Boson-Injektor", "Waffen", 1, 2, 4, 55, "Extrahiert doppelte Erz- & Isotopen-Ausbeute aus Kernen."); setTech(6, "C1", "CNT-Aerogel-Panzerung", "Panzerung", 2, 0, -1, 15, "Nanoröhren-Panzerung erhöht Hüllenintegrität (+45 Max-HP pro Stufe)."); setTech(7, "C2", "Zeno-Stasis-Deflektorschild", "Panzerung", 2, 1, 6, 35, "Gigahertz-Stasis-Schild dämpft Riss-Kollisionen um 50%."); setTech(8, "C3", "EVM-Void-Riss-Absorber", "Panzerung", 2, 2, 7, 60, "Leitet Einschlagenergie verlustfrei in den Void ab (+Regeneration)."); setTech(9, "D1", "Norn-Biochemie-Pilot (ATP)", "Norn-Crew", 3, 0, -1, 15, "Norn-Crew erzeugt kontinuierlich Forschungspunkte (FP) über ATP-Synthese."); setTech(10, "D2", "Quanten-Traktor & Chargo", "Norn-Crew", 3, 1, 9, 30, "Zieht Erz & Quanta aus weitem Radius an und vergrößert Chargo (+40/Stufe)."); setTech(11, "D3", "Plasma-Synthesizer (Waste)", "Norn-Crew", 3, 2, 10, 50, "Wandelt Entropie-Waste auf Basis Beta automatisch in Erz + FP um."); for (int i = 0; i < NUM_TECH; i++) tLevel[i] = 0; tLevel[0] = 1; tLevel[4] = 1; tLevel[9] = 1; recalcShipCapabilities(); } void setTech(int idx, String c, String ti, String br, int bId, int tr, int pre, int cost, String d) { tCode[idx] = c; tTitle[idx] = ti; tBranch[idx] = br; tBranchId[idx] = bId; tTier[idx] = tr; tPrereq[idx] = pre; tCost[idx] = cost; tDesc[idx] = d; } void recalcShipCapabilities() { maxHullHP = 100 + tLevel[6] * 45; hullHP = min(maxHullHP, hullHP); chargoMax = 80 + tLevel[10] * 40; } void seedCosmosWorld() { spaceNodes.clear(); spaceQuanta.clear(); spaceRifts.clear(); spaceShots.clear(); shockRings.clear(); for (int i = 0; i < 36; i++) { spaceQuanta.add(new VacuumQuantum(random(-HALF_WORLD + 120, HALF_WORLD - 120), random(-HALF_WORLD + 120, HALF_WORLD - 120))); } for (int i = 0; i < 20; 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(baseAlphaX, baseAlphaY, rx, ry) > 260.0 && dist(baseBetaX, baseBetaY, rx, ry) > 260.0) { spaceRifts.add(new SingularityRift(rx, ry)); } } // Erz-Asteroiden & Atom-Knoten im Raum verteilen for (int i = 0; i < 32; i++) { float ax = random(-HALF_WORLD + 160, HALF_WORLD - 160); float ay = random(-HALF_WORLD + 160, HALF_WORLD - 160); if (dist(0, 0, ax, ay) < 200.0) continue; boolean isOre = (i % 2 == 0); spaceNodes.add(new SpaceNode(ax, ay, isOre ? 10 : (i % 3 == 0 ? 6 : 1), isOre)); } } // ============================================================================================== // 3D VOXEL-BASIS WACHSTUM (ALLE 100 ERZ = 1 ERZ-WÜRFEL | ALLE 100 FP = 1 FORSCHUNGS-WÜRFEL) // ============================================================================================== void initVoxelBase() { for (int i = 0; i < baseVoxels.length; i++) baseVoxels[i] = 0; erzCubesCount = 0; fpCubesCount = 0; // Außenring-Eckpfeiler als Start-Anker der Raumbasis 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, 2); } int getBaseVoxel(int x, int y, int z) { if (x < 0 || x >= BASE_DIM || y < 0 || y >= BASE_DIM || z < 0 || z >= BASE_HEIGHT) return -1; return 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) return; baseVoxels[x + y * BASE_DIM + z * BASE_DIM * BASE_DIM] = val; } void checkBaseVoxelMilestones() { while (totalErzBuilt >= (erzCubesCount + 1) * 100) { erzCubesCount++; growVoxelCubeInBase(1); pushBanner("3D-BASIS GEWACHSEN! +1 Erz-Würfel (100 Erz erreicht · Gesamt: " + erzCubesCount + ")", "Wechsle zu [B] 3D-Isometrie oder [V] 3D-Begehung, um deine Basis zu erkunden!"); } while (totalFPBuilt >= (fpCubesCount + 1) * 100) { fpCubesCount++; growVoxelCubeInBase(2); pushBanner("3D-BASIS GEWACHSEN! +1 Forschungs-Würfel (100 FP erreicht · Gesamt: " + fpCubesCount + ")", "Andersfarbiger Kristall-Block im Forschungsflügel der 3D-Basis errichtet!"); } } // Platziert neue Würfel strukturiert in der Basis, lässt aber Laufgänge (x=7 oder y=7) für [V] frei! 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; // Hauptkorridore (x == 7 oder y == 7) und Zentrum (6..8, 6..8) auf Ebene Z=0 begehbar lassen! if (z == 0 && (x == 7 || y == 7 || (abs(x - 7) <= 1 && abs(y - 7) <= 1))) continue; // Erz-Würfel bevorzugen Ost-Hälfte, Forschungs-Würfel West-Hälfte (oder freie Plätze) if (cubeType == 1 && x < 7 && z == 0) continue; if (cubeType == 2 && x > 7 && z == 0) continue; if (getBaseVoxel(x, y, z) == 0) { if (z == 0 || getBaseVoxel(x, y, z - 1) > 0) { setBaseVoxel(x, y, z, cubeType); return; } } } } } } // Fallback: Jede freie Zelle außer Hauptkorridor for (int z = 0; z < BASE_HEIGHT; z++) { for (int y = 1; y < BASE_DIM - 1; y++) { for (int x = 1; x < BASE_DIM - 1; x++) { if (x == 7 || y == 7) continue; if (getBaseVoxel(x, y, z) == 0) { setBaseVoxel(x, y, z, cubeType); return; } } } } } // ============================================================================================== // HAUPTSCHLEIFE (MODE MULTIPLEXER) // ============================================================================================== void draw() { background(getUiPalette(a11yTheme, 0)); simTime += 0.025; // Norn-Biochemie erzeugt passiv Forschungspunkte if (tLevel[9] > 0) { nornAtpPulse += 0.12 * tLevel[9]; if (nornAtpPulse >= 100.0) { nornAtpPulse = 0.0; addResearchFP(2 * tLevel[9]); } } if (viewMode == 0) drawFlightMode(); else if (viewMode == 1) drawTechTreeMode(); else if (viewMode == 2) drawIsometricBaseMode(); else if (viewMode == 3) drawWalk3DBaseMode(); drawGlobalTopBar(); } void addResearchFP(int amount) { researchFP += amount; totalFPBuilt += amount; checkBaseVoxelMilestones(); } void addRefinedErz(int amount) { refinedErz += amount; totalErzBuilt += amount; checkBaseVoxelMilestones(); } // ============================================================================================== // GLOBALE TOP-LEISTE (MODUS-WECHSEL: FLUG / TECH-TREE / 3D-ISOMETRIE / 3D-BEGEHUNG) // ============================================================================================== void drawGlobalTopBar() { fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, 0, width, 38); stroke(getUiPalette(a11yTheme, 4)); line(0, 38, width, 38); drawNavBtn(12, 5, 145, 28, "[1] Mikrokosmos-Flug", viewMode == 0 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(163, 5, 145, 28, "[T] Norn Tech-Tree", viewMode == 1 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(314, 5, 155, 28, "[B] 3D-Basis (" + (erzCubesCount + fpCubesCount) + " Blöcke)", viewMode == 2 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); drawNavBtn(475, 5, 155, 28, "[V] Basis Begehung 3D", viewMode == 3 ? getUiPalette(a11yTheme, 2) : color(22, 28, 42)); // Kompakte Ressourcen-Anzeige fill(255); textSize(11); textAlign(LEFT, CENTER); text("Erz: " + refinedErz + " (Würfel: " + erzCubesCount + ") | FP: " + researchFP + " (Würfel: " + fpCubesCount + ") | " + creditsEUR + " EUR", 642, 19); String a11yLbl = (a11yTheme == 0) ? "Sehhilfe [H]" : ((a11yTheme == 1) ? "Farbenblind" : "Max-Kontrast"); drawNavBtn(width - 122, 5, 110, 28, a11yLbl, getUiPalette(a11yTheme, 3)); } void drawNavBtn(int bx, int by, int bw, int bh, String lbl, int bg) { if (a11yTheme == 2) { fill(0); stroke(255, 255, 0); } else { fill(bg); stroke(125, 160, 220); } rect(bx, by, bw, bh, 5); fill(a11yTheme == 2 ? color(255, 255, 0) : color(255)); textSize(11); textAlign(CENTER, CENTER); text(lbl, bx + bw * 0.5, by + bh * 0.5); } // ============================================================================================== // MODE 0: MIKROKOSMOS-FLUG & ZWEI 0-KLICK-RAUMBASEN // ============================================================================================== void drawFlightMode() { float speedMult = 1.0 + tLevel[0] * 0.15 + tLevel[1] * 0.25 + tLevel[2] * 0.35; updateShipKinematics(speedMult); updateAutoAimTarget(); updateSpaceEntities(); processZeroClickBases(); if (zeroClick) { if (autoFireTimer > 0) autoFireTimer--; if (lockedNode != null && autoFireTimer <= 0) { fireActiveWeapon(); autoFireTimer = 22; } } camX = lerp(camX, shipX, 0.12); camY = lerp(camY, shipY, 0.12); pushMatrix(); translate(width * 0.5 - camX, (height - 130) * 0.5 - camY); drawSpacetimeHexGrid(); drawSpaceBases(); drawSpaceEntities(); drawAimBeam(); pushMatrix(); translate(shipX, shipY); rotate(shipAngle); drawNornStarship(); popMatrix(); popMatrix(); drawFlightHUD(speedMult); } void drawSpacetimeHexGrid() { int step = 46; 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 < 180.0) ? map(d, 0, 180, 16.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) * 23.0, py + sin(a) * 23.0); } endShape(CLOSE); } } } // Zeichnet die beiden 0-Klick-Raumbasen mit ihren Überflug-Pads void drawSpaceBases() { // --- BASIS ALPHA (NO): ERZ-RAFFINERIE, MARKT & WERFT --- pushMatrix(); translate(baseAlphaX, baseAlphaY); fill(14, 18, 28, 220); stroke(225, 55, 85); strokeWeight(2.0); rect(-175, -125, 350, 250, 10); strokeWeight(1.0); fill(255); textSize(13); textAlign(CENTER, TOP); text("BASIS ALPHA: ERZ-RAFFINERIE & MARKT (0-Klick Überflug)", 0, -116); drawBasePad(-155, -80, 145, 78, color(122, 16, 38), "1. Erz-Schmelze", "Roh-Erz -> Bau-Erz\n(100 = +1 3D-Würfel)"); drawBasePad(10, -80, 145, 78, color(18, 46, 98), "2. Handels-Dock", "Verkauft Erz-Überschuss\nfür EUR Credits"); drawBasePad(-155, 15, 310, 88, color(20, 105, 65), "3. Werft- & Reparatur-Dock", "Repariert Hülle & zeigt 3D-Basis-Status (" + erzCubesCount + " Erz-Würfel)"); popMatrix(); // --- BASIS BETA (SW): NORN-FORSCHUNGSSTATION & PLASMA-LABOR --- pushMatrix(); translate(baseBetaX, baseBetaY); fill(14, 18, 28, 220); stroke(56, 189, 248); strokeWeight(2.0); rect(-175, -125, 350, 250, 10); strokeWeight(1.0); fill(255); textSize(13); textAlign(CENTER, TOP); text("BASIS BETA: NORN-FORSCHUNGSSTATION (0-Klick Überflug)", 0, -116); drawBasePad(-155, -80, 145, 78, color(18, 46, 98), "1. Quanten-Labor", "Quanta -> Forschung (FP)\n(100 = +1 3D-Würfel)"); drawBasePad(10, -80, 145, 78, color(122, 16, 38), "2. Plasma-Synthese", "Verwertet Waste (" + wasteEntropy + ")\nin Erz + FP"); drawBasePad(-155, 15, 310, 88, color(145, 100, 18), "3. Norn-Biochemie-Kuppel", "ATP-Boost für Norn-Crew · Öffne [T] Tech-Tree oder [V] 3D-Walk"); popMatrix(); } void drawBasePad(float px, float py, float pw, float ph, int col, String title, String desc) { fill(col); stroke(220, 232, 250); rect(px, py, pw, ph, 6); fill(255); textSize(12); textAlign(CENTER, TOP); text(title, px + pw * 0.5, py + 8); fill(235, 242, 255); textSize(10); text(desc, px + pw * 0.5, py + 30); } // 0-Klick-Verarbeitung beim Überfliegen der Stations-Pads void processZeroClickBases() { // Basis Alpha Pads float ax = shipX - baseAlphaX; float ay = shipY - baseAlphaY; if (abs(ax) < 175 && abs(ay) < 125) { // Pad 1: Erz-Schmelze (-155..-10, -80..-2) if (ax >= -155 && ax <= -10 && ay >= -80 && ay <= -2) { if (rawErz > 0 && frameCount % 8 == 0) { int batch = min(5, rawErz); rawErz -= batch; addRefinedErz(batch * 2); pushBanner("Erz-Schmelze (0-Klick): +" + (batch * 2) + " Bau-Erz verarbeitet! (" + (totalErzBuilt % 100) + "/100 bis nächster Würfel)", "Fliege weiter oder besuche die wachsende 3D-Basis unter [B] oder [V]!"); } } // Pad 2: Handels-Dock (10..155, -80..-2) if (ax >= 10 && ax <= 155 && ay >= -80 && ay <= -2) { if (refinedErz >= 20 && frameCount % 18 == 0) { refinedErz -= 20; creditsEUR += 15; pushBanner("Handels-Dock (0-Klick): 20 Erz für +15 EUR verkauft! (Guthaben: " + creditsEUR + " EUR)", "Tipp: Im Tech-Tree [T] kannst du EUR gegen Forschungspunkte tauschen."); } } // Pad 3: Werft-Reparatur (-155..155, 15..103) if (ax >= -155 && ax <= 155 && ay >= 15 && ay <= 103) { if (hullHP < maxHullHP && frameCount % 6 == 0) { hullHP = min(maxHullHP, hullHP + 2); } } } // Basis Beta Pads float bx = shipX - baseBetaX; float by = shipY - baseBetaY; if (abs(bx) < 175 && abs(by) < 125) { // Pad 1: Quanten-Labor (-155..-10, -80..-2) if (bx >= -155 && bx <= -10 && by >= -80 && by <= -2) { if (rawQuanta > 0 && frameCount % 12 == 0) { rawQuanta--; int fpGain = 14 + tLevel[9] * 4; addResearchFP(fpGain); pushBanner("Quanten-Labor (0-Klick): Quantum analysiert -> +" + fpGain + " FP! (" + (totalFPBuilt % 100) + "/100 bis nächster Würfel)", "Alle 100 FP wächst ein neuer Forschungs-Würfel in deiner 3D-Basis!"); } } // Pad 2: Plasma-Synthese (10..155, -80..-2) if (bx >= 10 && bx <= 155 && by >= -80 && by <= -2) { if (wasteEntropy > 0 && frameCount % 12 == 0) { wasteEntropy--; addRefinedErz(8); addResearchFP(8); pushBanner("Plasma-Synthese (0-Klick): Waste recycelt -> +8 Bau-Erz & +8 FP!", "DTIM-ZEC Kreislaufwirtschaft aktiv."); } } // Pad 3: Norn-Biochemie-Kuppel (-155..155, 15..103) if (bx >= -155 && bx <= 155 && by >= 15 && by <= 103) { if (frameCount % 25 == 0) { addResearchFP(2); } } } } void updateShipKinematics(float speedMult) { float maxSpd = 4.3 * speedMult; if (keyTurnL) shipAngle -= 0.055; if (keyTurnR) shipAngle += 0.055; if (keyW || keyS) { mouseSteer = false; float thrust = keyW ? 0.25 : -0.16; shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; } else if (mouseSteer && mouseY > 40 && mouseY < height - 130) { float sx = width * 0.5 + (shipX - camX); float sy = (height - 130) * 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 updateAutoAimTarget() { lockedNode = null; float bestD = 360.0; for (int i = 0; i < spaceNodes.size(); i++) { SpaceNode n = (SpaceNode) spaceNodes.get(i); float d = dist(shipX, shipY, n.x, n.y); if (d < bestD) { bestD = d; lockedNode = n; } } if (autoAim && lockedNode != null) { aimAngle = atan2(lockedNode.y - shipY, lockedNode.x - shipX); sensorInfo = lockedNode.isOreAsteroid ? "Erz-Asteroid erfasst (Mesonen/Gluon baut Erz ab)" : "Atom-Kern Z=" + lockedNode.zVal + " erfasst"; } else { aimAngle = shipAngle; sensorInfo = "Sensoren scannen Mikrokosmos · Fliege zu Basis Alpha (NO) oder Beta (SW)"; } } void drawAimBeam() { if (!autoAim || lockedNode == null) return; stroke(getKindColor(a11yTheme, activeWeapon == 5 ? 9 : 4)); strokeWeight(1.5); line(shipX, shipY, lockedNode.x, lockedNode.y); noFill(); ellipse(lockedNode.x, lockedNode.y, 68, 68); strokeWeight(1.0); } void drawNornStarship() { if (tLevel[7] > 0) { noFill(); stroke(45, 210, 145, 160); strokeWeight(1.8); ellipse(0, 0, 114, 70); } stroke(0, 255, 180); strokeWeight(2.0 + tLevel[1] * 0.5); fill(18, 28, 45); ellipse(-26, 0, 16, 48 + tLevel[1] * 4); fill(235, 240, 250); stroke(tLevel[6] > 0 ? color(45, 210, 145) : color(30, 42, 60)); strokeWeight(1.5 + 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(a11yTheme, 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; float 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) { float px = -sin(aimAngle) * 8.0; float py = cos(aimAngle) * 8.0; spaceShots.add(new BosonShot(nx + px, ny + py, cos(aimAngle) * 11.0, sin(aimAngle) * 11.0, 9)); } } void updateSpaceEntities() { float traktorR = 45.0 + tLevel[10] * 45.0; 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.0 + tLevel[10] * 0.8); q.y += ((shipY - q.y) / d) * (2.0 + tLevel[10] * 0.8); } if (d < 34.0) { rawQuanta++; q.x = random(-HALF_WORLD + 140, HALF_WORLD - 140); q.y = random(-HALF_WORLD + 140, HALF_WORLD - 140); pushBanner("Vakuum-Quantum gesammelt (Quanta: " + rawQuanta + ") — Fliege zu Basis Beta (SW) für FP!", "Im Quanten-Labor von Basis Beta wird jedes Quantum automatisch zu Forschungspunkten."); } } 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) { int dmg = max(6, 26 - tLevel[6] * 5 - tLevel[7] * 5); hullHP = max(10, hullHP - dmg); wasteEntropy++; r.x = shipX + cos(shipAngle + PI) * 420.0; r.y = shipY + sin(shipAngle + PI) * 420.0; } } for (int i = spaceNodes.size() - 1; i >= 0; i--) { SpaceNode n = (SpaceNode) spaceNodes.get(i); n.x += n.vx; n.y += n.vy; if (n.x < -HALF_WORLD + 90 || n.x > HALF_WORLD - 90) n.vx = -n.vx; if (n.y < -HALF_WORLD + 90 || n.y > HALF_WORLD - 90) n.vy = -n.vy; } 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(a11yTheme, 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 < spaceNodes.size(); j++) { SpaceNode target = (SpaceNode) spaceNodes.get(j); if (dist(s.x, s.y, target.x, target.y) < 40.0) { if (target.isOreAsteroid) { int erzGain = 15 + tLevel[5] * 8; rawErz = min(chargoMax, rawErz + erzGain); pushBanner("Erz-Asteroid abgebaut: +" + erzGain + " Roh-Erz (Fracht: " + rawErz + "/" + chargoMax + ")!", "Fliege über Basis Alpha (NO), um das Erz zu schmelzen (100 Erz = +1 3D-Würfel)!"); } else { spaceQuanta.add(new VacuumQuantum(target.x + 20, target.y)); addResearchFP(5); } shockRings.add(new ShockRing(target.x, target.y, getKindColor(a11yTheme, s.kind))); target.x = random(-HALF_WORLD + 160, HALF_WORLD - 160); target.y = random(-HALF_WORLD + 160, HALF_WORLD - 160); 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); } } void drawSpaceEntities() { int qCol = getKindColor(a11yTheme, 7); 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) continue; stroke(qCol); fill(8, 30, 36); ellipse(q.x, q.y, 18, 18); } int rCol = getKindColor(a11yTheme, 8); 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) continue; stroke(rCol); fill(35, 6, 14); ellipse(r.x, r.y, 26, 26); } for (int i = 0; i < spaceNodes.size(); i++) { SpaceNode n = (SpaceNode) spaceNodes.get(i); if (abs(n.x - camX) > width * 0.65 || abs(n.y - camY) > height * 0.65) continue; if (n.isOreAsteroid) { fill(getKindColor(a11yTheme, 10)); stroke(255, 180); rect(n.x - 14, n.y - 14, 28, 28, 5); } else { noFill(); stroke(getKindColor(a11yTheme, 3)); ellipse(n.x, n.y, 54, 54); fill(getKindColor(a11yTheme, 1)); noStroke(); ellipse(n.x, n.y, 14, 14); } } for (int i = 0; i < spaceShots.size(); i++) { BosonShot s = (BosonShot) spaceShots.get(i); fill(getKindColor(a11yTheme, 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); ellipse(r.x, r.y, r.r * 2.0, r.r * 2.0); } } void drawFlightHUD(float speedMult) { int hudTop = height - 130; fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, hudTop, width, 130); stroke(getUiPalette(a11yTheme, 4)); line(0, hudTop, width, hudTop); fill(255); textSize(11); textAlign(LEFT, TOP); text("Hülle: " + hullHP + "/" + maxHullHP + " | Roh-Erz: " + rawErz + "/" + chargoMax + " | Quanta: " + rawQuanta + " | Nächster Erz-Würfel: " + (totalErzBuilt % 100) + "/100 | Nächster FP-Würfel: " + (totalFPBuilt % 100) + "/100", 16, hudTop + 10); drawWpnSlot(16, hudTop + 32, 1, "[1] Photon", getKindColor(a11yTheme, 4)); drawWpnSlot(136, hudTop + 32, 2, "[2] Gluon", getKindColor(a11yTheme, 5)); drawWpnSlot(256, hudTop + 32, 3, "[3] W-Boson", getKindColor(a11yTheme, 6)); drawWpnSlot(376, hudTop + 32, 4, "[4] Elektron", getKindColor(a11yTheme, 3)); drawWpnSlot(496, hudTop + 32, 5, "[5] Mesonen", getKindColor(a11yTheme, 9)); drawNavBtn(624, hudTop + 32, 145, 26, zeroClick ? "0-Klick [0]: AN" : "0-Klick [0]: AUS", zeroClick ? color(20, 125, 75) : color(35, 45, 65)); drawNavBtn(777, hudTop + 32, 185, 26, "3D-Basis ansehen [B]", getUiPalette(a11yTheme, 2)); fill(8, 10, 18); stroke(55, 68, 95); rect(16, hudTop + 64, 946, 56, 5); fill(getKindColor(a11yTheme, 4)); textAlign(LEFT, TOP); text("SENSOR: " + sensorInfo, 26, hudTop + 70); fill(255); textSize(12); text(bannerHead, 26, hudTop + 88); fill(200, 215, 240); textSize(11); text(bannerSub, 26, hudTop + 105); // Minimap rechts unten (zeigt Basis Alpha NO und Basis Beta SW) int mapSize = 110; int mapX = width - mapSize - 16; int mapY = hudTop + 10; fill(4, 6, 12); stroke(getUiPalette(a11yTheme, 4)); rect(mapX, mapY, mapSize, mapSize, 4); // Basis Alpha (NO) & Beta (SW) fill(225, 55, 85); noStroke(); rect(map(baseAlphaX, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6) - 4, map(baseAlphaY, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6) - 4, 8, 8); fill(56, 189, 248); rect(map(baseBetaX, -HALF_WORLD, HALF_WORLD, mapX + 6, mapX + mapSize - 6) - 4, map(baseBetaY, -HALF_WORLD, HALF_WORLD, mapY + 6, mapY + mapSize - 6) - 4, 8, 8); // Erz-Asteroiden fill(175, 130, 85); for (int i = 0; i < spaceNodes.size(); i++) { SpaceNode n = (SpaceNode) spaceNodes.get(i); if (n.isOreAsteroid) { rect(map(n.x, -HALF_WORLD, HALF_WORLD, mapX + 3, mapX + mapSize - 3), map(n.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 drawWpnSlot(int bx, int by, int id, String lbl, int c) { 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, 114, 26, 4); fill(c); noStroke(); ellipse(bx + 12, by + 13, 9, 9); fill(255); textSize(11); textAlign(LEFT, CENTER); text(lbl, bx + 22, by + 13); } // ============================================================================================== // MODE 1: NORN TECH-TREE [T] // ============================================================================================== void drawTechTreeMode() { fill(getUiPalette(a11yTheme, 1)); stroke(59, 110, 194); rect(16, 48, width - 32, 676, 8); fill(255); textSize(16); textAlign(LEFT, TOP); text("NORN-FORSCHUNGSBAUM — VERFÜGBARE FP: " + researchFP + " | GUTHABEN: " + creditsEUR + " EUR", 32, 62); drawNavBtn(width - 420, 58, 195, 28, freeTechMode ? "Modus: Freies Klicken [M]" : "Modus: FP-Kosten [M]", freeTechMode ? color(20, 125, 75) : getUiPalette(a11yTheme, 2)); drawNavBtn(width - 215, 58, 185, 28, "30 EUR -> +25 FP tauschen", getUiPalette(a11yTheme, 3)); for (int i = 0; i < NUM_TECH; i++) { int br = tBranchId[i]; int tr = tTier[i]; float nx = 32 + br * 268; float ny = 108 + tr * 195; float nw = 252; float nh = 176; boolean unlocked = freeTechMode || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int lvl = tLevel[i]; fill(lvl > 0 ? color(20, 32, 54) : color(15, 19, 30)); stroke(lvl > 0 ? getUiPalette(a11yTheme, 4) : color(55, 68, 95)); rect(nx, ny, nw, nh, 6); fill(255); textSize(12); textAlign(LEFT, TOP); text(tCode[i] + " · " + tBranch[i], nx + 10, ny + 8); textAlign(RIGHT, TOP); text("Stufe " + lvl + "/3", nx + nw - 10, ny + 8); textAlign(LEFT, TOP); textSize(13); text(tTitle[i], nx + 10, ny + 30, nw - 20, 36); fill(210, 225, 245); textSize(11); text(tDesc[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, "MAXIMAL AUSGEBAUT (3/3)", color(20, 115, 70)); } else if (!unlocked) { drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, "Benötigt " + tCode[tPrereq[i]], color(40, 48, 68)); } else { String lbl = freeTechMode ? "Ausbauen -> St. " + (lvl + 1) : "Forschen (" + cost + " FP)"; int bg = (freeTechMode || researchFP >= cost) ? getUiPalette(a11yTheme, 2) : color(45, 52, 72); drawNavBtn(int(nx + 10), int(ny + 136), int(nw - 20), 28, lbl, bg); } } } // ============================================================================================== // MODE 2: 3D-BASIS ISOMETRIE-ANSICHT [B] (WÄCHST PRO 100 ERZ & 100 FORSCHUNG) // ============================================================================================== void drawIsometricBaseMode() { fill(getUiPalette(a11yTheme, 1)); stroke(59, 110, 194); rect(16, 48, width - 32, 676, 8); fill(255); textSize(16); textAlign(LEFT, TOP); text("3D-RAUMBASIS ISOMETRIE — ERZ-WÜRFEL: " + erzCubesCount + " | FORSCHUNGS-WÜRFEL: " + fpCubesCount, 32, 62); fill(215, 228, 248); textSize(12); text("Jede 100 verarbeiteten Erz = 1 Blutrot/Titan-Würfel · Jede 100 FP = 1 Blau/Gold-Kristallwürfel", 32, 86); drawNavBtn(width - 490, 58, 135, 30, "Drehen [Q/E]", getUiPalette(a11yTheme, 3)); drawNavBtn(width - 347, 58, 155, 30, "+100 Erz (Test-Würfel)", getUiPalette(a11yTheme, 2)); drawNavBtn(width - 184, 58, 155, 30, "+100 FP (Test-Würfel)", getUiPalette(a11yTheme, 3)); float originX = width * 0.5; float originY = 230.0; float hw = 22.0; float hh = 11.0; float ch = 22.0; // Boden-Gitter (14 x 14) stroke(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); } // Solide isometrische Würfel rendern (Painter's Algorithmus) 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 = px; int vy = py; if (isoRotation == 1) { vx = py; vy = BASE_DIM - 1 - px; } else if (isoRotation == 2) { vx = BASE_DIM - 1 - px; vy = BASE_DIM - 1 - py; } else if (isoRotation == 3) { vx = BASE_DIM - 1 - py; vy = px; } int vType = getBaseVoxel(vx, vy, z); if (vType > 0) { float sx = originX + (px - py) * hw; float sy = originY + (px + py) * hh - z * ch; int c = (vType == 1) ? color(210, 42, 74) : color(65, 155, 255); if (a11yTheme == 1) c = (vType == 1) ? color(251, 191, 36) : color(56, 189, 248); if (a11yTheme == 2) c = (vType == 1) ? color(255, 255, 0) : color(0, 255, 255); drawIsoCubeSolid(sx, sy, hw, hh, ch, c); } } } } drawNavBtn(width * 0.5 - 160, height - 66, 320, 36, "BASIS JETZT IN 3D BEGEHEN (OHNE P3D) [V] >>", getUiPalette(a11yTheme, 2)); } void drawIsoCubeSolid(float sx, float sy, float hw, float hh, float ch, int c) { stroke(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); } // ============================================================================================== // MODE 3: 3D-BASIS BEGEHUNG — PURE SOFTWARE DDA-RAYCASTER (OHNE P3D!) // ============================================================================================== void enterWalk3DBaseMode() { viewMode = 3; walkX = 7.5; walkY = 7.5; walkDirX = 1.0; walkDirY = 0.0; walkPlaneX = 0.0; walkPlaneY = 0.66; } void drawWalk3DBaseMode() { int startX = 340; int viewW = width - startX; int viewH = height - 38; int topY = 38; // Bewegung in der 3D-Basis 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; float 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; float sy = walkDirX; if (!isWalkWall(int(walkX + sx * spd), int(walkY))) walkX += sx * spd; if (!isWalkWall(int(walkX), int(walkY + sy * spd))) walkY += sy * spd; } // Decke & Boden noStroke(); fill(18, 6, 12); rect(startX, topY, viewW, viewH / 2); fill(10, 16, 30); rect(startX, topY + viewH / 2, viewW, viewH / 2); // Software 3D DDA-Raycasting durch deine gewachsenen Erz- und Forschungs-Würfel! for (int x = 0; x < viewW; x++) { float camXNorm = 2.0 * x / float(viewW) - 1.0; float rdx = walkDirX + walkPlaneX * camXNorm; float rdy = walkDirY + walkPlaneY * camXNorm; int mapX = int(walkX); int mapY = int(walkY); float ddx = (rdx == 0.0) ? 1e30 : abs(1.0 / rdx); float ddy = (rdy == 0.0) ? 1e30 : abs(1.0 / rdy); int stepX = (rdx < 0) ? -1 : 1; int stepY = (rdy < 0) ? -1 : 1; float sdx = (rdx < 0) ? (walkX - mapX) * ddx : (mapX + 1.0 - walkX) * ddx; float sdy = (rdy < 0) ? (walkY - mapY) * ddy : (mapY + 1.0 - walkY) * ddy; int hit = 0; int side = 0; int wallType = 0; int 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 = 3; // Außenhülle der Station } else { int v = getBaseVoxel(mapX, mapY, 0); if (v > 0) { hit = 1; wallType = v; // 1 = Erz-Würfel, 2 = Forschungs-Würfel } } } 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); int y0 = max(0, -lh / 2 + viewH / 2); int y1 = min(viewH - 1, lh / 2 + viewH / 2); int col = color(110, 125, 150); if (wallType == 1) col = color(210, 42, 74); // Erz-Würfel (Blutrot) else if (wallType == 2) col = color(65, 155, 255); // Forschungs-Würfel (Nachtblau/Cyan) float shade = constrain(1.0 / (1.0 + distW * 0.16), 0.22, 1.0); if (side == 1) shade *= 0.72; stroke(red(col) * shade, green(col) * shade, blue(col) * shade); line(startX + x, topY + y0, startX + x, topY + y1); } // Linkes Terminal für die 3D-Basis-Begehung fill(getUiPalette(a11yTheme, 1)); noStroke(); rect(0, topY, startX, viewH); stroke(getUiPalette(a11yTheme, 4)); line(startX, topY, startX, height); fill(255); textSize(15); textAlign(LEFT, TOP); text("3D-BASIS BEGEHUNG (OHNE P3D)", 16, topY + 14); fill(215, 228, 248); textSize(12); text("Rot = Erz-Würfel (" + erzCubesCount + ")\nBlau = Forschungs-Würfel (" + fpCubesCount + ")\n\nSteuerung:\n[W/A/S/D] Laufen\n[Maus ziehen / Pfeile] Drehen", 16, topY + 44); // 2D-Grundriss der Basis int cellPx = 18; int gx0 = 24; int gy0 = topY + 210; for (int y = 0; y < BASE_DIM; y++) { for (int x = 0; x < BASE_DIM; x++) { int v = getBaseVoxel(x, y, 0); if (x == 0 || y == 0 || x == BASE_DIM - 1 || y == BASE_DIM - 1) fill(70, 82, 110); else if (v == 1) fill(210, 42, 74); else if (v == 2) fill(65, 155, 255); else fill(16, 20, 32); noStroke(); rect(gx0 + x * cellPx, gy0 + y * cellPx, cellPx - 1, cellPx - 1); } } fill(255, 230, 60); ellipse(gx0 + walkX * cellPx, gy0 + walkY * cellPx, 7, 7); drawNavBtn(24, height - 62, 290, 38, "← ZURÜCK ZUM RAUMSCHIFF [1]", getUiPalette(a11yTheme, 2)); } boolean isWalkWall(int gx, int gy) { if (gx <= 0 || gx >= BASE_DIM - 1 || gy <= 0 || gy >= BASE_DIM - 1) return true; return (getBaseVoxel(gx, gy, 0) > 0); } void rotateWalkCam(float rot) { float oldDirX = walkDirX; walkDirX = walkDirX * cos(rot) - walkDirY * sin(rot); walkDirY = oldDirX * sin(rot) + walkDirY * cos(rot); float oldPlaneX = walkPlaneX; walkPlaneX = walkPlaneX * cos(rot) - walkPlaneY * sin(rot); walkPlaneY = oldPlaneX * sin(rot) + walkPlaneY * cos(rot); } // ============================================================================================== // ENTITÄTEN-KLASSEN & EINGABEN // ============================================================================================== class SpaceNode { float x, y, vx, vy; int zVal; boolean isOreAsteroid; SpaceNode(float sx, float sy, int z, boolean ore) { x = sx; y = sy; vx = random(-0.35, 0.35); vy = random(-0.35, 0.35); zVal = z; isOreAsteroid = ore; } } 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; } } void mouseMoved() { if (viewMode == 0 && mouseY > 38 && mouseY < height - 130) mouseSteer = true; } void mousePressed() { // 1. Globale Top-Leiste (y: 0..38) if (mouseY <= 38) { if (mouseX >= 12 && mouseX <= 157) { viewMode = 0; return; } if (mouseX >= 163 && mouseX <= 308) { viewMode = 1; return; } if (mouseX >= 314 && mouseX <= 469) { viewMode = 2; return; } if (mouseX >= 475 && mouseX <= 630) { enterWalk3DBaseMode(); return; } if (mouseX >= width - 122 && mouseX <= width - 12) { a11yTheme = (a11yTheme + 1) % 3; return; } return; } // 2. Tech-Tree Klicks (Mode 1) if (viewMode == 1) { if (mouseX >= width - 420 && mouseX <= width - 225 && mouseY >= 58 && mouseY <= 86) { freeTechMode = !freeTechMode; return; } if (mouseX >= width - 215 && mouseX <= width - 30 && mouseY >= 58 && mouseY <= 86) { if (creditsEUR >= 30) { creditsEUR -= 30; addResearchFP(25); } return; } for (int i = 0; i < NUM_TECH; i++) { float nx = 32 + tBranchId[i] * 268; float ny = 108 + tTier[i] * 195; if (mouseX >= nx && mouseX <= nx + 252 && mouseY >= ny && mouseY <= ny + 176) { selectedTech = i; boolean unlocked = freeTechMode || (tPrereq[i] < 0) || (tLevel[tPrereq[i]] > 0); int cost = tCost[i] * (tLevel[i] + 1); if (unlocked && tLevel[i] < 3 && (freeTechMode || researchFP >= cost)) { if (!freeTechMode) researchFP -= cost; tLevel[i]++; recalcShipCapabilities(); if (i == 6) hullHP = min(maxHullHP, hullHP + 45); } return; } } return; } // 3. 3D-Isometrie Klicks (Mode 2) if (viewMode == 2) { if (mouseY >= 58 && mouseY <= 88) { if (mouseX >= width - 490 && mouseX <= width - 355) { isoRotation = (isoRotation + 1) % 4; return; } if (mouseX >= width - 347 && mouseX <= width - 192) { addRefinedErz(100); return; } if (mouseX >= width - 184 && mouseX <= width - 29) { addResearchFP(100); return; } } if (mouseY >= height - 66 && mouseY <= height - 30 && mouseX >= width * 0.5 - 160 && mouseX <= width * 0.5 + 160) { enterWalk3DBaseMode(); return; } return; } // 4. 3D-Begehung Zurück-Button (Mode 3) if (viewMode == 3) { if (mouseX >= 24 && mouseX <= 314 && mouseY >= height - 62 && mouseY <= height - 24) { viewMode = 0; } return; } // 5. Mikrokosmos-Flug HUD & Schuss (Mode 0) int hudTop = height - 130; if (mouseY >= hudTop) { if (mouseY >= hudTop + 32 && mouseY <= hudTop + 58) { if (mouseX >= 16 && mouseX <= 130) { activeWeapon = 1; return; } if (mouseX >= 136 && mouseX <= 250) { activeWeapon = 2; return; } if (mouseX >= 256 && mouseX <= 370) { activeWeapon = 3; return; } if (mouseX >= 376 && mouseX <= 490) { activeWeapon = 4; return; } if (mouseX >= 496 && mouseX <= 610) { activeWeapon = 5; return; } if (mouseX >= 624 && mouseX <= 769) { zeroClick = !zeroClick; return; } if (mouseX >= 777 && mouseX <= 962) { viewMode = 2; return; } } return; } if (mouseY > 38 && mouseY < hudTop && mouseButton == LEFT) { fireActiveWeapon(); } } void mouseDragged() { if (viewMode == 3 && mouseX > 340) { rotateWalkCam(-(mouseX - pmouseX) * 0.012); } } void keyPressed() { 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 == 't' || key == 'T') viewMode = (viewMode == 1) ? 0 : 1; 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 == 'h' || key == 'H') a11yTheme = (a11yTheme + 1) % 3; if (key == ' ' && viewMode == 0) fireActiveWeapon(); 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 == '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; } }