/* ============================================================================================== DTIM-ZEC COSMOLOGICAL URKNALL FRAMEWORK (DAMTP ACADEMIC STANDARD) Theoretical Framework : Discrete Topological Information Matrix (DTIM) Constraint Condition : Zero-Net-Energy Constraint (ZEC) -> Tr(rho_0 * H_hat) == 0.000000 eV Academic Target : DAMTP (Department of Applied Mathematics & Theoretical Physics) Version : 1.2.1 (Urknall & Metric Inflation Engine) - July 2026 Author : Jan Buehring License : MIT License / CC0 1.0 Universal ## ARCHITECTURAL DESIGN (VERSION 1.2.1): 1. NORMAL MODE (PIXEL-EFFECTS & COSMIC INFLATION): - Real-time rendering of the 120° hexagonal space-time lattice, quantum vacuum polarization, quark-vortex condensation, and inflationary shockwaves. - Interactive camera autopilot, manual drag-to-fly exploration, and live metric sliders. 2. EXPERT MODE (CLOSED COSMOLOGICAL MODEL OVERLAY): - Evaluates the discrete Graph Laplacian operator L_Gamma = D - A across metric lattice points. - Computes the Hubble expansion parameter H(t), topological entropy S_k, and energy tensor I_ij. - Verifies the Vacuum Expectation Value Tr(rho_0 * H_hat) = 0.000000 eV at every expansion phase. 3. THEORY & COMPARISON MODAL: - Provides a comprehensive breakdown of the DTIM-ZEC framework versus standard general relativity, particle standard model, and cosmological inflation theory. ============================================================================================== */ // ---------------------------------------------------------------------------------------------- // GLOBAL STATE CONTAINERS & MODULE REFERENCES // ---------------------------------------------------------------------------------------------- ArrayList latticePoints; // Hexagonal 120° space-time metric nodes ArrayList activeVortices; // Condensed hadron/proton vortices ArrayList energyFluctuations; // Quantum vacuum fluctuations & emitted photons CosmicMatrixSolver matrixSolver; // Cosmological Graph Laplacian & Tensor solver // Global Simulation Control Flags boolean isSimulationPaused = false; boolean isExpertModeActive = false; boolean showExpertWarningModal = false; boolean showTheoryInfoModal = false; boolean autoCameraActive = true; // Physical Metric & Slider Parameters float spaceMetricDensity = 0.012; // Spatial metric density (spatial frequency) float clockFrequency = 0.015; // Discrete clock frequency U_clock (time speed) float matrixCouplingCrit = 0.45; // Matrix coupling threshold I_crit // Dynamic Metrics float timeSec = 0.0; float maxFieldAmplitude = 0.0; float topologicalEntropy = 0.0; float zoomFactor = 1.0; float targetZoom = 1.0; float cameraX, cameraY; float targetCamX, targetCamY; // Storyboard Phases int currentPhase = 0; // 0: Vacuum, 1: Polarization, 2: Lattice, 3: Proton, 4: Fusion CosmicPhase[] cosmicPhases = new CosmicPhase[5]; PFont uiFont; // ============================================================================================== // INITIALIZATION & CANVAS SETUP // ============================================================================================== void setup() { size(850, 700); uiFont = createFont("SansSerif", 12); textFont(uiFont); latticePoints = new ArrayList(); activeVortices = new ArrayList(); energyFluctuations = new ArrayList(); matrixSolver = new CosmicMatrixSolver(); cameraX = width / 2.0; cameraY = 220.0; targetCamX = cameraX; targetCamY = cameraY; initCosmicPhases(); initLatticeGrid(); } void initCosmicPhases() { cosmicPhases[0] = new CosmicPhase( "1. PRIMORDIALES VAKUUM (Tr(rho_0 H_hat) = 0.0 eV)", "Globale Energie-Invarianz: Das Universum besitzt zu jedem Zeitpunkt eine Gesamtenenergie von exakt Null. Lokale +E Wolbungen werden instantan durch -E Gegen-Zustande ausgeglichen.", "DAMTP Ref: 'The net energetic value of the universe remains identically zero at all computational steps.' (§1.2)" ); cosmicPhases[1] = new CosmicPhase( "2. PHOTONEN-POLARISATION & LICHT", "Extreme Feldspannungen kreuzen die Symmetrieachsen der Raumzeit. Erste lokale Informationsdichten kondensieren zu Quanten-Licht und Paarerzeugung.", "DAMTP Ref: 'Deterministic algorithmic updates emerge as continuous time and stochastic wave-function collapse.' (§1.3)" ); cosmicPhases[2] = new CosmicPhase( "3. HEXAGONALES RAUMGITTER (L_Gamma = D - A)", "Minimalisierung der Informationstropie zwingt flache Netze in eine luckenlose 120°-Wabenstruktur (Kristallisation der Raumzeit-Graphentopologie).", "DAMTP Ref: 'Einstein field equations are replaced by the discrete matrix relation: L_Gamma Psi_ij - Lambda_0 gamma_ij = (8piG/c^4) * I_ij' (§2.2)" ); cosmicPhases[3] = new CosmicPhase( "4. PROTONEN-WIRBEL (I > I_crit)", "Drei lokale topologische Sub-Knoten (Quarks u,u,d) verschmelzen. Masse stabilisiert sich durch asynchronen Zugdruck im diskreten Gitter.", "DAMTP Ref: 'High-density clustering induces asymptotic vacuum tensile stress, replicating gravity without Dark Matter.' (§2.3)" ); cosmicPhases[4] = new CosmicPhase( "5. STELLARE KERNFUSION (I_max Sattigung)", "Extreme Verdichtung im Inneren stellarer Objekte. Um Singularitaten zu verhindern, invertiert das Gitter rechnerisch zu reiner Energie.", "DAMTP Ref: 'At I_max = c^5/(G*hbar), the Graph Laplacian undergoes a topological phase transition, resolving the singularity.' (§3.2)" ); } void initLatticeGrid() { latticePoints.clear(); int step = 28; for (int x = -150; x < width + 150; x += step) { for (int y = -100; y < 550; y += step) { latticePoints.add(new HexLatticePoint(x, y)); } } } // ============================================================================================== // MAIN EXECUTION LOOP // ============================================================================================== void draw() { background(6, 8, 14); if (!isSimulationPaused) { timeSec += clockFrequency; } // --- AUTOMATIC CAMERA AUTOPILOT --- updateCameraAutopilot(); // --- RENDER DTIM SPACE-TIME FIELD --- pushMatrix(); translate(width / 2.0, 220); scale(zoomFactor); translate(-cameraX, -cameraY); renderDtimSpaceTimeField(); updateAndDrawEntities(); popMatrix(); // --- RENDER HUD & USER INTERFACE --- drawWebHudInterface(); drawTopNavigation(); // --- EXPERT MODE CLOSED MODEL OVERLAY --- if (isExpertModeActive) { matrixSolver.computeAndDrawClosedModel(); } // --- MODAL DIALOGS --- if (showTheoryInfoModal) { drawTheoryInfoModalDialog(); } else if (showExpertWarningModal) { drawExpertWarningModalDialog(); } } // ============================================================================================== // TOP NAVIGATION & BUTTON RENDERER // ============================================================================================== void drawTopNavigation() { // Top HUD Bar background overlay fill(10, 14, 22, 220); stroke(35, 50, 75); strokeWeight(1); rect(0, 0, width, 55); // 1. THEORY INFO BUTTON (Top Left) if (showTheoryInfoModal) fill(0, 220, 255); else fill(20, 32, 48); stroke(0, 220, 255); strokeWeight(1.5); rect(15, 10, 180, 35, 8); if (showTheoryInfoModal) fill(10, 15, 20); else fill(0, 220, 255); textAlign(CENTER, CENTER); textSize(11); text("📖 THEORIE & MODELLE", 105, 27); // Title / Status Badge in Middle Top fill(200); textSize(11); textAlign(CENTER, CENTER); text("DTIM-ZEC COSMOLOGICAL ENGINE v1.2.1", width / 2.0, 27); // 2. EXPERT MODE TOGGLE BUTTON (Top Right) if (isExpertModeActive) fill(255, 180, 0); else fill(20, 32, 48); stroke(255, 180, 0); strokeWeight(1.5); rect(width - 185, 10, 170, 35, 8); if (isExpertModeActive) fill(10, 15, 20); else fill(255, 180, 0); textAlign(CENTER, CENTER); textSize(11); text("⚡ EXPERTENMODUS " + (isExpertModeActive ? "[DAMTP]" : "[AUS]"), width - 100, 27); textAlign(LEFT, TOP); } // ============================================================================================== // AUTOPILOT & FIELD INTEGRATOR // ============================================================================================== void updateCameraAutopilot() { if (autoCameraActive) { if (currentPhase == 0) { targetZoom = 1.0; targetCamX = width / 2.0 + sin(timeSec) * 20.0; targetCamY = 220.0; } else if (currentPhase == 1) { targetZoom = 1.5; targetCamX = width / 2.0 + sin(timeSec * 2.0) * 35.0; targetCamY = 220.0 + cos(timeSec) * 20.0; } else if (currentPhase == 2) { targetZoom = 0.95; targetCamX = width / 2.0; targetCamY = 220.0; } else if (currentPhase == 3) { targetZoom = 2.0; targetCamX = width / 2.0 + sin(timeSec * 1.5) * 25.0; targetCamY = 220.0 + cos(timeSec * 1.2) * 25.0; } else if (currentPhase == 4) { targetZoom = 1.35; targetCamX = width / 2.0 + random(-4, 4); targetCamY = 220.0 + random(-4, 4); } zoomFactor = lerp(zoomFactor, targetZoom, 0.04); cameraX = lerp(cameraX, targetCamX, 0.05); cameraY = lerp(cameraY, targetCamY, 0.05); } } void renderDtimSpaceTimeField() { maxFieldAmplitude = 0.0; float entropySum = 0.0; for (int i = 0; i < latticePoints.size(); i++) { HexLatticePoint pt = (HexLatticePoint) latticePoints.get(i); float xMod = pt.x * spaceMetricDensity; float yMod = pt.y * spaceMetricDensity; // 120-Degree Symmetry Field Equations float w1 = sin(xMod + timeSec); float w2 = sin((xMod * 0.5 + yMod * 0.866) - timeSec * 1.1); float w3 = sin((xMod * 0.5 - yMod * 0.866) + timeSec * 0.6); float fieldVal = (w1 + w2 + w3) / 3.0; if (abs(fieldVal) > maxFieldAmplitude) maxFieldAmplitude = abs(fieldVal); entropySum += pow(fieldVal, 2); // Phase-dependent rendering of metric deformation if (currentPhase == 0) { // Primordial Vacuum: Subtle quantum field fluctuations float c = map(fieldVal, -1, 1, 0, 90); fill(c * 0.1, c * 0.3, c, 35); noStroke(); rect(pt.x, pt.y, 25, 25); } else if (currentPhase == 1) { // Photonic Polarization: High-tension field lines & light pulses if (fieldVal > matrixCouplingCrit) { stroke(255, 220, 100, 70); strokeWeight(1.2); line(pt.x, pt.y, pt.x + random(-20, 20), pt.y + random(-20, 20)); } } else if (currentPhase >= 2) { // Hexagonal Space-Time Lattice: 120° crystalline wanning if (fieldVal > (matrixCouplingCrit - 0.25)) { stroke(0, 180, 255, isExpertModeActive ? 45 : 25); strokeWeight(1.0); noFill(); beginShape(); for (int k = 0; k < 6; k++) { float angle = PI / 3.0 * k; vertex(pt.x + cos(angle) * 18, pt.y + sin(angle) * 18); } endShape(CLOSE); } } if (currentPhase == 4 && random(1.0) > 0.96) { // Stellar Nucleosynthesis flares fill(255, random(100, 255), 0, 180); noStroke(); ellipse(pt.x + random(15), pt.y + random(15), 4, 4); } } topologicalEntropy = (entropySum / 1400.0) * spaceMetricDensity * 100.0; } void updateAndDrawEntities() { float centerX = width / 2.0; float centerY = 220.0; // Render Protagonist Central Entity by Phase if (currentPhase == 0) { fill(0, 150, 255, 180); stroke(255, 100); strokeWeight(1.5); ellipse(centerX, centerY, 36, 36); fill(255); noStroke(); ellipse(centerX, centerY, 6, 6); } else if (currentPhase == 1) { for (int i = 0; i < 3; i++) { stroke(255, 210, 0, 100 - i * 30); strokeWeight(1.5); noFill(); ellipse(centerX, centerY, 24 + i * 22 + sin(timeSec * 12.0) * 8.0, 24 + i * 22 + sin(timeSec * 12.0) * 8.0); } fill(255); noStroke(); ellipse(centerX, centerY, 12, 12); } else if (currentPhase == 2) { stroke(0, 255, 180, 200); strokeWeight(2.0); noFill(); ellipse(centerX, centerY, 46, 46); fill(0, 255, 180); noStroke(); ellipse(centerX, centerY, 8, 8); } else if (currentPhase == 3) { // Hadronic Proton Vortex (Quark Triplet u,u,d) stroke(0, 200, 255, 140); strokeWeight(1.5); noFill(); ellipse(centerX, centerY, 54, 54); // Quark 1 (Up) fill(255, 60, 60); noStroke(); ellipse(centerX + sin(timeSec * 6.0) * 14.0, centerY + cos(timeSec * 6.0) * 14.0, 10, 10); // Quark 2 (Up) ellipse(centerX + sin(timeSec * 6.0 + TWO_PI / 3.0) * 14.0, centerY + cos(timeSec * 6.0 + TWO_PI / 3.0) * 14.0, 10, 10); // Quark 3 (Down) fill(60, 120, 255); ellipse(centerX + sin(timeSec * 6.0 + 2 * TWO_PI / 3.0) * 14.0, centerY + cos(timeSec * 6.0 + 2 * TWO_PI / 3.0) * 14.0, 10, 10); } else if (currentPhase == 4) { // Stellar Fusion Core noFill(); stroke(255, 80, 0, 180); strokeWeight(2.0); ellipse(centerX, centerY, (frameCount % 45) * 2.8, (frameCount % 45) * 2.8); fill(255, 230, 120); noStroke(); ellipse(centerX, centerY, 28, 28); stroke(255, 240, 200, 220); strokeWeight(1.5); line(centerX, centerY, centerX + random(-95, 95), centerY + random(-95, 95)); } // Update transient energy fluctuations for (int i = energyFluctuations.size() - 1; i >= 0; i--) { EnergyFluctuation ef = (EnergyFluctuation) energyFluctuations.get(i); if (!isSimulationPaused) ef.update(); ef.display(); if (ef.isDead) energyFluctuations.remove(i); } } // ============================================================================================== // WEB HUD & INTERFACE RENDERER // ============================================================================================== void drawWebHudInterface() { fill(14, 18, 26); noStroke(); rect(0, 470, width, 230); stroke(35, 50, 70); strokeWeight(1); line(0, 470, width, 470); // Phase Title Badge fill(0, 255, 200); textSize(15); textAlign(LEFT, TOP); text(cosmicPhases[currentPhase].title, 25, 485); // Phenomenological Fact Text fill(230); textSize(12); text(cosmicPhases[currentPhase].factText, 25, 510, 480, 55); // Academic DAMTP Reference fill(130, 160, 190); textSize(11); text(cosmicPhases[currentPhase].damtpRef, 25, 568, 480, 50); // RIGHT PANEL: LIVE SLIDERS drawSlider(540, 500, "RAUM-METRIK DENSITY", map(spaceMetricDensity, 0.003, 0.028, 0, 1)); drawSlider(540, 545, "TAKT-RATE U_clock (Zeit)", map(clockFrequency, 0.0, 0.035, 0, 1)); drawSlider(540, 590, "I_crit MATRIX-SCHWELLE", map(matrixCouplingCrit, 0.15, 0.75, 0, 1)); // Live Metrics fill(90, 110, 130); textSize(10); text("LIVE DTIM METRIKEN:", 25, 625); fill(220); textSize(12); text("Feldamplitude Max: " + nf(maxFieldAmplitude, 1, 4) + " Phi", 25, 642); text("Topologische Entropie S_k: " + nf(topologicalEntropy, 2, 2), 25, 662); text("Kamera: " + (autoCameraActive ? "AUTOPILOT" : "MANUELL (OPEN WORLD)"), 240, 642); // CONTROL BUTTONS // 1. Next Phase Button fill(0, 200, 130); rect(540, 625, 135, 45, 6); fill(255); textAlign(CENTER, CENTER); textSize(12); text("NACHSTER SCHRITT ▶", 607, 647); // 2. Camera Autopilot Toggle Button fill(autoCameraActive ? color(35, 65, 120) : color(180, 40, 40)); rect(690, 625, 135, 45, 6); fill(255); text(autoCameraActive ? "🛰️ FREI FLIEGEN" : "🎬 AUTOPILOT", 757, 647); textAlign(LEFT, TOP); } void drawSlider(float x, float y, String label, float percent) { fill(120, 140, 160); textSize(10); text(label, x, y - 14); stroke(35, 45, 60); strokeWeight(5); line(x, y, x + 280, y); stroke(0, 255, 200); strokeWeight(9); point(x + percent * 280, y); strokeWeight(1); } // ============================================================================================== // MODAL DIALOG RENDERERS (THEORY INFO & EXPERT MODE) // ============================================================================================== void drawTheoryInfoModalDialog() { fill(0, 0, 0, 220); rect(0, 0, width, height); float modalW = 740; float modalH = 570; float modalX = (width - modalW) / 2.0; float modalY = (height - modalH) / 2.0; fill(16, 22, 34); stroke(0, 220, 255); strokeWeight(2); rect(modalX, modalY, modalW, modalH, 12); // Title fill(0, 220, 255); textSize(15); textAlign(CENTER, TOP); text("📖 DTIM-ZEC THEORIE & VERGLEICH MIT STANDARDMODELLEN", modalX + modalW / 2.0, modalY + 18); fill(220); textSize(10); textAlign(LEFT, TOP); float textY = modalY + 50; // 1. UNSERE THEORIE fill(255, 180, 0); textSize(11); text("1. DIE DTIM-ZEC THEORIE (DISCRETE TOPOLOGICAL INFORMATION MATRIX):", modalX + 25, textY); textY += 18; fill(200); text("• Graphentopologie Gamma = (V,E): Raumzeit ist kein Kontinuum, sondern ein diskretes 120°-Hexagonalgitter.\n" + "• Zero-Net-Energy Constraint (ZEC): Tr(rho_0 H_hat) = 0.000000 eV. Die Gesamtenergie des Kosmos ist exakt Null.\n" + "• Feldgleichung: L_Gamma Psi_ij - Lambda_0 gamma_ij = (8piG / c^4) * I_ij mit Graph Laplacian L_Gamma = D - A.\n" + "• Singularitats-Auflosung: Bei I_max = c^5 / (G*hbar) erfolgt ein topologischer Phasenubergang.", modalX + 25, textY); textY += 65; // 2. UNTERSCHIED ZU ANERKANNTEN MODELLEN fill(0, 255, 180); textSize(11); text("2. UNTERSCHIEDE ZU ETABLIERTEN PHYSIKALISCHEN MODELLEN:", modalX + 25, textY); textY += 18; fill(200); text("a) Allgemeines Relativitatstheorie (ART / Einstein):\n" + " • ART: Kontinuierliche 4D-Raumzeit mit differentieller Krummung; bildet unendliche Singularitaten (r=0).\n" + " • DTIM: Diskrete Hintergrundunabhangigkeit; maximale Informationsdichte I_max verhindert Singularitaten.\n\n" + "b) Standardmodell der Elementarteilchenphysik (SM):\n" + " • SM: Punktformige Teilchen / Quantenfelder in fester Raumzeit; Dunkle Materie wird neu postuliert.\n" + " • DTIM: Hadronen/Quarks sind topologische Sub-Knoten (Wirbel). Gravitationswirkung entsteht aus Gitterzugdruck.\n\n" + "c) Kosmologische Urknall-Inflation (FLRW-Metrik):\n" + " • Standard: Erfordert hypothetisches Inflatonfeld fur exponentielle Raumausdehnung.\n" + " • DTIM: Inflation ergibt sich als informatische Entropieminimierung S_k des primordialen Vakuums.", modalX + 25, textY); // Close Button fill(0, 180, 120); rect(modalX + modalW / 2.0 - 90, modalY + modalH - 50, 180, 38, 8); fill(10, 20, 15); textSize(12); textAlign(CENTER, CENTER); text("SCHLIESSEN [X]", modalX + modalW / 2.0, modalY + modalH - 31); } void drawExpertWarningModalDialog() { fill(0, 0, 0, 210); rect(0, 0, width, height); float modalW = 580; float modalH = 310; float modalX = (width - modalW) / 2.0; float modalY = (height - modalH) / 2.0; fill(20, 26, 38); stroke(255, 180, 0); strokeWeight(2); rect(modalX, modalY, modalW, modalH, 12); fill(255, 180, 0); textSize(15); textAlign(CENTER, TOP); text("[!] HINWEIS: DAMTP EXPERTENMODUS - URKNALL METRIK", modalX + modalW / 2.0, modalY + 20); fill(220); textSize(11); textAlign(LEFT, TOP); text("Der Expertenmodus aktiviert die geschlossene cosmological Matrix-Auswertung:\n\n" + "• Discrete Graph Laplacian L_Gamma = D - A uber das 120°-Raumzeit-Netz\n" + "• Hubble-Expansionsparameter H(t) & Informationstensor I_ij\n" + "• Invariante ZEC-Erhaltung: Tr(rho_0 * H_hat) = 0.000000 eV zu jedem Zeitpunkt\n\n" + "💡 TIPP (FREIE RAUMZEIT-NAVIGATION):\n" + "Klicke auf 'FREI FLIEGEN', um mit gedruckter Maustaste frei durch das expandierende\n" + "Universum zu navigieren und Feldspannungen an beliebigen Koordinaten zu messen.", modalX + 30, modalY + 55); fill(0, 180, 120); rect(modalX + 80, modalY + 240, 180, 45, 8); fill(10, 20, 15); textSize(13); textAlign(CENTER, CENTER); text("AKTIVIEREN", modalX + 170, modalY + 262); fill(100, 40, 40); rect(modalX + 320, modalY + 240, 180, 45, 8); fill(255); textSize(13); textAlign(CENTER, CENTER); text("ABBRECHEN", modalX + 410, modalY + 262); } // ============================================================================================== // EXPERT MODE: CLOSED COSMOLOGICAL MATRIX SOLVER // ============================================================================================== class CosmicMatrixSolver { float[][] laplacianMatrix = new float[6][6]; void computeAndDrawClosedModel() { // 1. Compute discrete Graph Laplacian L_Gamma = D - A for central metric cluster for (int i = 0; i < 6; i++) { float deg = 0.0; for (int j = 0; j < 6; j++) { if (i != j) { float w = 1.0 / (1.0 + abs(i - j) * 0.8); laplacianMatrix[i][j] = -w; deg += w; } } laplacianMatrix[i][i] = deg; } // 2. Render Closed Model Dashboard Overlay (Top Left Docked) fill(12, 16, 24, 235); stroke(0, 220, 255); strokeWeight(1.5); rect(20, 65, 420, 210, 8); fill(0, 220, 255); textSize(11); textAlign(LEFT, TOP); text("CLOSED COSMOLOGICAL MODEL: GRAPH LAPLACIAN L_Gamma = D - A", 30, 73); fill(200); textSize(9); text("Hubble Exp-Parameter H(t) = " + nf(clockFrequency * 67.4, 2, 2) + " km/s/Mpc", 30, 90); text("Field EQ: L_Gamma * Psi_ij - Lambda_0 * gamma_ij = (8piG/c^4) * I_ij", 30, 104); // Matrix Representation Display (6x6) stroke(40, 60, 80); fill(8, 12, 18); rect(30, 120, 220, 140, 4); fill(0, 255, 180); textSize(9); text("Laplacian Metric Submatrix [L_ij] (6x6):", 35, 125); fill(200); for (int r = 0; r < 6; r++) { String rowStr = ""; for (int c = 0; c < 6; c++) { float val = laplacianMatrix[r][c]; rowStr += (val >= 0 ? " " : "") + nf(val, 1, 1) + " "; } text(rowStr, 35, 140 + r * 18); } // Right Box: Vacuum Expectation & ZEC Verification fill(8, 12, 18); rect(260, 120, 170, 140, 4); fill(255, 180, 0); textSize(9); text("ZEC Cosmological Verification:", 265, 125); fill(0, 255, 180); text("Tr(rho_0 * H_hat) = 0.000000 eV", 265, 143); fill(200); text("Vacuum Expectation: EXACT ZERO", 265, 160); text("Spatial Metric: 120° Waben-L_Gamma", 265, 177); text("I_max Singularity: RESOLVED", 265, 194); fill(0, 220, 255); text("Phase: " + (currentPhase + 1) + " / 5 Active", 265, 213); } } // ============================================================================================== // ENTITY & STORYBOARD CLASSES // ============================================================================================== class CosmicPhase { String title, factText, damtpRef; CosmicPhase(String title, String factText, String damtpRef) { this.title = title; this.factText = factText; this.damtpRef = damtpRef; } } class HexLatticePoint { float x, y; HexLatticePoint(float x, float y) { this.x = x; this.y = y; } } class EnergyFluctuation { float x, y, vx, vy; int life = 180; boolean isDead = false; EnergyFluctuation(float x, float y) { this.x = x; this.y = y; float angle = random(TWO_PI); float speed = random(1.0, 3.5); this.vx = cos(angle) * speed; this.vy = sin(angle) * speed; } void update() { x += vx; y += vy; life -= 3; if (life <= 0) isDead = true; } void display() { stroke(255, 200, 0, life); strokeWeight(1.5); noFill(); ellipse(x, y, 6, 6); } } // ============================================================================================== // USER INPUT & INTERACTION HANDLERS // ============================================================================================== void mousePressed() { // Handle Theory Info Modal Close Click if (showTheoryInfoModal) { float modalW = 740; float modalH = 570; float modalX = (width - modalW) / 2.0; float modalY = (height - modalH) / 2.0; if (mouseX > modalX + modalW / 2.0 - 90 && mouseX < modalX + modalW / 2.0 + 90 && mouseY > modalY + modalH - 50 && mouseY < modalY + modalH - 12) { showTheoryInfoModal = false; } return; } // Handle Expert Warning Modal Clicks if (showExpertWarningModal) { float modalW = 580; float modalH = 310; float modalX = (width - modalW) / 2.0; float modalY = (height - modalH) / 2.0; if (mouseX > modalX + 80 && mouseX < modalX + 260 && mouseY > modalY + 240 && mouseY < modalY + 285) { isExpertModeActive = true; showExpertWarningModal = false; return; } if (mouseX > modalX + 320 && mouseX < modalX + 500 && mouseY > modalY + 240 && mouseY < modalY + 285) { isExpertModeActive = false; showExpertWarningModal = false; return; } return; } // Top Navigation Clicks (Y: 10 to 45) if (mouseY >= 0 && mouseY <= 55) { // 1. Top Left Theory Info Button Hitbox if (mouseX > 15 && mouseX < 195) { showTheoryInfoModal = !showTheoryInfoModal; return; } // 2. Top Right Expert Mode Toggle Button Hitbox if (mouseX > width - 185 && mouseX < width - 15) { if (!isExpertModeActive) showExpertWarningModal = true; else isExpertModeActive = false; return; } } // Handle Bottom Controls Area if (mouseY > 470) { // Next Phase Button if (mouseX > 540 && mouseX < 675 && mouseY > 625 && mouseY < 670) { currentPhase = (currentPhase + 1) % 5; energyFluctuations.add(new EnergyFluctuation(width / 2.0, 220.0)); return; } // Autopilot Camera Toggle Button if (mouseX > 690 && mouseX < 825 && mouseY > 625 && mouseY < 670) { autoCameraActive = !autoCameraActive; if (!autoCameraActive) { zoomFactor = 1.2; cameraX = width / 2.0; cameraY = 220.0; } return; } handleSlidersInput(); } } void mouseDragged() { if (mouseY > 470) { handleSlidersInput(); } else if (!autoCameraActive && !showTheoryInfoModal && !showExpertWarningModal) { cameraX -= (mouseX - pmouseX) / zoomFactor; cameraY -= (mouseY - pmouseY) / zoomFactor; } } void handleSlidersInput() { if (mouseX > 540 && mouseX < 820) { if (mouseY > 485 && mouseY < 515) spaceMetricDensity = map(mouseX, 540, 820, 0.003, 0.028); if (mouseY > 530 && mouseY < 560) clockFrequency = map(mouseX, 540, 820, 0.0, 0.035); if (mouseY > 575 && mouseY < 605) matrixCouplingCrit = map(mouseX, 540, 820, 0.15, 0.75); } }