/* * Source Code (.pde / .php): MIT License; Documents & Open Data: CC0 1.0 Universal; * Copyright (c) 2026 Jan Bühring & Adaptive Intelligence Synthesis Network (Google AI). * * Project Database: https://xqskys.de * Framework: DTIM-ZEC Modular Physics Framework (DAMTP Academic Standard) * Compatibility: Processing 4.5.7 (Java) & processing.min.js (Web Canvas) * * MODULE 1 / 3: Core State, DAMTP Formula Geometry, Open-World Flight & Trading */ // ============================================================================ // 1. GLOBAL SYSTEM STATE & VIEW MODES // ============================================================================ // View Modes: 1 = Sektor-Raumflug & Handel, 2 = Schiff-Habitat (RimWorld-Deck), // 3 = Atom-Synthese-Labor, 4 = Axiomatische Sternenkarte (4X) int viewMode = 1; boolean a11yMode = false; int simTick = 0; String statusLog = "DTIM-ZEC Sandbox aktiv. [1-4] Ansichten | [L] Andocken | [H] Sehhilfe"; // Unified Sandbox Resources int credits = 320; int metal = 140; int bioFood = 45; int researchPts = 20; float fuel = 120.0; float maxFuel = 120.0; // Ship Upgrade Levels (1..5) int lvlCargo = 1; int lvlEngine = 1; int lvlReactor = 1; // Trade Goods & Synthesized Isotopes int NUM_GOODS = 4; String[] goodNames = {"Raum-Gurken", "DTIM-Isotope", "Wheek-Kräuter", "Quanten-Kerne"}; int[] cargo = {2, 1, 2, 0}; // ============================================================================ // 2. OPEN-WORLD SECTOR SYSTEMS (4X GRAPH + LOCAL PLANETS) // ============================================================================ int NUM_SYSTEMS = 10; String[] sysNames = { "Norn-Zentrum", "Wheek-Garten", "ZEC-Knoten Alpha", "Chlorophyll-IX", "Axion-Pol", "Quant-Bremen", "Myzel-Tor", "Vakuum-Kern", "Metrik-Stern", "Xeno-Wurzel" }; float[] sysMapX = {130, 230, 190, 620, 350, 290, 510, 420, 560, 640}; float[] sysMapY = {170, 115, 310, 490, 175, 450, 210, 330, 370, 140}; int[] sysOwner = {1, 1, 0, 2, 0, 0, 2, 0, 0, 2}; // 0=Neutral, 1=Norn, 2=Cyborg-Pflanzen int[] sysFleetNorn = {2, 1, 0, 0, 0, 0, 0, 0, 0, 0}; int[] sysFleetCyborg = {0, 0, 0, 2, 0, 0, 1, 0, 0, 2}; boolean[][] sysLinks = new boolean[NUM_SYSTEMS][NUM_SYSTEMS]; int currentSystem = 0; // Local Sector Bodies (generated mathematically from System seed) int NUM_LOCAL_BODIES = 4; String[] bodyNames = new String[NUM_LOCAL_BODIES]; float[] bodyX = new float[NUM_LOCAL_BODIES]; float[] bodyY = new float[NUM_LOCAL_BODIES]; float[] bodyR = new float[NUM_LOCAL_BODIES]; int[] bodyHarmonic = new int[NUM_LOCAL_BODIES]; int[][] localPrices = new int[NUM_LOCAL_BODIES][NUM_GOODS]; // Player Ship Kinematics in Open World float shipX = 380; float shipY = 320; float shipVX = 0; float shipVY = 0; float shipAngle = -HALF_PI; boolean isDocked = false; int dockedBody = 0; // Ambient Asteroids / Harmonic Nodes int NUM_AST = 9; float[] astX = new float[NUM_AST]; float[] astY = new float[NUM_AST]; float[] astVX = new float[NUM_AST]; float[] astVY = new float[NUM_AST]; float[] astR = new float[NUM_AST]; // ============================================================================ // 3. SHIP INTERIOR HABITAT STATE (RIMWORLD / SPACE HAVEN DECK) // ============================================================================ int DECK_COLS = 16; int DECK_ROWS = 10; int TILE_SZ = 42; int DECK_OX = 36; int DECK_OY = 76; // 0=Space, 1=Floor, 2=HullWall, 3=O2Gen, 4=DTIM-Reactor, 5=Gurken-Farm, 6=Wheek-Habitat int[][] deckGrid = new int[DECK_COLS][DECK_ROWS]; float[][] deckO2 = new float[DECK_COLS][DECK_ROWS]; int selectedDeckTool = 1; int[] deckToolCosts = {0, 5, 10, 25, 35, 20, 30}; String[] deckToolLabels = { "0: Abriss / Vakuum", "1: Schiffsboden (5 Met)", "2: Hüllenwand (10 Met)", "3: O2-Generator (25 Met)", "4: DTIM-Reaktor (35 Met)", "5: Gurken-Beet (20 Met)", "6: Wheek-Habitat (30 Met)" }; // Crew Agents (Norn + Guinea Pig Helpers) int NUM_CREW = 4; String[] crewNames = {"Norn Lyra", "Norn Kael", "Meerschweinchen Pip", "Meerschweinchen Fussel"}; boolean[] crewIsPig = {false, false, true, true}; float[] crewX = new float[NUM_CREW]; float[] crewY = new float[NUM_CREW]; float[] crewTX = new float[NUM_CREW]; float[] crewTY = new float[NUM_CREW]; float[] crewMood = {90, 88, 96, 94}; String[] crewTask = {"Systemcheck", "Navigation", "Wheek! (Glücklich)", "Schnüffelt Gurken"}; // ============================================================================ // 4. ATOM LAB & AXIOMATIC TECH TREE STATE // ============================================================================ int atomProtons = 2; int atomNeutrons = 2; int atomElectrons = 2; float atomPhase = 0.0; // 3 Axiomatic Branches x 3 Tiers int[] axiomLvl = {0, 0, 0}; int activeAxiom = 0; String[][] axiomTitles = { {"I.1 Diskrete Metrik", "I.2 Knoten-Sprung", "I.3 ZEC-Raumfaltung"}, {"II.1 Vakuum-Resonanz", "II.2 Harmonik-Schild", "II.3 Nullpunkt-Kern"}, {"III.1 Wheek-Symbiose", "III.2 Bio-Kuppel-Netz", "III.3 Xeno-Flora-Code"} }; int[] axiomCosts = {30, 65, 110}; // Input Flags boolean keyUp = false, keyDown = false, keyLeft = false, keyRight = false; // ============================================================================ // 5. SETUP & PROCEDURAL DAMTP SYSTEM GENERATION // ============================================================================ void setup() { size(1080, 660); smooth(); textFont(createFont("SansSerif", 13)); // Connect 4X Hyperlanes for (int i = 0; i < NUM_SYSTEMS; i++) { for (int j = i + 1; j < NUM_SYSTEMS; j++) { if (dist(sysMapX[i], sysMapY[i], sysMapX[j], sysMapY[j]) < 210) { sysLinks[i][j] = true; sysLinks[j][i] = true; } } } initDeckHabitat(); enterSystem(0); } void enterSystem(int sysIdx) { currentSystem = sysIdx; isDocked = false; shipX = 380; shipY = 330; shipVX = 0; shipVY = 0; // Deterministic harmonic layout from system index float[] bx = {180, 560, 210, 550}; float[] by = {180, 175, 465, 460}; String[] suffixes = {"-Prime (Agrar)", "-Raffinerie", "-Wheek-Station", "-Werft"}; for (int i = 0; i < NUM_LOCAL_BODIES; i++) { bodyNames[i] = sysNames[sysIdx] + suffixes[i]; bodyX[i] = bx[i] + sin(sysIdx * 1.7 + i) * 35; bodyY[i] = by[i] + cos(sysIdx * 1.3 + i) * 30; bodyR[i] = 28 + ((sysIdx + i) % 3) * 6; bodyHarmonic[i] = 3 + ((sysIdx + i) % 5); int[] base = {16, 44, 14, 72}; for (int g = 0; g < NUM_GOODS; g++) { float factor = 1.0 + 0.42 * sin(sysIdx * 2.1 + i * 1.5 + g * 1.9); localPrices[i][g] = max(5, int(base[g] * factor)); } } for (int i = 0; i < NUM_AST; i++) { float a = TWO_PI * i / NUM_AST; astX[i] = 380 + cos(a) * (140 + (i % 3) * 75); astY[i] = 320 + sin(a) * (120 + (i % 2) * 70); astVX[i] = cos(a + HALF_PI) * 0.35; astVY[i] = sin(a + HALF_PI) * 0.35; astR[i] = 14 + (i % 3) * 5; } statusLog = "Sektor " + sysNames[sysIdx] + " erreicht (" + getOwnerLabel(sysOwner[sysIdx]) + ")."; } // ============================================================================ // 6. MAIN LOOP & DAMTP ABSTRACT RENDERING PRIMITIVES // ============================================================================ void draw() { simTick++; atomPhase += 0.045; updateGlobalSimulation(); if (a11yMode) background(0); else background(10, 14, 24); drawDamtpCoordinateGrid(); if (viewMode == 1) { renderSpaceFlightMode(); } else if (viewMode == 2) { renderDeckHabitatMode(); } else if (viewMode == 3) { renderAtomLabMode(); } else if (viewMode == 4) { renderGalaxyMapMode(); } drawTopNavigationHUD(); drawBottomStatusBar(); } // DAMTP Abstract Formula Backdrop: Parametric Epicycloid & Metric Lattice void drawDamtpCoordinateGrid() { stroke(a11yMode ? color(40) : color(26, 38, 60, 120)); strokeWeight(1); for (int x = 20; x < 740; x += 60) { line(x, 56, x, height - 44); } for (int y = 56; y < height - 44; y += 60) { line(20, y, 740, y); } // Subtle harmonic field ring in background noFill(); stroke(a11yMode ? color(55) : color(45, 85, 125, 65)); beginShape(); for (int i = 0; i <= 72; i++) { float theta = TWO_PI * i / 72.0; float r = 210 + 18 * sin(5 * theta + atomPhase * 0.3); vertex(380 + cos(theta) * r, 330 + sin(theta) * r); } endShape(CLOSE); } // Formula-driven Harmonic Planet / Station Renderer: r(theta) = R + A*cos(k*theta) void drawHarmonicBody(float cx, float cy, float baseR, int k, boolean highlight) { pushMatrix(); translate(cx, cy); // Orbit Dock Ring noFill(); stroke(highlight ? (a11yMode ? color(255, 255, 0) : color(100, 235, 205)) : (a11yMode ? color(120) : color(70, 110, 150, 110))); strokeWeight(highlight ? 2.2 : 1.0); ellipse(0, 0, (baseR + 22) * 2, (baseR + 22) * 2); // Parametric Harmonic Contour fill(a11yMode ? color(20) : color(28, 52, 82, 220)); stroke(a11yMode ? color(255) : color(115, 210, 235)); strokeWeight(1.8); beginShape(); for (int i = 0; i <= 48; i++) { float t = TWO_PI * i / 48.0; float r = baseR + 3.2 * cos(k * t + atomPhase * 0.5); vertex(cos(t) * r, sin(t) * r); } endShape(CLOSE); // Inner Lissajous Core Curve noFill(); stroke(a11yMode ? color(0, 255, 255) : color(130, 235, 195, 170)); strokeWeight(1.2); beginShape(); for (int i = 0; i <= 36; i++) { float t = TWO_PI * i / 36.0; vertex(cos(t * 2) * baseR * 0.45, sin(t * 3) * baseR * 0.45); } endShape(CLOSE); popMatrix(); } // ============================================================================ // 7. MODE 1: OPEN-WORLD SPACE FLIGHT & TRADING // ============================================================================ void renderSpaceFlightMode() { int nearBody = getNearbyBody(); // Draw Harmonic Planets for (int i = 0; i < NUM_LOCAL_BODIES; i++) { boolean hl = (i == nearBody || (isDocked && i == dockedBody)); drawHarmonicBody(bodyX[i], bodyY[i], bodyR[i], bodyHarmonic[i], hl); fill(a11yMode ? 255 : 230); noStroke(); textAlign(CENTER, TOP); text(bodyNames[i], bodyX[i], bodyY[i] + bodyR[i] + 8); } // Draw Asteroids (Octagonal DTIM-ZEC Polyhedra) for (int i = 0; i < NUM_AST; i++) { pushMatrix(); translate(astX[i], astY[i]); rotate(atomPhase * 0.25 + i); fill(a11yMode ? 35 : color(65, 75, 95)); stroke(a11yMode ? 220 : color(130, 145, 170)); strokeWeight(1.5); beginShape(); for (int v = 0; v < 6; v++) { float a = TWO_PI * v / 6.0; float rr = astR[i] * (v % 2 == 0 ? 1.0 : 0.78); vertex(cos(a) * rr, sin(a) * rr); } endShape(CLOSE); popMatrix(); } // Draw Norn Starship (Parametric Delta-Epicycloid Hull) if (!isDocked) { pushMatrix(); translate(shipX, shipY); rotate(shipAngle); if (keyUp && fuel > 0) { noStroke(); fill(a11yMode ? color(255, 255, 0) : color(255, 170, 60)); triangle(-15, -5, -28 - random(6), 0, -15, 5); } fill(a11yMode ? 255 : color(220, 232, 248)); stroke(a11yMode ? color(255, 255, 0) : color(90, 195, 235)); strokeWeight(2); beginShape(); vertex(18 + lvlCargo, 0); vertex(2, -11 - lvlReactor); vertex(-15, -8); vertex(-11, 0); vertex(-15, 8); vertex(2, 11 + lvlReactor); endShape(CLOSE); popMatrix(); } // Right Side Panel: Market & Shipyard drawFlightSidePanel(nearBody); } void drawFlightSidePanel(int nearBody) { float px = 755, py = 56, pw = 315, ph = height - 102; drawPanelBox(px, py, pw, ph); float cx = px + 14, cy = py + 22; textAlign(LEFT, CENTER); if (!isDocked) { fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("SEKTOR: " + sysNames[currentSystem], cx, cy); cy += 22; fill(a11yMode ? 255 : 215); text("Steuerung: [W/A/S/D] Schub & Kurs", cx, cy); cy += 18; text("Wechsle mit [2] ins Schiffs-Deck,", cx, cy); cy += 18; text("[3] ins Atom-Labor oder [4] Sternenkarte.", cx, cy); cy += 34; if (nearBody != -1) { drawUiBtn(cx, cy, pw - 28, 34, "[L] ANDOCKEN: " + bodyNames[nearBody], true); } else { fill(a11yMode ? 200 : color(150, 175, 200)); text("Fliege nahe an einen Planeten zum Andocken.", cx, cy); } return; } // Docked Market View fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("HAFEN: " + bodyNames[dockedBody], cx, cy); cy += 24; for (int g = 0; g < NUM_GOODS; g++) { int pr = localPrices[dockedBody][g]; fill(a11yMode ? 255 : 230); text(goodNames[g] + " (" + pr + " Cr) | Fracht: " + cargo[g], cx, cy); cy += 19; drawUiBtn(cx, cy, 138, 24, "[K" + (g + 1) + "] Kaufen", false); drawUiBtn(cx + 146, cy, 138, 24, "[V" + (g + 1) + "] Verkaufen", false); cy += 31; } drawUiBtn(cx, cy, pw - 28, 26, "[T] Treibstoff auffüllen (10 Cr)", false); cy += 36; fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("WERFT-AUSBAU (SCHIFF & REAKTOR)", cx, cy); cy += 22; drawUiBtn(cx, cy, pw - 28, 25, "[U] Frachtraum Lv." + lvlCargo + " (" + (lvlCargo * 90) + " Cr)", false); cy += 30; drawUiBtn(cx, cy, pw - 28, 25, "[I] DTIM-Antrieb Lv." + lvlEngine + " (" + (lvlEngine * 100) + " Cr)", false); cy += 36; drawUiBtn(cx, cy, pw - 28, 34, "[L] ABLEGEN & STARTEN", true); } // ============================================================================ // MODULE 2 / 3: Ship Interior Habitat (RimWorld Deck), Atom Lab & 4X Map // ============================================================================ void initDeckHabitat() { for (int c = 0; c < DECK_COLS; c++) { for (int r = 0; r < DECK_ROWS; r++) { deckGrid[c][r] = 0; deckO2[c][r] = 0.0; } } // Build starting Norn Starship core section (cols 5..10, rows 3..6) for (int c = 5; c <= 10; c++) { for (int r = 3; r <= 6; r++) { boolean wall = (c == 5 || c == 10 || r == 3 || r == 6); deckGrid[c][r] = wall ? 2 : 1; deckO2[c][r] = wall ? 0.0 : 95.0; } } deckGrid[6][4] = 3; // O2-Generator deckGrid[9][4] = 4; // DTIM-Reaktor deckGrid[6][5] = 5; // Gurken-Beet deckGrid[9][5] = 6; // Wheek-Habitat for (int i = 0; i < NUM_CREW; i++) { crewX[i] = 7.5 + (i % 2) * 0.7; crewY[i] = 4.5 + (i / 2) * 0.7; crewTX[i] = crewX[i]; crewTY[i] = crewY[i]; } } // ============================================================================ // 8. MODE 2: SHIP INTERIOR HABITAT (RIMWORLD / SPACE HAVEN DECK) // ============================================================================ void renderDeckHabitatMode() { rectMode(CORNER); for (int c = 0; c < DECK_COLS; c++) { for (int r = 0; r < DECK_ROWS; r++) { float x = DECK_OX + c * TILE_SZ; float y = DECK_OY + r * TILE_SZ; int t = deckGrid[c][r]; stroke(a11yMode ? color(55) : color(35, 50, 75, 130)); strokeWeight(1); if (t == 0) { noFill(); rect(x, y, TILE_SZ, TILE_SZ); continue; } if (t == 2) { // Hull Wall fill(a11yMode ? 220 : color(88, 104, 128)); stroke(a11yMode ? color(255, 255, 0) : color(150, 175, 205)); strokeWeight(1.5); rect(x, y, TILE_SZ, TILE_SZ); line(x + 4, y + 4, x + TILE_SZ - 4, y + TILE_SZ - 4); continue; } // Walkable Floor colored by Oxygen density float o2Norm = constrain(deckO2[c][r] / 100.0, 0, 1); if (a11yMode) { fill(o2Norm > 0.3 ? color(25, 35, 42) : color(55, 15, 15)); stroke(150); } else { fill(lerpColor(color(65, 35, 45), color(38, 56, 82), o2Norm)); stroke(68, 90, 122); } rect(x, y, TILE_SZ, TILE_SZ); // Module Mathematical Symbols float cx = x + TILE_SZ * 0.5; float cy = y + TILE_SZ * 0.5; if (t == 3) { // O2 Generator (Circle) fill(a11yMode ? color(0, 220, 255) : color(75, 195, 235)); stroke(255); ellipse(cx, cy, 24, 24); fill(0); noStroke(); textAlign(CENTER, CENTER); text("O2", cx, cy); } else if (t == 4) { // DTIM Reactor (Diamond) fill(a11yMode ? color(255, 220, 0) : color(235, 175, 55)); stroke(255); quad(cx, cy - 14, cx + 14, cy, cx, cy + 14, cx - 14, cy); fill(0); noStroke(); textAlign(CENTER, CENTER); text("Z", cx, cy); } else if (t == 5) { // Gurken-Farm (Square) fill(a11yMode ? color(0, 255, 120) : color(72, 185, 98)); stroke(255); rect(x + 8, y + 8, TILE_SZ - 16, TILE_SZ - 16, 4); fill(0); noStroke(); textAlign(CENTER, CENTER); text("G", cx, cy); } else if (t == 6) { // Wheek-Habitat (Oval) fill(a11yMode ? color(255, 165, 0) : color(210, 145, 85)); stroke(255); ellipse(cx, cy, 26, 19); fill(0); noStroke(); textAlign(CENTER, CENTER); text("W", cx, cy); } } } // Hover Cursor on Deck int hc = (mouseX - DECK_OX) / TILE_SZ; int hr = (mouseY - DECK_OY) / TILE_SZ; if (mouseX >= DECK_OX && hc >= 0 && hc < DECK_COLS && mouseY >= DECK_OY && hr >= 0 && hr < DECK_ROWS) { noFill(); stroke(a11yMode ? color(255, 255, 0) : color(110, 235, 210)); strokeWeight(2); rect(DECK_OX + hc * TILE_SZ, DECK_OY + hr * TILE_SZ, TILE_SZ, TILE_SZ); } // Render Norn Crew & Guinea Pigs for (int i = 0; i < NUM_CREW; i++) { float px = DECK_OX + crewX[i] * TILE_SZ; float py = DECK_OY + crewY[i] * TILE_SZ; if (crewIsPig[i]) { fill(a11yMode ? color(255, 220, 0) : color(205, 140, 85)); stroke(0); strokeWeight(1.5); ellipse(px, py, 16, 11); fill(255); noStroke(); ellipse(px - 2, py, 5, 8); } else { fill(a11yMode ? color(0, 255, 255) : color(110, 215, 245)); stroke(0); strokeWeight(1.5); ellipse(px, py, 16, 16); } } // Right Side Panel: Deck Construction & Crew Status float px = 755, py = 56, pw = 315, ph = height - 102; drawPanelBox(px, py, pw, ph); float cx = px + 14, cy = py + 22; textAlign(LEFT, CENTER); fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("NORN-ARCHE AUSBAU (Klick / 0-6)", cx, cy); cy += 22; for (int t = 0; t < 7; t++) { drawUiBtn(cx, cy, pw - 28, 25, deckToolLabels[t], selectedDeckTool == t); cy += 29; } cy += 10; fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("CREW & MEERSCHWEINCHEN", cx, cy); cy += 20; for (int i = 0; i < NUM_CREW; i++) { fill(a11yMode ? 255 : 225); text(crewNames[i] + " (" + int(crewMood[i]) + "%)", cx, cy); cy += 15; fill(a11yMode ? 210 : color(160, 195, 220)); text("-> " + crewTask[i], cx + 8, cy); cy += 20; } } // ============================================================================ // 9. MODE 3: ATOM-SYNTHESE-LABOR (DAMTP STANDING-WAVE QUANTUM MODEL) // ============================================================================ void renderAtomLabMode() { float cx = 380; float cy = 330; // Standing-Wave Electron Shells: r(phi) = r0 + A * sin(n * phi + phase) int shells = (atomElectrons <= 2) ? 1 : (atomElectrons <= 10 ? 2 : 3); for (int s = 1; s <= shells; s++) { float baseR = 65 + s * 58; int waveNodes = s + 2; noFill(); stroke(a11yMode ? color(0, 220, 255) : color(80, 195, 235, 165)); strokeWeight(1.8); beginShape(); for (int i = 0; i <= 90; i++) { float phi = TWO_PI * i / 90.0; float r = baseR + 7.5 * sin(waveNodes * phi + atomPhase * (s % 2 == 0 ? -1.2 : 1.2)); vertex(cx + cos(phi) * r, cy + sin(phi) * r); } endShape(CLOSE); } // Orbiting Electrons for (int e = 0; e < atomElectrons; e++) { int shellIdx = (e < 2) ? 1 : (e < 10 ? 2 : 3); float baseR = 65 + shellIdx * 58; float ang = atomPhase * (1.4 - shellIdx * 0.25) + e * (TWO_PI / max(1, atomElectrons)); float ex = cx + cos(ang) * baseR; float ey = cy + sin(ang) * baseR; fill(a11yMode ? color(255, 255, 0) : color(110, 240, 255)); stroke(0); strokeWeight(1.5); ellipse(ex, ey, 11, 11); } // Nucleus Cluster (Protons & Neutrons) int totalNucleons = atomProtons + atomNeutrons; for (int n = 0; n < totalNucleons; n++) { float rOff = (n == 0) ? 0 : 8 + (n % 3) * 5.5; float aOff = n * 2.39996 + atomPhase * 0.2; // Golden angle packing float nx = cx + cos(aOff) * rOff; float ny = cy + sin(aOff) * rOff; boolean isProton = (n < atomProtons); if (isProton) { fill(a11yMode ? color(255, 90, 180) : color(235, 95, 115)); stroke(255); } else { fill(a11yMode ? color(220) : color(145, 165, 195)); stroke(40); } strokeWeight(1.2); ellipse(nx, ny, 14, 14); } // Formula Overlay Label fill(a11yMode ? 255 : color(185, 220, 245)); noStroke(); textAlign(CENTER, TOP); String elemName = getElementName(atomProtons); float stability = getAtomStability(); text("DAMTP STEHENDE-WELLEN-MODELL: " + elemName + " (Z=" + atomProtons + ", N=" + atomNeutrons + ", e-=" + atomElectrons + ")", cx, 72); text("Bindungsstabilität: " + int(stability * 100) + "% | Psi(r,phi) = R_nl(r) * exp(i * m * phi)", cx, 92); // Right Side Panel: Particle Controls & Synthesis float px = 755, py = 56, pw = 315, ph = height - 102; drawPanelBox(px, py, pw, ph); float sx = px + 14, sy = py + 22; textAlign(LEFT, CENTER); fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("DTIM-ZEC ATOM-SYNTHESE", sx, sy); sy += 26; drawUiBtn(sx, sy, 138, 26, "[Q] +1 Proton", false); drawUiBtn(sx + 146, sy, 138, 26, "[A] -1 Proton", false); sy += 32; drawUiBtn(sx, sy, 138, 26, "[W] +1 Neutron", false); drawUiBtn(sx + 146, sy, 138, 26, "[S] -1 Neutron", false); sy += 32; drawUiBtn(sx, sy, 138, 26, "[E] +1 Elektron", false); drawUiBtn(sx + 146, sy, 138, 26, "[D] -1 Elektron", false); sy += 42; fill(a11yMode ? 255 : 225); text("Element: " + elemName, sx, sy); sy += 18; text("Stabilität: " + int(stability * 100) + "%", sx, sy); sy += 28; drawUiBtn(sx, sy, pw - 28, 32, "[F] DTIM-Isotop synthetisieren (+1 Fracht)", true); sy += 38; drawUiBtn(sx, sy, pw - 28, 32, "[G] Quanten-Kern fusionieren (+1 Kern)", false); sy += 38; drawUiBtn(sx, sy, pw - 28, 32, "[T] Reaktor-Treibstoff gewinnen (+30 Fuel)", false); } String getElementName(int z) { String[] names = { "Vakuum-Quant", "Wasserstoff (H)", "Helium (He)", "Lithium (Li)", "Beryllium (Be)", "Bor (B)", "Kohlenstoff (C)", "Stickstoff (N)", "Sauerstoff (O)", "Fluor (F)", "Neon (Ne)", "Natrium (Na)", "Magnesium (Mg)" }; return (z >= 0 && z < names.length) ? names[z] : "Trans-ZEC (" + z + ")"; } float getAtomStability() { if (atomProtons == 0) return 0.1; float ratio = float(atomNeutrons) / float(atomProtons); float ideal = (atomProtons <= 2) ? 1.0 : 1.15; float chargeDiff = abs(atomProtons - atomElectrons) * 0.12; return constrain(1.0 - abs(ratio - ideal) * 0.75 - chargeDiff, 0.05, 1.0); } // ============================================================================ // 10. MODE 4: AXIOMATIC GALAXY MAP (FREEORION 4X STRATEGY) // ============================================================================ void renderGalaxyMapMode() { // Draw Hyperlanes for (int i = 0; i < NUM_SYSTEMS; i++) { for (int j = i + 1; j < NUM_SYSTEMS; j++) { if (sysLinks[i][j]) { boolean activeLink = (i == currentSystem || j == currentSystem); stroke(activeLink ? (a11yMode ? color(255, 255, 0) : color(100, 230, 205, 200)) : (a11yMode ? color(120) : color(70, 95, 135, 115))); strokeWeight(activeLink ? 2.2 : 1.2); line(sysMapX[i], sysMapY[i], sysMapX[j], sysMapY[j]); } } } // Draw Star Systems for (int i = 0; i < NUM_SYSTEMS; i++) { float x = sysMapX[i]; float y = sysMapY[i]; if (i == currentSystem) { noFill(); stroke(a11yMode ? color(255, 255, 0) : color(255, 220, 100)); strokeWeight(2.5); ellipse(x, y, 42, 42); } if (sysOwner[i] == 1) { // Norn & Guinea Pigs: Circle fill(a11yMode ? color(0, 180, 255) : color(65, 165, 225)); stroke(255); strokeWeight(2); ellipse(x, y, 26, 26); } else if (sysOwner[i] == 2) { // Cyborg-Pflanzen: Diamond fill(a11yMode ? color(255, 80, 180) : color(195, 75, 130)); stroke(a11yMode ? 255 : color(130, 235, 140)); strokeWeight(2); quad(x, y - 15, x + 15, y, x, y + 15, x - 15, y); } else { fill(a11yMode ? 35 : color(55, 65, 85)); stroke(200); strokeWeight(1.5); ellipse(x, y, 22, 22); } // Fleet Counts fill(a11yMode ? 255 : 230); noStroke(); textAlign(CENTER, TOP); text(sysNames[i], x, y + 17); if (sysFleetNorn[i] > 0 || sysFleetCyborg[i] > 0) { text("N:" + sysFleetNorn[i] + " | C:" + sysFleetCyborg[i], x, y + 32); } } // Right Side Panel: Axiomatic Tech Tree & 4X Actions float px = 755, py = 56, pw = 315, ph = height - 102; drawPanelBox(px, py, pw, ph); float sx = px + 14, sy = py + 22; textAlign(LEFT, CENTER); fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("AXIOMATISCHER TECHTREE", sx, sy); sy += 24; for (int b = 0; b < 3; b++) { int lv = axiomLvl[b]; String lbl = (lv >= 3) ? "Axiom " + (b + 1) + ": MAX (Lv.3)" : axiomTitles[b][lv] + " (" + axiomCosts[lv] + " FP)"; drawUiBtn(sx, sy, pw - 28, 28, (activeAxiom == b ? ">> " : " ") + lbl, activeAxiom == b); sy += 34; } sy += 8; drawUiBtn(sx, sy, pw - 28, 30, "[F] Axiom-Forschung vorantreiben", false); sy += 38; fill(a11yMode ? color(255, 255, 0) : color(120, 225, 210)); text("SEKTOR-AKTIONEN (Klick auf Stern)", sx, sy); sy += 22; fill(a11yMode ? 255 : 215); text("Linksklick: Mit Norn-Schiff dorthin springen", sx, sy); sy += 18; text("Aktuell: " + sysNames[currentSystem], sx, sy); sy += 26; drawUiBtn(sx, sy, pw - 28, 28, "[K] System kolonisieren (25 Bio-Nahrung)", false); sy += 34; drawUiBtn(sx, sy, pw - 28, 28, "[B] Norn-Begleitschiff bauen (30 Metall)", false); } // ============================================================================ // MODULE 3 / 3: Global Physics, Oxygen Diffusion, UI & Unified Input Control // ============================================================================ void updateGlobalSimulation() { // 1. Space Flight & Asteroid Kinematics for (int i = 0; i < NUM_AST; i++) { astX[i] += astVX[i]; astY[i] += astVY[i]; if (astX[i] < 25) astX[i] = 735; if (astX[i] > 735) astX[i] = 25; if (astY[i] < 60) astY[i] = height - 48; if (astY[i] > height - 48) astY[i] = 60; } if (viewMode == 1 && !isDocked) { float turn = 0.046 + lvlEngine * 0.008; float thrust = 0.08 + lvlEngine * 0.025 + axiomLvl[0] * 0.015; float maxSpd = 3.6 + lvlEngine * 0.65 + axiomLvl[0] * 0.4; if (keyLeft) shipAngle -= turn; if (keyRight) shipAngle += turn; if (keyUp && fuel > 0) { shipVX += cos(shipAngle) * thrust; shipVY += sin(shipAngle) * thrust; fuel = max(0, fuel - 0.04); } if (keyDown && fuel > 0) { shipVX *= 0.94; shipVY *= 0.94; fuel = max(0, fuel - 0.015); } shipVX *= 0.992; shipVY *= 0.992; float spd = dist(0, 0, shipVX, shipVY); if (spd > maxSpd) { shipVX = (shipVX / spd) * maxSpd; shipVY = (shipVY / spd) * maxSpd; } shipX += shipVX; shipY += shipVY; if (shipX < 25) { shipX = 25; shipVX *= -0.5; } if (shipX > 735) { shipX = 735; shipVX *= -0.5; } if (shipY < 60) { shipY = 60; shipVY *= -0.5; } if (shipY > height - 48) { shipY = height - 48; shipVY *= -0.5; } for (int i = 0; i < NUM_AST; i++) { float d = dist(shipX, shipY, astX[i], astY[i]); if (d < astR[i] + 13) { float push = atan2(shipY - astY[i], shipX - astX[i]); shipVX = cos(push) * 1.8; shipVY = sin(push) * 1.8; } } } else if (isDocked) { shipX = bodyX[dockedBody]; shipY = bodyY[dockedBody]; shipVX = 0; shipVY = 0; } // 2. Ship Deck Oxygen Diffusion (Discrete Laplacian) if (simTick % 12 == 0) { float[][] nextO2 = new float[DECK_COLS][DECK_ROWS]; for (int c = 0; c < DECK_COLS; c++) { for (int r = 0; r < DECK_ROWS; r++) { int t = deckGrid[c][r]; if (t == 0 || t == 2) { nextO2[c][r] = 0.0; } else { float sum = deckO2[c][r]; int cnt = 1; boolean leak = false; int[] dc = {-1, 1, 0, 0}; int[] dr = {0, 0, -1, 1}; for (int k = 0; k < 4; k++) { int nc = c + dc[k]; int nr = r + dr[k]; if (nc < 0 || nc >= DECK_COLS || nr < 0 || nr >= DECK_ROWS || deckGrid[nc][nr] == 0) { leak = true; } else if (deckGrid[nc][nr] != 2) { sum += deckO2[nc][nr]; cnt++; } } float avg = sum / cnt; if (leak) avg *= 0.65; if (t == 3) avg = min(100.0, avg + 26.0); nextO2[c][r] = max(0.0, avg - 0.12); } } } deckO2 = nextO2; } // 3. Crew & Guinea Pig Autonomous Movement inside Deck for (int i = 0; i < NUM_CREW; i++) { float d = dist(crewX[i], crewY[i], crewTX[i], crewTY[i]); if (d < 0.12) { for (int tries = 0; tries < 10; tries++) { int rc = int(random(DECK_COLS)); int rr = int(random(DECK_ROWS)); if (isDeckWalkable(rc, rr) && deckO2[rc][rr] > 20) { crewTX[i] = rc + 0.5; crewTY[i] = rr + 0.5; if (deckGrid[rc][rr] == 6) crewTask[i] = crewIsPig[i] ? "WHEEK! Gurkenfest!" : "Füttert Meerschweinchen"; else if (deckGrid[rc][rr] == 5) crewTask[i] = crewIsPig[i] ? "Schnüffelt Blätter" : "Erntet Hydroponik"; else if (deckGrid[rc][rr] == 4) crewTask[i] = "Kalibriert DTIM-Reaktor"; else crewTask[i] = crewIsPig[i] ? "Trippelt über Deck" : "Systemrundgang"; break; } } } else { float ang = atan2(crewTY[i] - crewY[i], crewTX[i] - crewX[i]); float spd = crewIsPig[i] ? 0.024 : 0.018; float nx = crewX[i] + cos(ang) * spd; float ny = crewY[i] + sin(ang) * spd; if (isDeckWalkable(int(nx), int(ny))) { crewX[i] = nx; crewY[i] = ny; } else { crewTX[i] = crewX[i]; crewTY[i] = crewY[i]; } } } // 4. Periodic Sandbox Production & 4X Sector Tick (every 180 frames = ~3 sec) if (simTick % 180 == 0) { int reactors = countDeckModules(4); int farms = countDeckModules(5); int pigHabs = countDeckModules(6); int nornCols = countSystemsByOwner(1); fuel = min(maxFuel, fuel + reactors * 1.5 + axiomLvl[1] * 1.0); bioFood = min(999, bioFood + farms * 2 + pigHabs + nornCols); researchPts = min(999, researchPts + 2 + reactors * 2 + nornCols * 2 + axiomLvl[2] * 2); metal = min(999, metal + 1 + nornCols); for (int i = 0; i < NUM_CREW; i++) { int cx = constrain(int(crewX[i]), 0, DECK_COLS - 1); int cy = constrain(int(crewY[i]), 0, DECK_ROWS - 1); if (deckO2[cx][cy] < 25) { crewMood[i] = max(0, crewMood[i] - 3); crewTask[i] = "Atemnot! Hülle schließen!"; } else { crewMood[i] = min(100, crewMood[i] + (pigHabs > 0 ? 1.5 : 0.3)); } } } } // ============================================================================ // 11. HELPER FUNCTIONS // ============================================================================ boolean isDeckWalkable(int c, int r) { if (c < 0 || c >= DECK_COLS || r < 0 || r >= DECK_ROWS) return false; int t = deckGrid[c][r]; return (t != 0 && t != 2); } int countDeckModules(int type) { int cnt = 0; for (int c = 0; c < DECK_COLS; c++) { for (int r = 0; r < DECK_ROWS; r++) { if (deckGrid[c][r] == type) cnt++; } } return cnt; } int countSystemsByOwner(int owner) { int cnt = 0; for (int i = 0; i < NUM_SYSTEMS; i++) { if (sysOwner[i] == owner) cnt++; } return cnt; } int getNearbyBody() { for (int i = 0; i < NUM_LOCAL_BODIES; i++) { if (dist(shipX, shipY, bodyX[i], bodyY[i]) <= bodyR[i] + 22) return i; } return -1; } int getUsedCargo() { int s = 0; for (int g = 0; g < NUM_GOODS; g++) s += cargo[g]; return s; } int getMaxCargo() { return 12 + (lvlCargo - 1) * 10; } String getOwnerLabel(int owner) { if (owner == 1) return "Norn & Meerschweinchen"; if (owner == 2) return "Cyborg-Pflanzen"; return "Neutraler Sektor"; } // ============================================================================ // 12. TOP HUD, BOTTOM STATUS & SHARED UI WIDGETS // ============================================================================ void drawTopNavigationHUD() { rectMode(CORNER); fill(a11yMode ? 0 : color(16, 22, 38, 240)); stroke(a11yMode ? 255 : color(70, 105, 145)); strokeWeight(a11yMode ? 2 : 1); rect(10, 10, width - 20, 38, 6); String[] tabLabels = {"[1] Raumflug", "[2] Schiffs-Deck", "[3] Atom-Labor", "[4] 4X-Karte"}; float tx = 18; for (int m = 1; m <= 4; m++) { boolean act = (viewMode == m); if (a11yMode) { fill(act ? color(255, 255, 0) : color(0)); stroke(255); } else { fill(act ? color(48, 135, 120) : color(28, 38, 62)); stroke(act ? color(120, 240, 215) : color(75, 110, 145)); } rect(tx, 15, 116, 28, 5); fill(a11yMode ? (act ? 0 : 255) : 255); noStroke(); textAlign(CENTER, CENTER); text(tabLabels[m - 1], tx + 58, 29); tx += 122; } fill(a11yMode ? 255 : 230); textAlign(LEFT, CENTER); String modeTag = a11yMode ? "HighContrast [H]" : "Standard [H]"; String resStr = "Cr: " + credits + " | Met: " + metal + " | Bio: " + bioFood + " | FP: " + researchPts + " | Fracht: " + getUsedCargo() + "/" + getMaxCargo() + " | Fuel: " + int(fuel) + " | " + modeTag; text(resStr, tx + 8, 29); } void drawBottomStatusBar() { rectMode(CORNER); fill(a11yMode ? 0 : color(16, 22, 38, 240)); stroke(a11yMode ? 255 : color(70, 105, 145)); strokeWeight(a11yMode ? 2 : 1); rect(10, height - 38, width - 20, 28, 5); fill(a11yMode ? color(255, 255, 0) : color(195, 225, 245)); noStroke(); textAlign(LEFT, CENTER); text("DTIM-ZEC Log: " + statusLog, 22, height - 24); } void drawPanelBox(float x, float y, float w, float h) { rectMode(CORNER); fill(a11yMode ? 10 : color(18, 26, 44, 240)); stroke(a11yMode ? 255 : color(75, 110, 150)); strokeWeight(a11yMode ? 2 : 1.5); rect(x, y, w, h, 8); } void drawUiBtn(float x, float y, float w, float h, String label, boolean primary) { rectMode(CORNER); if (a11yMode) { fill(primary ? color(255, 255, 0) : color(0)); stroke(255); strokeWeight(primary ? 2.5 : 1.5); } else { fill(primary ? color(48, 135, 120) : color(32, 46, 74)); stroke(primary ? color(120, 240, 215) : color(90, 140, 190)); strokeWeight(primary ? 1.8 : 1); } rect(x, y, w, h, 5); fill(a11yMode ? (primary ? 0 : 255) : 240); noStroke(); textAlign(CENTER, CENTER); text(label, x + w * 0.5, y + h * 0.5); textAlign(LEFT, CENTER); } // ============================================================================ // 13. UNIFIED ACTIONS & INPUT HANDLING (MOUSE + KEYBOARD) // ============================================================================ void toggleDocking() { if (viewMode != 1) return; if (isDocked) { isDocked = false; shipY -= bodyR[dockedBody] + 18; shipVY = -0.8; statusLog = "Abgelegt von " + bodyNames[dockedBody] + "."; } else { int near = getNearbyBody(); if (near != -1) { isDocked = true; dockedBody = near; statusLog = "Angedockt an " + bodyNames[near] + "."; } else { statusLog = "Kein Planet in Dock-Reichweite."; } } } void buyTradeGood(int g) { if (!isDocked || viewMode != 1) return; if (getUsedCargo() >= getMaxCargo()) { statusLog = "Frachtraum voll!"; return; } int pr = localPrices[dockedBody][g]; if (credits >= pr) { credits -= pr; cargo[g]++; statusLog = "1t " + goodNames[g] + " für " + pr + " Cr gekauft."; } else { statusLog = "Nicht genug Credits (" + pr + " Cr benötigt)."; } } void sellTradeGood(int g) { if (!isDocked || viewMode != 1) return; if (cargo[g] > 0) { int pr = localPrices[dockedBody][g]; cargo[g]--; credits += pr; statusLog = "1t " + goodNames[g] + " für " + pr + " Cr verkauft!"; } else { statusLog = "Keine " + goodNames[g] + " im Frachtraum."; } } void applyDeckBrush(int c, int r, int tool) { if (c < 0 || c >= DECK_COLS || r < 0 || r >= DECK_ROWS) return; int cur = deckGrid[c][r]; if (tool == 0) { if (cur != 0) { metal += max(2, deckToolCosts[cur] / 2); deckGrid[c][r] = 0; deckO2[c][r] = 0; statusLog = "Deck-Segment demontiert (+Metall)."; } return; } if (tool >= 3 && cur != 1) { statusLog = "Module benötigen zuerst Schiffsboden (Tool 1)!"; return; } if (cur == tool) return; int cost = deckToolCosts[tool]; if (metal >= cost) { metal -= cost; deckGrid[c][r] = tool; statusLog = deckToolLabels[tool] + " installiert."; } else { statusLog = "Nicht genug Metall (" + cost + " benötigt)."; } } void synthesizeIsotope(boolean heavyCore) { float stab = getAtomStability(); if (stab < 0.55) { statusLog = "Kern zu instabil (" + int(stab * 100) + "%)! Passe Neutronen/Elektronen an."; return; } if (getUsedCargo() >= getMaxCargo()) { statusLog = "Frachtraum voll! Schaffe Platz für synthetisierte Materie."; return; } if (heavyCore) { if (atomProtons >= 6 && researchPts >= 15) { researchPts -= 15; cargo[3]++; statusLog = "Quanten-Kern (" + getElementName(atomProtons) + ") synthetisiert!"; } else { statusLog = "Benötigt Z >= 6 und 15 Forschungspunkte."; } } else { if (atomProtons >= 2 && researchPts >= 8) { researchPts -= 8; cargo[1]++; statusLog = "DTIM-Isotop (" + getElementName(atomProtons) + ") in Frachtraum geladen!"; } else { statusLog = "Benötigt Z >= 2 und 8 Forschungspunkte."; } } } void advanceAxiomResearch() { int lv = axiomLvl[activeAxiom]; if (lv >= 3) { statusLog = "Dieses Axiom ist bereits auf Stufe 3 maximiert."; return; } int cost = axiomCosts[lv]; if (researchPts >= cost) { researchPts -= cost; axiomLvl[activeAxiom]++; if (activeAxiom == 1) maxFuel += 30; statusLog = "Durchbruch! " + axiomTitles[activeAxiom][lv] + " freigeschaltet!"; } else { statusLog = "Benötigt " + cost + " Forschungspunkte (aktuell " + researchPts + ")."; } } void colonizeCurrentSystem() { if (sysOwner[currentSystem] == 1) { statusLog = sysNames[currentSystem] + " gehört bereits den Norn & Meerschweinchen."; return; } if (bioFood >= 25) { bioFood -= 25; sysOwner[currentSystem] = 1; sysFleetCyborg[currentSystem] = 0; sysFleetNorn[currentSystem] = max(1, sysFleetNorn[currentSystem]); statusLog = "Wheek! " + sysNames[currentSystem] + " erfolgreich besiedelt!"; } else { statusLog = "Kolonisierung benötigt 25 Bio-Nahrung."; } } void mousePressed() { // Top Tab Bar Clicks if (mouseY >= 15 && mouseY <= 43) { float tx = 18; for (int m = 1; m <= 4; m++) { if (mouseX >= tx && mouseX <= tx + 116) { viewMode = m; return; } tx += 122; } } // Mode 1: Space Flight & Market Buttons if (viewMode == 1 && mouseX >= 769 && mouseX <= 1053) { if (!isDocked) { if (mouseY >= 170 && mouseY <= 204) toggleDocking(); return; } float cy = 121; for (int g = 0; g < NUM_GOODS; g++) { if (mouseY >= cy && mouseY <= cy + 24) { if (mouseX <= 907) buyTradeGood(g); else sellTradeGood(g); return; } cy += 50; } if (mouseY >= 321 && mouseY <= 347) { if (credits >= 10 && fuel < maxFuel) { credits -= 10; fuel = maxFuel; statusLog = "Vollgetankt!"; } return; } if (mouseY >= 379 && mouseY <= 404 && lvlCargo < 5 && credits >= lvlCargo * 90) { credits -= lvlCargo * 90; lvlCargo++; statusLog = "Frachtraum erweitert!"; return; } if (mouseY >= 409 && mouseY <= 434 && lvlEngine < 5 && credits >= lvlEngine * 100) { credits -= lvlEngine * 100; lvlEngine++; statusLog = "Triebwerke verbessert!"; return; } if (mouseY >= 445 && mouseY <= 479) { toggleDocking(); return; } } // Mode 2: Deck Habitat Grid & Tool Palette if (viewMode == 2) { int c = (mouseX - DECK_OX) / TILE_SZ; int r = (mouseY - DECK_OY) / TILE_SZ; if (mouseX >= DECK_OX && c >= 0 && c < DECK_COLS && mouseY >= DECK_OY && r >= 0 && r < DECK_ROWS) { applyDeckBrush(c, r, mouseButton == RIGHT ? 0 : selectedDeckTool); return; } if (mouseX >= 769 && mouseX <= 1053) { for (int t = 0; t < 7; t++) { float by = 100 + t * 29; if (mouseY >= by && mouseY <= by + 25) { selectedDeckTool = t; return; } } } } // Mode 3: Atom Lab Buttons if (viewMode == 3 && mouseX >= 769 && mouseX <= 1053) { if (mouseY >= 104 && mouseY <= 130) { if (mouseX <= 907) atomProtons = min(18, atomProtons + 1); else atomProtons = max(1, atomProtons - 1); } else if (mouseY >= 136 && mouseY <= 162) { if (mouseX <= 907) atomNeutrons = min(24, atomNeutrons + 1); else atomNeutrons = max(0, atomNeutrons - 1); } else if (mouseY >= 168 && mouseY <= 194) { if (mouseX <= 907) atomElectrons = min(18, atomElectrons + 1); else atomElectrons = max(0, atomElectrons - 1); } else if (mouseY >= 264 && mouseY <= 296) { synthesizeIsotope(false); } else if (mouseY >= 302 && mouseY <= 334) { synthesizeIsotope(true); } else if (mouseY >= 340 && mouseY <= 372) { if (getAtomStability() >= 0.5 && researchPts >= 5) { researchPts -= 5; fuel = min(maxFuel, fuel + 30); statusLog = "+30 Reaktor-Treibstoff aus Kernresonanz gewonnen!"; } } } // Mode 4: Galaxy Map Star Jump & Axiomatic Tech if (viewMode == 4) { for (int i = 0; i < NUM_SYSTEMS; i++) { if (dist(mouseX, mouseY, sysMapX[i], sysMapY[i]) < 24 && i != currentSystem) { boolean reach = sysLinks[currentSystem][i] || (axiomLvl[0] >= 2); if (reach && fuel >= 15) { fuel -= 15; sysFleetNorn[currentSystem] = max(0, sysFleetNorn[currentSystem] - 1); sysFleetNorn[i]++; enterSystem(i); viewMode = 1; } else { statusLog = "Benötigt Hyperraum-Verbindung (oder Axiom I.2) & 15 Treibstoff."; } return; } } if (mouseX >= 769 && mouseX <= 1053) { for (int b = 0; b < 3; b++) { float by = 102 + b * 34; if (mouseY >= by && mouseY <= by + 28) { activeAxiom = b; return; } } if (mouseY >= 212 && mouseY <= 242) { advanceAxiomResearch(); return; } if (mouseY >= 322 && mouseY <= 350) { colonizeCurrentSystem(); return; } if (mouseY >= 356 && mouseY <= 384 && metal >= 30) { metal -= 30; sysFleetNorn[currentSystem]++; statusLog = "Norn-Begleitschiff gebaut!"; return; } } } } void mouseDragged() { if (viewMode == 2) { int c = (mouseX - DECK_OX) / TILE_SZ; int r = (mouseY - DECK_OY) / TILE_SZ; if (mouseX >= DECK_OX && c >= 0 && c < DECK_COLS && mouseY >= DECK_OY && r >= 0 && r < DECK_ROWS) { applyDeckBrush(c, r, mouseButton == RIGHT ? 0 : selectedDeckTool); } } } void keyPressed() { // Global View Switches if (key == '1') viewMode = 1; if (key == '2') viewMode = 2; if (key == '3') viewMode = 3; if (key == '4') viewMode = 4; if (key == 'h' || key == 'H') a11yMode = !a11yMode; // Mode 1 Controls if (viewMode == 1) { if (key == 'w' || key == 'W' || keyCode == UP) keyUp = true; if (key == 's' || key == 'S' || keyCode == DOWN) keyDown = true; if (key == 'a' || key == 'A' || keyCode == LEFT) keyLeft = true; if (key == 'd' || key == 'D' || keyCode == RIGHT) keyRight = true; if (key == 'l' || key == 'L') toggleDocking(); if (key == 'u' || key == 'U') { if (isDocked && lvlCargo < 5 && credits >= lvlCargo * 90) { credits -= lvlCargo * 90; lvlCargo++; } } if (key == 'i' || key == 'I') { if (isDocked && lvlEngine < 5 && credits >= lvlEngine * 100) { credits -= lvlEngine * 100; lvlEngine++; } } } // Mode 3 Atom Controls if (viewMode == 3) { if (key == 'q' || key == 'Q') atomProtons = min(18, atomProtons + 1); if (key == 'a' || key == 'A') atomProtons = max(1, atomProtons - 1); if (key == 'w' || key == 'W') atomNeutrons = min(24, atomNeutrons + 1); if (key == 's' || key == 'S') atomNeutrons = max(0, atomNeutrons - 1); if (key == 'e' || key == 'E') atomElectrons = min(18, atomElectrons + 1); if (key == 'd' || key == 'D') atomElectrons = max(0, atomElectrons - 1); if (key == 'f' || key == 'F') synthesizeIsotope(false); if (key == 'g' || key == 'G') synthesizeIsotope(true); } // Mode 4 Galaxy Controls if (viewMode == 4) { if (key == 'f' || key == 'F') advanceAxiomResearch(); if (key == 'k' || key == 'K') colonizeCurrentSystem(); } } void keyReleased() { if (key == 'w' || key == 'W' || keyCode == UP) keyUp = false; if (key == 's' || key == 'S' || keyCode == DOWN) keyDown = false; if (key == 'a' || key == 'A' || keyCode == LEFT) keyLeft = false; if (key == 'd' || key == 'D' || keyCode == RIGHT) keyRight = false; }