Load characters from a local folder, and from a quiz's characters folder #44

Closed
opened 2026-10-09 16:06:02 +02:00 by Sansan · 1 comment
Owner

Load the characters from a folder on this computer instead of from the server or the cache, like a music folder can replace the server's songs. A themed quiz (e.g. a Christmas quiz) can bring its own characters.

Wanted

  • Settings. A "Characters folder" row in Settings, like the music folder row: Choose folder… and Use server.
  • Folder contents. Every picture in the folder (png, jpg, webp) is a character, named by its file name (CharacterCard.display_name).
  • Quizzes with their own characters. When the picked music folder has a characters subfolder, its characters are used automatically while that folder is played.
  • Switching back. Choosing Use server, or another music folder without characters, goes back to the server's characters.

Plan

  • Character source.
    • common/character_cache.gd and popups/character_select_popup.gd load the list and pictures from the server today.
    • Add a source with the same two calls, load_list(on_done) and fetch_image(name, on_done). Read local files with Image.load_from_file, or CharacterCard.image_from_bytes(FileAccess.get_file_as_bytes(...)).
    • Pick the source in load_characters(). A small CharacterSource base with ServerCharacters (the cache) and FolderCharacters, or just a branch in CharacterCache.
  • Settings. Settings.character_folder: String (empty = server). settings_popup.gd gets the new row and reloads the character select when it changes.
  • MusicFolder.
    • MusicFolder.scan() treats any folder with subfolders as a soundtrack folder. A prepared quiz with a characters folder would then be read as one soundtrack called "characters".
    • Skip a subfolder named characters (case-insensitive) in both kinds of folder, and remember it as MusicFolder.characters_path.
  • Players' characters. Keep players' current characters when the source changes, or reset them to the "no character" picture. See the question below.
  • Saved quiz (#11). Works offline: with a local folder nothing is asked from the server.
  • Remembering the folder. The folder could be remembered for the session only, like the music folder, or saved.

Tests

  • MusicFolder.scan on a prepared quiz with characters/ → still a prepared quiz, with characters_path set.
  • The same for a soundtrack folder: characters is not a soundtrack.
  • FolderCharacters.load_list lists only pictures, sorted, without hidden files.
  • Picking a music folder with characters loads them into the character select popup; Use server goes back.

Questions

  • When the characters change, should players keep their picked character or be reset?
  • Remember the characters folder between restarts, or session only like the music folder?
Load the characters from a folder on this computer instead of from the server or the cache, like a music folder can replace the server's songs. A themed quiz (e.g. a Christmas quiz) can bring its own characters. ## Wanted - **Settings.** A "Characters folder" row in Settings, like the music folder row: Choose folder… and Use server. - **Folder contents.** Every picture in the folder (png, jpg, webp) is a character, named by its file name (`CharacterCard.display_name`). - **Quizzes with their own characters.** When the picked music folder has a `characters` subfolder, its characters are used automatically while that folder is played. - **Switching back.** Choosing Use server, or another music folder without characters, goes back to the server's characters. ## Plan - **Character source.** - `common/character_cache.gd` and `popups/character_select_popup.gd` load the list and pictures from the server today. - Add a source with the same two calls, `load_list(on_done)` and `fetch_image(name, on_done)`. Read local files with `Image.load_from_file`, or `CharacterCard.image_from_bytes(FileAccess.get_file_as_bytes(...))`. - Pick the source in `load_characters()`. A small `CharacterSource` base with `ServerCharacters` (the cache) and `FolderCharacters`, or just a branch in `CharacterCache`. - **Settings.** `Settings.character_folder: String` (empty = server). `settings_popup.gd` gets the new row and reloads the character select when it changes. - **MusicFolder.** - `MusicFolder.scan()` treats any folder with subfolders as a soundtrack folder. A prepared quiz with a `characters` folder would then be read as one soundtrack called "characters". - Skip a subfolder named `characters` (case-insensitive) in both kinds of folder, and remember it as `MusicFolder.characters_path`. - **Players' characters.** Keep players' current characters when the source changes, or reset them to the "no character" picture. See the question below. - **Saved quiz (#11).** Works offline: with a local folder nothing is asked from the server. - **Remembering the folder.** The folder could be remembered for the session only, like the music folder, or saved. ## Tests - `MusicFolder.scan` on a prepared quiz with `characters/` → still a prepared quiz, with `characters_path` set. - The same for a soundtrack folder: `characters` is not a soundtrack. - `FolderCharacters.load_list` lists only pictures, sorted, without hidden files. - Picking a music folder with characters loads them into the character select popup; Use server goes back. ## Questions - When the characters change, should players keep their picked character or be reset? - Remember the characters folder between restarts, or session only like the music folder?
Sansan added the feature label 2026-10-09 16:06:02 +02:00
Author
Owner

Done in e4352a9 on develop. A picked characters folder is used for the session only, and players' characters reset when the characters come from somewhere else.

Done in e4352a9 on develop. A picked characters folder is used for the session only, and players' characters reset when the characters come from somewhere else.
Sansan added this to the 2.0.0 milestone 2026-10-09 22:59:47 +02:00
Sign in to join this conversation.