Skip to content

Archived on 2026-10-24. The Godot rewrite is cancelled. Migration decisions and work checklists below are withdrawn. Original claims, code examples, file paths, and completion statements have not all been revalidated. Use the current documentation and issue register for maintenance decisions.

Audio And Feedback Analysis

Purpose

This system covers music, sound effects, footstep audio, UI sounds, damage popups, hit flashes, announcements, particles, and tweened UI feedback.

Current Unity Implementation

Main scripts:

Path Script Role
Assets/Script/TinyChaos/Services/Audio/AudioService.cs AudioService Runtime audio service with music/effect/footstep sources.
Assets/Script/Game/Resources/AudioResources.cs AudioResources Singleton MonoBehaviour holding AudioClip references.
Assets/Script/Game/Resources/AbilityResources.cs AbilityResources Singleton holding shared ability/effect prefabs.
Assets/Script/Game/Resources/UIResourceProvider.cs UIResourceProvider Static loader for UI colors/icons/materials/damage popup.
Assets/Script/Shared/ScriptableObjects/UIResourcesConfig.cs UIResourcesConfig UI colors, rarity icons, gradients, damage popup prefab, damaged material.
Assets/Script/Game/Stage/DamagePopUp.cs DamagePopUp Floating damage text animation.
Assets/Script/Game/Utilities/Announcer.cs Announcer Special/miniboss/bonus announcements.
Assets/Script/Shared/Entity.cs Entity Damage blink and damaged material handling.
Assets/Script/Game/Managers/GameManager.cs GameManager Damage popup cap, reward particles, game-over audio stopping.

Key Data

AudioService:

  • Hidden root object [AudioService].
  • One looping music source.
  • One effect source.
  • Four looping footstep sources.
  • lastPlayedTime dictionary to prevent sound stacking.
  • Save volume writes through Save.

AudioResources:

  • BGM clips.
  • Reward/card/game-over clips.
  • Potion clips.
  • Ability clips.
  • Button/UI clips.
  • Tutorial, creep, miniboss, boss clips.

UIResourcesConfig:

  • Rarity icons/colors.
  • Unlock/locked colors.
  • Rainbow/star/Neo Sword gradients.
  • Damage popup prefab.
  • Damaged material.
  • Difficulty icons.

Runtime Flow

  1. ServicesRoot.InitializeServices() creates AudioService.
  2. AudioResources persists as a singleton and provides clip references.
  3. Systems call:
  4. Game.Audio.PlayMusic(clip)
  5. Game.Audio.PlaySound(clip, stackingDelay)
  6. Game.Audio.PlaySoundOnPause(clip)
  7. footstep assign/stop/volume methods.
  8. AudioService.PlaySound() suppresses repeated clips within a stacking delay using Time.time.
  9. Damage feedback:
  10. Enemy.TakeDamage() pulls a DamagePopUp from pool if damage indicators are enabled.
  11. DamagePopUp.DamageText() colors text by damage type and runs DOTween animation.
  12. GameManager.HardLimitPopUpDamage() caps active popups using Save.DamageIndicatorLimit.
  13. Entity feedback:
  14. Entity.BlinkOnDamage() swaps damaged material briefly.
  15. Player/enemy scripts spawn blood/particle effects.
  16. Reward/UI feedback uses DOTween for cards, bars, gates, panels, and chest displays.

Dependencies

  • AudioService depends on Save for volume persistence.
  • Gameplay scripts depend on AudioResources.Instance.
  • Feedback spawning depends on PoolManager.
  • UI feedback depends heavily on DOTween.
  • UIResourceProvider uses Resources.Load<UIResourcesConfig>("UIResources").

Problems / Risks

  • Audio clip references are globally accessed through a singleton resource holder.
  • AudioService.ApplyVolumeFirstTime() initially sets all volumes and AudioListener.volume to 0; later settings must reapply them. If settings load fails, audio may stay muted.
  • PlaySoundOnPause() sets effectSource.clip and Play(), not PlayOneShot, so rapid paused UI sounds can interrupt each other.
  • Damage popup throttling happens after popup spawn.
  • DOTween calls are spread through gameplay managers and UI code.
  • Feedback code is embedded in damage/gameplay scripts instead of routed through a feedback layer.

Migration Notes for Godot

Preserve:

  • Audio categories: music, sfx, footstep.
  • Volume settings and save behavior.
  • Anti-stacking behavior for repeated sound clips.
  • Damage type colors: normal, crit, magic, supercrit, poison.
  • Damage popup cap setting.
  • Reward/game-over/announcement feedback timing where player-facing.

Redesign:

AudioService
- autoload
- named buses: Master, Music, SFX, Footstep
- play_sfx(id, cooldown_key = id)
- play_music(id)

FeedbackService
- damage popups
- hit flash requests
- announcements
- screen/UI effects

ResourceCatalog
- maps ids to audio/visual resources

Do not copy:

  • Audio singleton object with hidden Unity AudioSources.
  • Direct clip references scattered through gameplay scripts.
  • Popup cap after spawn; enforce before or within popup pool.

Open Questions

  • Which Unity audio mixer/bus settings exist outside the inspected scripts?
  • Whether all audio clips should be referenced by ids in Godot resources.
  • Whether damage popup limit should be global or per-player/per-screen.
  • Unknown / needs manual confirmation.