Skip to content

feat(player): instance nesting guard & audio event signal#200

Merged
MasamiYitsuse merged 1 commit into
developfrom
feature/minor-improvements-functions
Jun 22, 2026
Merged

feat(player): instance nesting guard & audio event signal#200
MasamiYitsuse merged 1 commit into
developfrom
feature/minor-improvements-functions

Conversation

@MasamiYitsuse

Copy link
Copy Markdown
Collaborator

概要

プレーヤの細かな改善2点。SSPlayerForUnity との実装比較で見つかった Godot 側のギャップを埋めます。

変更内容

#1 インスタンスのネスト深さガード(堅牢性)

循環参照(A → B → A)や過剰なネストを持つ .ssab を読み込むと、_setup_instance_childrenスタックオーバーフローでクラッシュするまで再帰していました(コードにも "recurse until stack overflow" と明記されていた既知の穴)。

  • 子プレーヤに親 +1 の深さ(_instance_depth)を持たせ、MAX_INSTANCE_DEPTH(16)を超えたら警告を出してスキップするように変更。
  • SSPlayerForUnity の MaxInstanceDepth = 16 と挙動を揃えています。

#3 オーディオイベントの配信(機能追加)

ss_internal_player.cpp// TODO: Audio integration として未実装だったオーディオイベントを実装。

  • 既存の user_data / signal_emitted と同じパターンで、新規 audio シグナルを発行。
  • payload(Dictionary): part_index / sound_list_name_hash / sound_name_hash / sound_name / loop_num
  • 再生自体はプレーヤでは行わず、ゲーム側で AudioStreamPlayer 等へ橋渡しする設計(ドキュメントに明記)。
  • docs/{ja,en}/api/player.md にシグナルと payload を追記。

検証

  • GDExtension のビルド緑(build-extension.ps1)。
  • 目視確認(マスク/インスタンス/オーディオの実挙動)は別途お願いします。

備考

比較検討の過程で挙がった set_animation の設定リセット(#2)と pause の冪等性(#4)は、Godot 側は現状の仕様が正であり対応不要と判断しました(#2/#4 は SSPlayerForUnity 側を Godot に合わせる方針)。

Add a cyclic/runaway-nesting guard for Instance parts: children now carry
parent depth + 1 and `_setup_instance_children` stops descending past
MAX_INSTANCE_DEPTH (16) with a warning, instead of recursing until the
stack overflows on a cyclic (A -> B -> A) .ssab. Mirrors the Unity
player's MaxInstanceDepth.

Implement audio event delivery: fill the `// TODO: Audio integration`
path to emit a new `audio` signal (Dictionary payload: part_index,
sound_list_name_hash, sound_name_hash, sound_name, loop_num), following
the existing user_data/signal_emitted pattern. Playback is left to the
game side. Documents the signal in docs/{ja,en}/api/player.md.
@MasamiYitsuse MasamiYitsuse merged commit fd0d49f into develop Jun 22, 2026
0 of 2 checks passed
@MasamiYitsuse MasamiYitsuse deleted the feature/minor-improvements-functions branch June 22, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant