How empty-zzj/hoilai-galgame-framework works
Project type and purpose
• HOILAI Galgame Framework (HGF) is an open-source Unity framework for building “Galgame” (visual novel) style games.
• It provides both runtime modules (scene management, UI, text parser, choice logic, animations) and editor extensions (custom attributes, property drawers) to accelerate development.
File structure
• Top-level “HOILAI_Galgame_Framework” folder is a Unity project:
• Assets/HGF/Scripts — core runtime code (GalManager_*, GameAPI, start logic)
• Assets/HGF/Tetra Attributes — editor-only code (custom attributes & drawers)
• Assets/Resources/HGF — data files (XML story, JSON char metadata, prefabs, audio, images)
• Assets/Plugins/Demigiant — third-party tweening libraries (DOTween, DemiLib)
• Assets/Scenes — sample Unity scene that bootstraps HGF
• ProjectSettings and Packages specify Unity settings and package dependencies.
README for additional insights
• HGF emphasizes pure-text story scripts (XML), hot-reloadable assets, nested branching, character & background animations.
• Version 2.0 updated character loading logic and bug fixes.
a. Main components
• Unity Engine (core runtime, scene update loop)
• HGF Runtime Modules
– HGFStartter / HGFStartModel: bootstraps framework in a Scene
– GameAPI: facade for external code to interact with HGF
– GalManager_*: sub-modules handling background, characters (image, animation, dialogue), text, choices
– Utility scripts: BGScaler, ZoomImage, StringInList
• Resource Manager
– XML/JSON parser loads plot and character data from Assets/Resources/HGF
– Prefab loader (Buttons, Character images)
– Audio loader (mp3 files)
• DOTween / DemiLib (Plugins)
– Provides tweening engine used by GalManager_CharacterAnimate, text fade, UI animations
• Editor Extensions (Tetra Attributes)
– Custom attributes & property drawers enhancing Unity Inspector for HGF components
• Sample Scene (Assets/Scenes/Demo.unity / SampleScene.unity)
– Contains HGFStartter component, references to scripts & resources
b. Relationships and interactions
• On Scene load → HGFStartter invokes HGFStartModel → GameAPI initializes GalManager modules
• GalManager modules request data from Resource Manager → XML/JSON → instantiate prefabs (images, buttons)
• UI modules use DOTween to animate transitions (fade, slide, shake)
• Editor Extensions do not run at runtime; they hook into Unity Editor to render custom inspectors for HGF components
c. Architectural patterns & design principles
• Modular design: each concern (text, choice, character, background) is in its own GalManager_* class
• Facade pattern: GameAPI unifies access to multiple subsystems
• Data-driven: story & character data externalized as XML/JSON, supporting hot-reload
• Dependency injection by Unity’s component model: managers attach to GameObjects in Scene
d. Key technologies, frameworks, libraries
• Unity 2021+ (URP settings in Assets/Settings)
• DOTween / DOTweenPro for animations
• TetraCreations.Attributes for custom editor attributes
Detail and essential elements
• Both runtime and editor phases.
• Do not overthink: more granularity gives a clearer view of responsibilities and dependencies.