diff --git a/Ringstats_Dokumentation.fdb_latexmk b/Ringstats_Dokumentation.fdb_latexmk index a2ad5a5c..3944e72b 100644 --- a/Ringstats_Dokumentation.fdb_latexmk +++ b/Ringstats_Dokumentation.fdb_latexmk @@ -1,6 +1,5 @@ # Fdb version 4 -["pdflatex"] 1783431678.04028 "/home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken/Ringstats_Dokumentation.tex" "Ringstats_Dokumentation.pdf" "Ringstats_Dokumentation" 1783431679.12842 0 - "/home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken/Ringstats_Dokumentation.tex" 1783431677.99026 22127 9c02fde45b05485b4d6e44f2a7e8ba1e "" +["pdflatex"] 1783666653.26974 "Ringstats_Dokumentation.tex" "Ringstats_Dokumentation.pdf" "Ringstats_Dokumentation" 1783666654.50651 0 "/usr/share/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc" 1775415801 2971 def0b6c1f0b107b3b936def894055589 "" "/usr/share/texmf-dist/fonts/enc/dvips/cm-super/cm-super-ts1.enc" 1775415801 2900 1537cc8184ad1792082cd229ecc269f4 "" "/usr/share/texmf-dist/fonts/map/fontname/texfonts.map" 1775415801 3524 cb3e574dea2d1052e39280babc910dc8 "" @@ -169,9 +168,9 @@ "/usr/share/texmf-dist/web2c/texmf.cnf" 1775415801 43569 fd570f2fa160877d211e859f687312ba "" "/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map" 1780436122 5385779 47c0c393a77fd4a098bacfd57d66b88a "" "/var/lib/texmf/web2c/pdftex/pdflatex.fmt" 1780436120 3734532 282dcc45f1c728134b92f993ed6db952 "" - "Ringstats_Dokumentation.aux" 1783431679.08329 11920 6f4c4930e4f31ec828a5b3aab7f8ac7d "pdflatex" - "Ringstats_Dokumentation.tex" 1783431677.99026 22127 9c02fde45b05485b4d6e44f2a7e8ba1e "" - "Ringstats_Dokumentation.toc" 1783431679.08529 2164 0e5aae9731a2850f18801d399dcfe537 "pdflatex" + "Ringstats_Dokumentation.aux" 1783666654.44961 11920 6f4c4930e4f31ec828a5b3aab7f8ac7d "pdflatex" + "Ringstats_Dokumentation.tex" 1783666631.03218 22117 56a2f20d88787d04029dcd5bfa3fef5f "" + "Ringstats_Dokumentation.toc" 1783666654.45261 2164 0e5aae9731a2850f18801d399dcfe537 "pdflatex" "assets/er-modell.png" 1778764597.46144 805989 0b7323ca4b38e6518c24fd9e5684655b "" (generated) "Ringstats_Dokumentation.aux" diff --git a/Ringstats_Dokumentation.fls b/Ringstats_Dokumentation.fls index d5e1c5ad..dc3241af 100644 --- a/Ringstats_Dokumentation.fls +++ b/Ringstats_Dokumentation.fls @@ -1,7 +1,7 @@ PWD /home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken INPUT /usr/share/texmf-dist/web2c/texmf.cnf INPUT /var/lib/texmf/web2c/pdftex/pdflatex.fmt -INPUT /home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken/Ringstats_Dokumentation.tex +INPUT Ringstats_Dokumentation.tex OUTPUT Ringstats_Dokumentation.log INPUT /usr/share/texmf-dist/tex/latex/koma-script/scrartcl.cls INPUT /usr/share/texmf-dist/tex/latex/koma-script/scrartcl.cls diff --git a/Ringstats_Dokumentation.log b/Ringstats_Dokumentation.log index b806f4f1..28894e2a 100644 --- a/Ringstats_Dokumentation.log +++ b/Ringstats_Dokumentation.log @@ -1,12 +1,9 @@ -This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026/Arch Linux) (preloaded format=pdflatex 2026.6.2) 7 JUL 2026 15:41 +This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026/Arch Linux) (preloaded format=pdflatex 2026.6.2) 10 JUL 2026 08:57 entering extended mode restricted \write18 enabled. %&-line parsing enabled. -**"/home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken/Ringstats_Dokument -ation.tex" - -(/home/hikyu/Documents/Uni/2026 Sommer/Moderne Datenbanken/Ringstats_Dokumentat -ion.tex +**Ringstats_Dokumentation.tex +(./Ringstats_Dokumentation.tex LaTeX2e <2025-11-01> L3 programming layer <2026-01-19> (/usr/share/texmf-dist/tex/latex/koma-script/scrartcl.cls @@ -751,13 +748,13 @@ L3 programming layer <2026-01-19> *********** ) Here is how much of TeX's memory you used: - 24519 strings out of 469462 - 478765 string characters out of 5468615 + 24518 strings out of 469462 + 478591 string characters out of 5468615 1015471 words of memory out of 5000000 52785 multiletter control sequences out of 15000+600000 641744 words of font info for 69 fonts, out of 8000000 for 9000 14 hyphenation exceptions out of 8191 - 108i,8n,108p,11313b,463s stack positions out of 10000i,1000n,20000p,200000b,200000s + 108i,8n,108p,11253b,463s stack positions out of 10000i,1000n,20000p,200000b,200000s 0.9) { - playerLevel += 1; - } + if (Math.random() < CHANCE_LEVEL_UP) { + playerLevel += 1; + } - if (Math.random() > 0.85) { + // Event: Schnellreise + if (Math.random() < CHANCE_FAST_TRAVEL) { currentRegionId = Math.floor(Math.random() * 16) + 1; const startTravel = performance.now(); @@ -85,7 +93,8 @@ while (true) { console.log(); } - if (Math.random() > 0.90) { + // Event: Gear-Swap + if (Math.random() < CHANCE_GEAR_SWAP) { const newWeaponId = Math.floor(Math.random() * 10) + 1; const newArmorId = Math.floor(Math.random() * 10) + 11; const newTalismanId = Math.floor(Math.random() * 5) + 26; @@ -109,8 +118,9 @@ while (true) { console.log(); } - const startSync = performance.now(); - await setVal("player:1", { + // Aktuellen Stand sichern + const startSync = performance.now(); + await setVal("player:1", { id: 1, name: "Jonas", health: playerHealth, @@ -124,8 +134,9 @@ while (true) { log(`[Live Sync] [ID: 1] Jonas - Lvl: ${playerLevel} | HP: ${playerHealth} | Stamina: ${playerStamina}`, colors.green); log(`[Stats] Query Time: ${syncTime}ms | Reqs in Block: 1 | Total Reqs: ${totalRequests}`, colors.gray); - if (Math.random() > 0.7) { - const startLock = performance.now(); + // Event: Gegner-Lock + if (Math.random() < CHANCE_TARGET_LOCK) { + const startLock = performance.now(); const enemyIds = (await getVal(`region:${currentRegionId}:enemies`)) || []; totalRequests += 1; const randomEnemyId = enemyIds.length > 0 ? enemyIds[Math.floor(Math.random() * enemyIds.length)] : null; @@ -149,5 +160,9 @@ while (true) { } } + } catch (error) { + log("Verbindungsabbruch zu ArangoDB!", colors.red); + } + await Bun.sleep(2000); } diff --git a/endpraesi/client-memcached/index.ts b/endpraesi/client-memcached/index.ts index cbcfd661..facc7059 100644 --- a/endpraesi/client-memcached/index.ts +++ b/endpraesi/client-memcached/index.ts @@ -52,17 +52,25 @@ let playerStamina = 100; let playerLevel = 1; let currentRegionId = 1; +const CHANCE_LEVEL_UP = 0.10; +const CHANCE_FAST_TRAVEL = 0.15; +const CHANCE_GEAR_SWAP = 0.10; +const CHANCE_TARGET_LOCK = 0.30; + log("Entering live sync loop (press Ctrl+C to exit)...", colors.gray); while (true) { - playerHealth = Math.floor(Math.max(10, playerHealth - (Math.random() * 10) + 5)); - playerStamina = Math.floor(Math.max(10, playerStamina - (Math.random() * 20) + 10)); + try { + // Werte aktualisieren + playerHealth = Math.floor(Math.max(10, playerHealth - (Math.random() * 10) + 5)); + playerStamina = Math.floor(Math.max(10, playerStamina - (Math.random() * 20) + 10)); - if (Math.random() > 0.9) { - playerLevel += 1; - } + if (Math.random() < CHANCE_LEVEL_UP) { + playerLevel += 1; + } - if (Math.random() > 0.85) { + // Event: Schnellreise + if (Math.random() < CHANCE_FAST_TRAVEL) { currentRegionId = Math.floor(Math.random() * 16) + 1; const startTravel = performance.now(); @@ -85,7 +93,8 @@ while (true) { console.log(); } - if (Math.random() > 0.90) { + // Event: Gear-Swap + if (Math.random() < CHANCE_GEAR_SWAP) { const newWeaponId = Math.floor(Math.random() * 10) + 1; const newArmorId = Math.floor(Math.random() * 10) + 11; const newTalismanId = Math.floor(Math.random() * 5) + 26; @@ -109,8 +118,9 @@ while (true) { console.log(); } - const startSync = performance.now(); - await setJson("player:1", { + // Aktuellen Stand sichern + const startSync = performance.now(); + await setJson("player:1", { id: 1, name: "Jonas", health: playerHealth, @@ -124,8 +134,9 @@ while (true) { log(`[Live Sync] [ID: 1] Jonas - Lvl: ${playerLevel} | HP: ${playerHealth} | Stamina: ${playerStamina}`, colors.green); log(`[Stats] Query Time: ${syncTime}ms | Reqs in Block: 1 | Total Reqs: ${totalRequests}`, colors.gray); - if (Math.random() > 0.7) { - const startLock = performance.now(); + // Event: Gegner-Lock + if (Math.random() < CHANCE_TARGET_LOCK) { + const startLock = performance.now(); const enemyIds = (await getJson(`region:${currentRegionId}:enemies`)) || []; totalRequests += 1; const randomEnemyId = enemyIds.length > 0 ? enemyIds[Math.floor(Math.random() * enemyIds.length)] : null; @@ -149,5 +160,9 @@ while (true) { } } + } catch (error) { + log("Verbindungsabbruch zu Memcached!", colors.red); + } + await Bun.sleep(2000); } diff --git a/endpraesi/client-redis/index.ts b/endpraesi/client-redis/index.ts index c5f4d423..868d53e3 100644 --- a/endpraesi/client-redis/index.ts +++ b/endpraesi/client-redis/index.ts @@ -43,17 +43,25 @@ let playerStamina = 100; let playerLevel = 1; let currentRegionId = 1; +const CHANCE_LEVEL_UP = 0.10; +const CHANCE_FAST_TRAVEL = 0.15; +const CHANCE_GEAR_SWAP = 0.10; +const CHANCE_TARGET_LOCK = 0.30; + log("Entering live sync loop (press Ctrl+C to exit)...", colors.gray); while (true) { - playerHealth = Math.floor(Math.max(10, playerHealth - (Math.random() * 10) + 5)); - playerStamina = Math.floor(Math.max(10, playerStamina - (Math.random() * 20) + 10)); - - if (Math.random() > 0.9) { - playerLevel += 1; - } + try { + // 1. Lebens- und Ausdauerwerte simulieren + playerHealth = Math.floor(Math.max(10, playerHealth - (Math.random() * 10) + 5)); + playerStamina = Math.floor(Math.max(10, playerStamina - (Math.random() * 20) + 10)); + + if (Math.random() < CHANCE_LEVEL_UP) { + playerLevel += 1; + } - if (Math.random() > 0.85) { + // 2. Zufälliges Event: Schnellreise in eine andere Region + if (Math.random() < CHANCE_FAST_TRAVEL) { currentRegionId = Math.floor(Math.random() * 16) + 1; const startTravel = performance.now(); @@ -76,7 +84,8 @@ while (true) { console.log(); } - if (Math.random() > 0.90) { // 10% chance to swap gear + // 3. Zufälliges Event: Ausrüstung wechseln + if (Math.random() < CHANCE_GEAR_SWAP) { const newWeaponId = Math.floor(Math.random() * 10) + 1; // 1 to 10 const newArmorId = Math.floor(Math.random() * 10) + 11; // 11 to 20 const newTalismanId = Math.floor(Math.random() * 5) + 26; // 26 to 30 @@ -101,8 +110,9 @@ while (true) { console.log(); } - const startSync = performance.now(); - await redis.hset("player:1", { + // 4. Aktuelle Spielerdaten an Redis senden + const startSync = performance.now(); + await redis.hset("player:1", { id: 1, name: "Jonas", health: playerHealth, @@ -116,8 +126,9 @@ while (true) { log(`[Live Sync] [ID: 1] Jonas - Lvl: ${playerLevel} | HP: ${playerHealth} | Stamina: ${playerStamina}`, colors.green); log(`[Stats] Query Time: ${syncTime}ms | Reqs in Block: 1 | Total Reqs: ${totalRequests}`, colors.gray); - if (Math.random() > 0.7) { - const startLock = performance.now(); + // 5. Zufälliges Event: Gegner anvisieren + if (Math.random() < CHANCE_TARGET_LOCK) { + const startLock = performance.now(); const randomEnemyId = await redis.srandmember(`region:${currentRegionId}:enemies`); totalRequests += 1; @@ -140,5 +151,10 @@ while (true) { } } + } catch (error) { + log("Datenbankfehler! Verbindung zu Redis unterbrochen.", colors.red); + console.error(error); + } + await Bun.sleep(2000); } diff --git a/endpraesi/data.ts b/endpraesi/data.js similarity index 95% rename from endpraesi/data.ts rename to endpraesi/data.js index 3a26d58a..19aa60d7 100644 --- a/endpraesi/data.ts +++ b/endpraesi/data.js @@ -1,5 +1,5 @@ /** - * KI GENERIERT + * Mock-Daten */ export const effects = [ @@ -16,16 +16,16 @@ export const effects = [ ]; export const types = [ - { id: 1, item_id: 101, name: "Dolch" }, - { id: 2, item_id: 102, name: "Gerades Schwert" }, - { id: 3, item_id: 103, name: "Großschwert" }, - { id: 4, item_id: 104, name: "Katana" }, - { id: 5, item_id: 105, name: "Helm" }, - { id: 6, item_id: 106, name: "Brustpanzer" }, - { id: 7, item_id: 107, name: "Stulpen" }, - { id: 8, item_id: 108, name: "Beinschutz" }, - { id: 9, item_id: 109, name: "Mittlerer Schild" }, - { id: 10, item_id: 110, name: "Talisman-Amulett" }, + { id: 1, name: "Dolch" }, + { id: 2, name: "Gerades Schwert" }, + { id: 3, name: "Großschwert" }, + { id: 4, name: "Katana" }, + { id: 5, name: "Helm" }, + { id: 6, name: "Brustpanzer" }, + { id: 7, name: "Stulpen" }, + { id: 8, name: "Beinschutz" }, + { id: 9, name: "Mittlerer Schild" }, + { id: 10, name: "Talisman-Amulett" }, ]; export const weapons = [