Journey encounters and 360 camera, Ludus training ground, offline gold fix, new music, settings layout, grounded KO, thraex shield, arena name chant

Stand von main 9c35eff2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 10:47:49 +01:00
parent 0454683fc3
commit c516679674
26 changed files with 856 additions and 151 deletions

57
tools/make_levelup.py Normal file
View File

@@ -0,0 +1,57 @@
"""Stufen-Ton (sfx_levelup) ohne Generator: gezupfte Leier (Karplus-Strong) spielt aufsteigend einen
Dur-Dreiklang, dazu ein leiser tiefer Gong und Raumhall. Warm und kurz statt greller Fanfare.
py -3.12 tools/make_levelup.py → Assets/Audio/sfx_levelup.mp3
"""
import os, subprocess, tempfile
import numpy as np
import soundfile as sf
SR = 44100
OUT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Assets", "Audio", "sfx_levelup.mp3")
rng = np.random.default_rng(7)
def pluck(freq, dur, bright=0.5):
n = int(SR * dur); p = int(SR / freq)
buf = rng.uniform(-1, 1, p) * np.hanning(p)
out = np.zeros(n)
for i in range(n):
out[i] = buf[i % p]
buf[i % p] = 0.5 * (buf[i % p] + buf[(i + 1) % p]) * (0.996 + 0.003 * bright)
return out * np.exp(-np.arange(n) / (SR * dur * 0.45))
def gong(freq, dur):
t = np.arange(int(SR * dur)) / SR
parts = [(1, 1.0), (2.76, 0.4), (5.4, 0.18), (1.5, 0.25)]
s = sum(a * np.sin(2 * np.pi * freq * m * t + rng.uniform(0, 6)) for m, a in parts)
return s * np.exp(-t / 0.7) * (1 - np.exp(-t / 0.004))
def reverb(x, mix=0.25):
y = np.concatenate([x, np.zeros(int(0.9 * SR))]); wet = np.zeros_like(y)
for d, g in ((1557, 0.62), (1617, 0.6), (1491, 0.64), (1422, 0.66)):
buf = np.zeros_like(y)
for i in range(len(y)):
buf[i] = y[i] + (buf[i - d] * g if i >= d else 0)
wet += buf * 0.25
return y * (1 - mix) + wet * mix
notes = [293.66, 369.99, 440.0, 587.33] # D-Dur: D4 Fis4 A4 D5
x = np.zeros(int(SR * 1.6))
for k, f in enumerate(notes):
s = pluck(f, 1.2 - 0.15 * k, bright=0.3 + 0.2 * k) * (0.8 + 0.1 * k)
at = int(SR * 0.075 * k)
x[at:at + len(s)] += s[:len(x) - at]
g = gong(146.83, 1.6) * 0.35
x[:len(g)] += g[:len(x)]
x = reverb(x / np.abs(x).max())
x = x / np.abs(x).max() * 0.8
x[-int(0.3 * SR):] *= np.linspace(1, 0, int(0.3 * SR))
st = np.stack([x, np.concatenate([np.zeros(300), x[:-300]])], axis=1) # leicht breit
with tempfile.TemporaryDirectory() as t:
w = os.path.join(t, "l.wav"); sf.write(w, st.astype(np.float32), SR)
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", w, "-af", "loudnorm=I=-18:TP=-2", "-ar", "44100", "-b:a", "192k", OUT], check=True)
print("ok", OUT)

66
tools/prep_music.py Normal file
View File

@@ -0,0 +1,66 @@
"""Neue Musik (z. B. aus Gemini) fürs Spiel aufbereiten: Stille an den Rändern weg, Lautheit
angleichen, Schleifen-Stücke nahtlos machen (Ende blendet in den Anfang über).
py -3.12 tools/prep_music.py [ordner] Standard: Assets/Audio/music
Liest <ordner>/music_*.mp3, schreibt Assets/Audio/music_*.mp3, verschiebt die Vorlagen nach
_Archiv/Musik-Vorlagen/ (nicht ausgeliefert).
"""
import os, shutil, subprocess, sys, tempfile
import numpy as np
import soundfile as sf
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
SRC = sys.argv[1] if len(sys.argv) > 1 else os.path.join(ROOT, "Assets", "Audio", "music")
DST = os.path.join(ROOT, "Assets", "Audio")
ARCHIVE = os.path.join(ROOT, "_Archiv", "Musik-Vorlagen")
LOOPS = {"music_menu", "music_ludus", "music_arena", "music_champion"}
# Ziel-Lautheit (LUFS): ruhige Stücke leiser, Kampf etwas lauter – passend zu Stimmen und Effekten
TARGET = {"music_ludus": -19, "music_menu": -18, "music_oath": -20, "music_arena": -17, "music_champion": -16.5}
XFADE = 3.0
def decode(p):
with tempfile.TemporaryDirectory() as t:
w = os.path.join(t, "a.wav")
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", p, "-ar", "44100", "-ac", "2", w], check=True)
return sf.read(w, dtype="float32")
def trim(x, sr, thr=10 ** (-45 / 20)):
loud = np.where(np.abs(x).max(axis=1) > thr)[0]
return x[max(0, loud[0] - int(0.02 * sr)):loud[-1] + 1] if len(loud) else x
def loop(x, sr):
"""Ende weich in den Anfang blenden: das Stück endet genau dort, wo es wieder beginnt."""
n = int(XFADE * sr)
head, tail = x[:n], x[-n:]
k = np.linspace(0, 1, n, dtype=np.float32)[:, None]
fade = np.sqrt(1 - k) * tail + np.sqrt(k) * head # gleiche Leistung
return np.concatenate([fade, x[n:-n]])
def main():
os.makedirs(ARCHIVE, exist_ok=True)
for f in sorted(os.listdir(SRC)):
if not (f.startswith("music_") and f.endswith(".mp3")): continue
name = f[:-4]
x, sr = decode(os.path.join(SRC, f))
x = trim(x, sr)
if name in LOOPS: x = loop(x, sr)
else: # einmalige Stücke: kurz ein- und ausblenden
n = int(0.05 * sr); x[:n] *= np.linspace(0, 1, n)[:, None]
m = int(1.5 * sr); x[-m:] *= np.linspace(1, 0, m)[:, None]
with tempfile.TemporaryDirectory() as t:
w = os.path.join(t, "b.wav"); sf.write(w, x, sr)
tgt = TARGET.get(name, -17.5)
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", w, "-af", f"loudnorm=I={tgt}:TP=-1.5:LRA=11",
"-ar", "44100", "-b:a", "192k", os.path.join(DST, f)], check=True)
shutil.move(os.path.join(SRC, f), os.path.join(ARCHIVE, f))
print(f"{name}: {len(x) / sr:.1f} s, {'Schleife' if name in LOOPS else 'einmal'}, {TARGET.get(name, -17.5)} LUFS")
if not os.listdir(SRC): os.rmdir(SRC)
if __name__ == "__main__":
main()