Phase 0: Greybox-Fundament
- Input-Map: alle Actions aus SPEC 9 (Tastatur + Xbox/PS5, physische Keycodes, Deadzone 0.2) - 11 Autoload-Skelette (SPEC 8) mit Doku-Bloecken, ohne Logik - Greybox-Testszene test_ground.tscn: Boden, Hindernisse, Spieler-Kapsel, Third-Person-Kamera (WoW-Zoom via SpringArm3D), WorldEnvironment - Debug-Overlay: FPS, aktives Eingabegeraet, Position, Kamera-Zoom - test_ground.tscn als Main Scene gesetzt Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
commit
f4c67ceead
40 changed files with 1064 additions and 0 deletions
0
scripts/.gitkeep
Normal file
0
scripts/.gitkeep
Normal file
0
scripts/autoloads/.gitkeep
Normal file
0
scripts/autoloads/.gitkeep
Normal file
7
scripts/autoloads/dialogue_system.gd
Normal file
7
scripts/autoloads/dialogue_system.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
## Daten-getriebenes Dialog-System (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Spielt ab Phase 2 verzweigte Dialogbäume aus data/dialogue ab.
|
||||
## Entscheidungen tragen Klinge/Herz-Tags und wirken auf den Ton-Wert, auf
|
||||
## Beziehungswerte und auf Story-Flags. Die Dialog-UI ist fokus-navigierbar
|
||||
## (D-Pad/Stick). Phase 0: leeres Skelett ohne Logik.
|
||||
10
scripts/autoloads/dragon_bond_system.gd
Normal file
10
scripts/autoloads/dragon_bond_system.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Node
|
||||
## Drachen-Bindung beim Dreschen (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Würfelt ab Phase 5 die Drachenart über eine gewichtete Zufalls-Tabelle aus
|
||||
## data/dragons (Farbe + Schwanztyp, selten Schwarz ~5 % und Federschwanz
|
||||
## ~4 %). Der Bindungs-Erfolg kombiniert Basis-Zufall mit einem leichten
|
||||
## Kompatibilitäts-Daumen aus Klinge/Herz, Spielweise und Story-Flags
|
||||
## (Wren-/Maren-Bindung, STORY.md Abschnitt 5, Klimax). Drachen können
|
||||
## ablehnen; bei Permadeath AN kann Scheitern tödlich sein. Phase 0: leeres
|
||||
## Skelett ohne Logik.
|
||||
7
scripts/autoloads/faction_system.gd
Normal file
7
scripts/autoloads/faction_system.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
## Squad-Ansehen und Fraktions-Standing (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Verwaltet ab Phase 4 das Ansehen im Squad sowie das Standing bei der
|
||||
## Fraktion der Gezeichneten, u. a. geprägt durch die Klinge-↔-Herz-Achse
|
||||
## nach Marens Tod (STORY.md Abschnitt 6). Phase 0: leeres Skelett ohne
|
||||
## Logik.
|
||||
7
scripts/autoloads/game_state.gd
Normal file
7
scripts/autoloads/game_state.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
## Zentraler Spielzustand (Autoload, SPEC.md Abschnitt 8).
|
||||
##
|
||||
## Hält ab Phase 1 den Zustand eines Durchlaufs: Spieler-Stats (Kraft,
|
||||
## Schnelligkeit, Verstand), den Klinge-↔-Herz-Ton-Wert (-100..+100), den
|
||||
## verdeckten Menschlichkeits-Messwert, den Permadeath-Toggle (Default AN)
|
||||
## sowie globale Spiel-Flags. Phase 0: leeres Skelett ohne Logik.
|
||||
8
scripts/autoloads/input_prompts.gd
Normal file
8
scripts/autoloads/input_prompts.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Node
|
||||
## Dynamische Button-Prompts (Autoload, SPEC.md Abschnitte 2 und 8).
|
||||
##
|
||||
## Erkennt ab Phase 6 das zuletzt aktive Eingabegerät (Tastatur/Maus, Xbox-
|
||||
## oder PS5-Controller) und liefert UI-weit die passenden Glyphen für
|
||||
## Interaktions- und Menü-Prompts. Die provisorische Geräteerkennung des
|
||||
## Phase-0-Debug-Overlays wandert dann hierher. Phase 0: leeres Skelett ohne
|
||||
## Logik.
|
||||
8
scripts/autoloads/mature_content_gate.gd
Normal file
8
scripts/autoloads/mature_content_gate.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Node
|
||||
## Mature-Content-Gate (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Verwaltet ab Phase 6 das 18+-Gate beim ersten Start, die Content-Warnung
|
||||
## und den Options-Toggle (Default AUS). Schaltet Romantik-Szenen zweigleisig:
|
||||
## Fade-to-Black (Default) oder explizite Textvarianten aus gegateten
|
||||
## Datendateien, die ausschließlich vom Nutzer gepflegt werden. Phase 0:
|
||||
## leeres Skelett ohne Logik.
|
||||
7
scripts/autoloads/relationship_system.gd
Normal file
7
scripts/autoloads/relationship_system.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
## Beziehungswerte pro NPC (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Führt ab Phase 4 pro NPC einen Beziehungswert (-100..+100), der durch
|
||||
## Dialoge und Aktivitäten steigt oder fällt und Reaktionen sowie
|
||||
## Story-Verzweigungen färbt (z. B. Imogen unter Druck, Wren-Bindung).
|
||||
## Phase 0: leeres Skelett ohne Logik.
|
||||
7
scripts/autoloads/save_system.gd
Normal file
7
scripts/autoloads/save_system.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
## Speichern und Laden von Spielständen (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Serialisiert ab Phase 1 den Zustand der übrigen Systeme in Spielstände und
|
||||
## stellt ihn wieder her. Berücksichtigt später den Permadeath-Modus (Ironman)
|
||||
## gegenüber dem Story-Modus mit Checkpoints. Phase 0: leeres Skelett ohne
|
||||
## Logik.
|
||||
6
scripts/autoloads/signet_system.gd
Normal file
6
scripts/autoloads/signet_system.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Node
|
||||
## Signet-Vergabe nach der Bindung (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Vergibt ab Phase 5 nach erfolgreicher Drachen-Bindung eine zufällige
|
||||
## einzigartige Kraft aus der Signet-Tabelle in data/signets und rahmt den
|
||||
## Reveal-Moment. Phase 0: leeres Skelett ohne Logik.
|
||||
8
scripts/autoloads/story_system.gd
Normal file
8
scripts/autoloads/story_system.gd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
extends Node
|
||||
## Story-Beats und Story-Flags (Autoload, SPEC.md Abschnitt 8).
|
||||
##
|
||||
## Steuert ab Phase 3 den Fortschritt entlang der v1-Akt-Struktur (STORY.md
|
||||
## Abschnitt 5): Viadukt, die Tage, Gauntlet, Trauer und Entschluss,
|
||||
## Dreschen, Teaser. Beats und Flags liegen daten-getrieben in data/story;
|
||||
## erfundene Handlung über STORY.md hinaus ist ausgeschlossen. Phase 0:
|
||||
## leeres Skelett ohne Logik.
|
||||
6
scripts/autoloads/time_system.gd
Normal file
6
scripts/autoloads/time_system.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Node
|
||||
## Tageszyklus (Autoload, SPEC.md Abschnitte 6 und 8).
|
||||
##
|
||||
## Verwaltet ab Phase 1 die Tages-Slots Vormittag/Nachmittag/Abend über die
|
||||
## 3-4 spielbaren Tage des v1-Loops; der Schlafsaal beendet den Tag.
|
||||
## Phase 0: leeres Skelett ohne Logik.
|
||||
0
scripts/gameplay/.gitkeep
Normal file
0
scripts/gameplay/.gitkeep
Normal file
130
scripts/gameplay/player.gd
Normal file
130
scripts/gameplay/player.gd
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
extends CharacterBody3D
|
||||
## Greybox-Spielersteuerung für Phase 0.
|
||||
##
|
||||
## Bewegt die Spieler-Kapsel relativ zur Kamera (WASD + linker Stick),
|
||||
## unterstützt Sprint und steuert die weit rausgezoomte Third-Person-Kamera
|
||||
## im WoW-Stil: Orbit über Maus und rechten Stick, Zoom über Mausrad und
|
||||
## Schultertasten, Kollision über SpringArm3D. Die Actions look_x/look_y
|
||||
## sind in der Input-Map registriert; Mausbewegung ist in Godot nicht auf
|
||||
## Actions mappbar und wird deshalb direkt als InputEventMouseMotion
|
||||
## gelesen, der rechte Stick direkt über die Joypad-Achsen (Deadzone 0.2).
|
||||
|
||||
const WALK_SPEED := 4.0
|
||||
const SPRINT_SPEED := 7.5
|
||||
const STOP_SPEED := 16.0
|
||||
const MESH_TURN_SPEED := 10.0
|
||||
const MOUSE_SENSITIVITY := 0.003
|
||||
const STICK_LOOK_SPEED := 2.5
|
||||
const STICK_DEADZONE := 0.2
|
||||
const PITCH_MIN := -1.2
|
||||
const PITCH_MAX := 0.5
|
||||
const ZOOM_MIN := 2.0
|
||||
const ZOOM_MAX := 14.0
|
||||
const ZOOM_STEP := 0.8
|
||||
const ZOOM_BUTTON_SPEED := 8.0
|
||||
const ZOOM_SMOOTHING := 10.0
|
||||
|
||||
var _target_zoom := 9.0
|
||||
var _gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
|
||||
@onready var _camera_pivot: Node3D = $CameraPivot
|
||||
@onready var _spring_arm: SpringArm3D = $CameraPivot/SpringArm3D
|
||||
@onready var _mesh: MeshInstance3D = $MeshInstance3D
|
||||
|
||||
|
||||
## Fängt den Mauszeiger ein und übernimmt die im Editor gesetzte
|
||||
## SpringArm-Länge als Zoom-Ziel.
|
||||
func _ready() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
_target_zoom = _spring_arm.spring_length
|
||||
|
||||
|
||||
## Verarbeitet Maus-Look, Mausrad-Zoom sowie das Freigeben des Cursors über
|
||||
## cancel und das Wieder-Einfangen per Mausklick.
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
||||
_rotate_camera(-event.relative.x * MOUSE_SENSITIVITY, -event.relative.y * MOUSE_SENSITIVITY)
|
||||
elif event is InputEventMouseButton and event.pressed:
|
||||
if event.is_action("camera_zoom_in"):
|
||||
_target_zoom = clampf(_target_zoom - ZOOM_STEP, ZOOM_MIN, ZOOM_MAX)
|
||||
elif event.is_action("camera_zoom_out"):
|
||||
_target_zoom = clampf(_target_zoom + ZOOM_STEP, ZOOM_MIN, ZOOM_MAX)
|
||||
elif Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
elif event.is_action_pressed("cancel"):
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
|
||||
## Treibt pro Physik-Tick Stick-Look, Schultertasten-Zoom, Zoom-Glättung und
|
||||
## Bewegung an.
|
||||
func _physics_process(delta: float) -> void:
|
||||
_apply_stick_look(delta)
|
||||
_apply_button_zoom(delta)
|
||||
_apply_zoom_smoothing(delta)
|
||||
_apply_movement(delta)
|
||||
|
||||
|
||||
## Liefert die aktuelle Kamera-Distanz in Metern für das Debug-Overlay.
|
||||
func get_camera_zoom() -> float:
|
||||
return _spring_arm.spring_length
|
||||
|
||||
|
||||
## Dreht die Kamera um yaw_delta (horizontal, am Pivot) und pitch_delta
|
||||
## (vertikal, am SpringArm, begrenzt auf PITCH_MIN..PITCH_MAX). Beide Werte
|
||||
## in Radiant.
|
||||
func _rotate_camera(yaw_delta: float, pitch_delta: float) -> void:
|
||||
_camera_pivot.rotation.y = wrapf(_camera_pivot.rotation.y + yaw_delta, -PI, PI)
|
||||
_spring_arm.rotation.x = clampf(_spring_arm.rotation.x + pitch_delta, PITCH_MIN, PITCH_MAX)
|
||||
|
||||
|
||||
## Liest den rechten Stick des ersten aktiven Controllers und dreht die
|
||||
## Kamera zeitbasiert.
|
||||
func _apply_stick_look(delta: float) -> void:
|
||||
var stick := Vector2(
|
||||
_read_joy_axis(JOY_AXIS_RIGHT_X),
|
||||
_read_joy_axis(JOY_AXIS_RIGHT_Y)
|
||||
)
|
||||
if stick != Vector2.ZERO:
|
||||
_rotate_camera(-stick.x * STICK_LOOK_SPEED * delta, -stick.y * STICK_LOOK_SPEED * delta)
|
||||
|
||||
|
||||
## Zoomt kontinuierlich, solange eine Schultertaste gehalten wird.
|
||||
func _apply_button_zoom(delta: float) -> void:
|
||||
var zoom_input := Input.get_action_strength("camera_zoom_out") - Input.get_action_strength("camera_zoom_in")
|
||||
if zoom_input != 0.0:
|
||||
_target_zoom = clampf(_target_zoom + zoom_input * ZOOM_BUTTON_SPEED * delta, ZOOM_MIN, ZOOM_MAX)
|
||||
|
||||
|
||||
## Führt die SpringArm-Länge weich an das Zoom-Ziel heran.
|
||||
func _apply_zoom_smoothing(delta: float) -> void:
|
||||
_spring_arm.spring_length = lerpf(_spring_arm.spring_length, _target_zoom, minf(ZOOM_SMOOTHING * delta, 1.0))
|
||||
|
||||
|
||||
## Wendet Schwerkraft an, bewegt den Spieler kamerarelativ mit Geh- oder
|
||||
## Sprint-Tempo und dreht das Kapsel-Mesh weich in Laufrichtung.
|
||||
func _apply_movement(delta: float) -> void:
|
||||
if not is_on_floor():
|
||||
velocity.y -= _gravity * delta
|
||||
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var direction := _camera_pivot.global_transform.basis * Vector3(input_dir.x, 0.0, input_dir.y)
|
||||
direction.y = 0.0
|
||||
var speed := SPRINT_SPEED if Input.is_action_pressed("sprint") else WALK_SPEED
|
||||
if direction.length_squared() > 0.0:
|
||||
velocity.x = direction.x * speed
|
||||
velocity.z = direction.z * speed
|
||||
var target_yaw := atan2(-direction.x, -direction.z)
|
||||
_mesh.rotation.y = lerp_angle(_mesh.rotation.y, target_yaw, minf(MESH_TURN_SPEED * delta, 1.0))
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0.0, STOP_SPEED * delta)
|
||||
velocity.z = move_toward(velocity.z, 0.0, STOP_SPEED * delta)
|
||||
move_and_slide()
|
||||
|
||||
|
||||
## Liest eine Joypad-Achse über alle verbundenen Controller und liefert den
|
||||
## ersten Wert außerhalb der Deadzone, sonst 0.
|
||||
func _read_joy_axis(axis: JoyAxis) -> float:
|
||||
for device in Input.get_connected_joypads():
|
||||
var value := Input.get_joy_axis(device, axis)
|
||||
if absf(value) > STICK_DEADZONE:
|
||||
return value
|
||||
return 0.0
|
||||
0
scripts/ui/.gitkeep
Normal file
0
scripts/ui/.gitkeep
Normal file
58
scripts/ui/debug_overlay.gd
Normal file
58
scripts/ui/debug_overlay.gd
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
extends CanvasLayer
|
||||
## Debug-Overlay für Phase 0.
|
||||
##
|
||||
## Zeigt FPS, das zuletzt benutzte Eingabegerät (Tastatur/Maus, Xbox- oder
|
||||
## PS5-Controller), die Spielerposition und die aktuelle Kamera-Distanz an.
|
||||
## Die provisorische Geräteerkennung wandert in einer späteren Phase in das
|
||||
## Autoload InputPrompts (dynamische Button-Prompts, SPEC.md Abschnitt 2).
|
||||
|
||||
const JOY_MOTION_THRESHOLD := 0.2
|
||||
const PLAYSTATION_NAME_HINTS: Array[String] = [
|
||||
"ps5", "ps4", "dualsense", "dualshock", "sony", "playstation",
|
||||
]
|
||||
|
||||
@export var player_path: NodePath
|
||||
|
||||
var _active_device := "Tastatur/Maus"
|
||||
var _player: CharacterBody3D
|
||||
|
||||
@onready var _info_label: Label = $InfoLabel
|
||||
|
||||
|
||||
## Löst die Spieler-Referenz aus dem exportierten Pfad auf.
|
||||
func _ready() -> void:
|
||||
_player = get_node_or_null(player_path) as CharacterBody3D
|
||||
|
||||
|
||||
## Merkt sich das zuletzt benutzte Eingabegerät anhand des Event-Typs;
|
||||
## Stick-Rauschen unterhalb der Deadzone wird ignoriert.
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event is InputEventKey or event is InputEventMouseButton or event is InputEventMouseMotion:
|
||||
_active_device = "Tastatur/Maus"
|
||||
elif event is InputEventJoypadButton:
|
||||
_active_device = _describe_joypad(event.device)
|
||||
elif event is InputEventJoypadMotion and absf(event.axis_value) > JOY_MOTION_THRESHOLD:
|
||||
_active_device = _describe_joypad(event.device)
|
||||
|
||||
|
||||
## Baut den Anzeigetext jedes Frame neu auf.
|
||||
func _process(_delta: float) -> void:
|
||||
var lines := PackedStringArray()
|
||||
lines.append("FPS: %d" % Engine.get_frames_per_second())
|
||||
lines.append("Eingabegerät: %s" % _active_device)
|
||||
if is_instance_valid(_player):
|
||||
var pos := _player.global_position
|
||||
lines.append("Position: (%.1f, %.1f, %.1f)" % [pos.x, pos.y, pos.z])
|
||||
if _player.has_method("get_camera_zoom"):
|
||||
lines.append("Kamera-Zoom: %.1f m" % _player.get_camera_zoom())
|
||||
_info_label.text = "\n".join(lines)
|
||||
|
||||
|
||||
## Ordnet einen Controller anhand seines Gerätenamens der PS5- oder
|
||||
## Xbox-Familie zu.
|
||||
func _describe_joypad(device: int) -> String:
|
||||
var joy_name := Input.get_joy_name(device).to_lower()
|
||||
for hint in PLAYSTATION_NAME_HINTS:
|
||||
if joy_name.contains(hint):
|
||||
return "PS5-Controller"
|
||||
return "Xbox-Controller"
|
||||
Loading…
Add table
Add a link
Reference in a new issue