LiminaliaLiminalia
Technical docs: How Studio works: Characters and assets

Characters and assets

Open in Claude (new tab)

Characters is the standard screen for characters (cast in cast.json and the names in dialogue). Switch between “Settings,” “Lines” and “Position” to the right of the heading. “Change history” to their right compares the change history of cast.json (the content before each rewrite; 20 entries in .liminalia/backups/cast-<date-time>.json) with the current content line by line, in the same panel as the script’s change history (GET /cast/backups). “Restore this content” saves the characters and speakers at that point through the same API as normal saving (POST /__liminalia/api/cast of the position adjustment screen), so the content before restoring is also kept in the change history, and in projects made by importing, it is also written back to the import source. “Settings” shows the list of characters on the left (cast in cast.json, with the face, name, number of lines of dialogue and number of script lines; sort by most appearances, fewest appearances, name A–Z or name Z–A, and the choice is remembered), and on the right a large panel for the selected character (on a background in the character’s color: the sprite, character ID, display name, name color, the look of the dialogue text, default sprite set, notes and the list of expressions). “Add a character” below the list takes the display name (the name shown in the game as the speaker) and the character ID (the name used by @chara in scripts and for the sprite folder). If the ID is left empty, it is made from the display name (kana and letters become romaji, the same as project IDs, so “アカリ” becomes akari; a name that can’t be romanized, such as kanji, is used as is; _2 is added if it is taken; model/cast-id.ts). If the display name and the ID differ, speaker is written for that character in cast.json. “Notes” holds background, voice actor and so on. It is saved in castNotes in .liminalia/shared.json, not in cast.json or the game data (it saves when you leave the field, and moves along when the character ID is renamed). “Base variant” above the list of expressions chooses the variant used when none is given (defaultVariant of the sprite set) (when there are two or more variants). Each variant in the list of expressions shows the number of script lines that specify it (parameters of the variant type, such as @chara; a line that omits the sprite set counts for the default sprite set if that set has the variant; variants in GET /cast/usage). Variants other than the base variant that are never specified are shown as “Unused” with a faded image, and their count appears next to the heading (the base variant appears without being specified, so it isn’t called unused even at 0). “Face position” decides which part of the sprite is cropped for the faces shown in the scene list, the script, the flowchart and so on (drag to move it, and change the size with the wheel or the slider; it is saved in faces in .liminalia/shared.json, not in cast.json). Changing the character ID or the display name also rewrites the references in the script (parameters of the character type, the names at the start of dialogue lines) (the script’s change history is kept). When you change the ID of a character whose display name is the same as the ID, Studio asks whether to change the display name too (“Change both” or “ID only”). For the character ID, the face crop (faces), the notes (castNotes) and the system voice assignment (character in ui.systemVoice) move along too; for the display name (speaker), the speaker names in translations (speakers in lang/<language>.json) and voice-lock.json (its keys are made from the speaker and the original text, so the numbers are moved to the new keys of the same lines) move along too. Drop an image onto the list of variants to add a variant, positioned and sized by comparing its non-transparent area with that of the base variant (normal, default, or the first one) (the image is placed in the same folder of fgimage/ as that character’s images). “From assets” makes variants from images already in fgimage/, positioned and sized the same way (the images aren’t copied; images in that character’s folder come first, then images not used anywhere, and images used by other variants show that character; variant-pick.ts). In the desktop app, “Add variant” opens the file dialog in that character’s image folder (or where you last chose sprites in this project). Changes on this screen (adding, variants, colors, names and so on) are undone with ⌘Z and redone with ⇧⌘Z (added images too; see “Undo on screens” below). Select a variant to replace the image, rename it, set the overlay images for lip sync and blinking, delete it, or use “Adjust position.” The name color applies to the name box in the game (including names in NVL). The dialogue text color, the text font, italic dialogue, the name box image and the message window image apply only to that character’s dialogue (text, nameImage and windowImage in cast.json). “Sprite motion” chooses how that character’s sprite is drawn (model of the character in cast.json): None, Sway (sway), Live2D or Spine. For Live2D and Spine, “Model file” chooses a .model3.json (Live2D) or a .skel or .json (Spine) in fgimage/. If that plugin isn’t installed, or there is no model file in fgimage/, the choice is put back without writing cast.json, and Studio suggests installing the plugin or adding the file to the assets (live2d-spine.md). Selecting a variant of a Live2D or Spine character shows a “Sprite motion” panel for choosing that variant’s expression and motion (Live2D), or animation, skin and loop (Spine) (model of the variant in cast.json). The choices are the names read from the model file (Expressions and the Motions groups of .model3.json, plus “group:number” for groups with two or more motions; animations and skins of a Spine skeleton .json). “Same name as the variant” writes nothing for that field, and “None” writes "". When only type is left, the variant’s model is removed. For a .skel, whose names can’t be read, you type the names. “Layered sprite” in the variant actions opens a dialog for editing the layered sprite of the selected sprite set (layers of the sprite set in cast.json and parts of the variants; the shapes and rules are in cast.ts of @liminalia/lang) (parts-editor.ts; the operations are in model/parts.ts). On the left are the layers (listed with the front one at the top; add with ”+,” reorder by dragging rows, or move with “Bring forward” and “Send backward”), the images of the selected layer (put in fgimage/<character-folder>/<sprite-set>/<layer>/ with “Add images” or by dropping; listed as small images cropped to their non-transparent area), the default image, rename and delete; in the middle, a preview of the selected variant with its layers stacked; on the right, the list of variants and the image per layer for the selected variant (“Default (…)” uses the layer’s default without writing it in parts, and “None” hides that layer). Clicking an image thumbnail also sets that layer’s image for the selected variant. ”+” on the variants makes a new variant that copies the parts, position and size of the selected variant (or starts from empty parts if a single-image variant is selected). Every operation saves to cast.json right away. Removing an image from a layer keeps the image file. Dropping a PSD onto the list of variants (PSD import) also produces these layers and variants. Layered sprite variants are drawn with their layers stacked in the sprite, the list of variants and the face position too. “Position” embeds the sprite position adjustment screen (the dev server’s /__liminalia/cast with ?embed=1; in the phone app, the Service Worker serves it) as it is. It edits and saves the positions and sizes of sprites in cast.json. When the tab opens, it selects the sprite shown at the script’s cursor line (the frontmost one). Unsaved changes on the position screen are saved before the window closes, on ⌘S, before “Refresh” and when you go back to “Settings.” Both kinds of writes go through the same API as the position adjustment screen, so the content before the change is kept in .liminalia/backups/, and in projects made by importing, it is written back to the import source. “Project → Adjust Sprite Positions” in the desktop app’s menu also opens this tab. “Lines” lists the dialogue of the character selected in the list on the left, in file name order and line order (speaker-lines.ts; the names in dialogue are looked up the same way as for the dialogue count in the list). Filter with the text in the field at the top (words separated by spaces must all be present; it ignores the difference between katakana and hiragana and between upper and lower case), and click a line to go to that line in the script.

Assets is the standard screen that lists the contents of the asset folders (backgrounds, sprites, images, BGM, sound effects, voices, videos, and any asset folders the project added). Choose a kind on the left and browse its folders in the middle (typing in the search field searches everything of that kind). Click an asset to show on the right a preview and the size of the image, sound or video, and where it is used (script lines, characters, project settings); click a line to go to that script, or a character to go to the Characters tab. Renaming an asset (”/” moves it into a folder) also rewrites the script lines and character sprites that refer to it, the asset references in ui, extra and items of liminalia.json, and the head marks (heads in .liminalia/shared.json, for sprites) (whether a setting is a reference is decided by whether uiAssetReferences and similar functions list it as an asset of that kind, so colors and text with the same characters aren’t changed; references that couldn’t be rewritten are reported). “Move to trash” moves the asset to .liminalia/trash/, and it can be undone right there. Drop files or click “Add files” to add them to the open folder (in the desktop app, the file dialog opens in the open folder, or where you last chose that kind of asset in this project; remembered in asset-pick.json in the app’s userData). Renaming, moving to trash and adding are undone with ⌘Z (the rewritten references and an overwritten file come back too; see “Undo on screens” below). “Use as a character sprite” on a sprite image chooses a character and sprite set and makes the image a variant (the same as “From assets” on the Characters screen). The assets folder can also be outside the project with paths.assets in liminalia.json ("../shared-assets", another disk, or the absolute path of a shared folder), and the assets folder itself or folders inside it can be symbolic links to outside places (the dev server adds the assets folder and the targets of the links inside it to the places it may serve, so assets that a plugin’s CSS url() or import points to can be read too. No other places are added; packages/web/dev-allow.ts). Use it to share large assets in an outside place instead of Git. The list, previews, adding, renaming, the check and exports use the outside folder as it is, and moving to the trash (the project’s .liminalia/trash/) and restoring copy and then delete the original when it’s on another disk (moveAcross). The phone app can’t read an outside folder, so it says so. “Add sample assets” in the ”…” menu copies the assets of the lim new template (CC0 1.0: backgrounds, sprites, BGM and sound effects) (files with the same name aren’t copied; a note about the assets, “素材について.txt,” is placed too, or the English sample’s SAMPLE-ASSETS.txt in a project whose source language is English; server/samples.ts; the phone app doesn’t have the template’s files, so it isn’t shown). “Make placeholder assets” makes, on the screen, a plain background (the size of the game screen) and a person-shaped sprite (90% of the screen height) as PNG files and adds them (placeholder-assets.ts; placeholder-bg.png and placeholder-person.png, numbered if they already exist). Kinds with no assets show the same two buttons below the empty-state text. “Export the asset request list” writes the assets, sprite variants and unrecorded voices that the script and characters use but that don’t exist, with the line where each is first used (from the “New game” file, in line order), that line’s text and the number of uses, to exports/asset-requests.csv (with a BOM so it opens in Excel) (server/asset-requests.ts). The desktop app opens the folder, and a browser shows a download (GET /assets/requests.csv). For missing images, the dev server returns to the player a tag with the asset’s name written on it (SVG; the size of the screen for backgrounds, person-shaped for sprites), so the preview and test play don’t stop (server/missing-placeholder.ts; it isn’t returned for Studio’s own thumbnails). Exporting (lim build) still stops with an error for missing assets, as before. “Unused only” and “Heavy only” above the list filter from all the folders of that kind (the counts of the kinds on the left become the matching counts; pressing both shows assets that match both). Unused assets are judged by /assets/usage (commands in the script and inside the text, the numbered files of @voice-auto, characters, project settings). An asset not found that way is treated as possibly in use and not counted as unused if its file name (with or without the extension) appears as a word in the text of any script, liminalia.json, cast.json, themes/*/theme.json or the .json files in paths.data; its usage shows “Text match” (macro parameters, strings in variables, strings in conditions, themes, build.winIcon and so on). Only assets whose names are assembled inside plugin code can’t be detected, so instead of a firm verdict it says “The name doesn’t appear in scenarios, characters, settings, themes, or data.” What counts as heavy is set by the constants in model/assets.ts: images over 5MB, or with a side more than 3 times that of the game screen (the dev server reads the size from the start of the file; for files it can’t read, and in the phone app, only the bytes are considered), BGM over 30MB, and sound effects over 5MB. Voices and videos aren’t checked. While filtered, you can select several with the tile checkboxes and “Select all,” check the count and total size, and then move them to the trash (they go in under one id, so a single “Undo” brings them all back, however many there are). Check shows “N heavy assets” as information when there are heavy assets; click it to go to the Assets screen filtered to heavy ones (it doesn’t count toward the number of problems or the result of lim check).

Select a BGM track to show its waveform, playback and playback position, and markers for the start and end of the loop in the right panel (waveform.ts; the logic is in model/bgm-loop.ts; the audio is decoded with Web Audio, drawn on a canvas, and played with an AudioBufferSourceNode loop, the same as in the game). Click the waveform to move the playback position. Besides dragging, the markers can be set with the arrow keys (10ms; 100ms with Shift) and the seconds fields. “Listen to the loop seam” plays from 3 seconds before the end, goes back to the start of the loop, plays 3 seconds and stops. The markers start at the position written on the first line in the script, or else the LOOPSTART and LOOPLENGTH embedded in the OGG (readLoopTags in @liminalia/lang, the same as the player uses), or else the beginning and the end. The @bgm lines that use the track are listed (leaving out lines with loop=false and lines that choose the track with an expression), and you are told if the values differ from line to line. “Save to scenario” shows the lines to be rewritten with the lines around them, then rewrites loop-start and loop-end through the write API (removing the parameter if it is the same position as when omitted). The audio file isn’t changed. Press ⌘Z on the Assets screen to undo this save (⇧⌘Z redoes it; see “Undo on screens” below).

Add assets just by dropping them: wherever you drop files in Studio (a cover appears over the whole screen while dragging), a screen to confirm the kind (import-dialog.ts) opens and lists each file with the kind it is guessed to be. The guess is guessKind in model/asset-kind.ts.

FileGuess
ImageA sprite if it has transparent areas and is taller than wide, a background if it has the same aspect ratio as the project’s screen, otherwise an image
SoundWhatever its name contains, such as bgm, music, voice, se or sfx. Otherwise BGM if 30 seconds or longer, a voice if the name is numbered (yui_001.ogg), otherwise a sound effect
Video, subtitles (.vtt)Video
FontOther

The kind can be changed row by row (only folders that can hold that file are offered), and “Don’t add” can be chosen too. Files that can’t be assets are listed with the reason and aren’t added (for PSD and PSB files, you are told to drop them onto the list of variants on the Characters tab). “Add” saves each file directly under the folder of its kind (if the name exists, it asks before overwriting). Files taken as sprites are registered together into the default sprite set of the chosen character (if a character’s name matches the start of the file name, it is preselected; if not, enter an ID with “New character”), with the same positioning, sizing and variant naming as dropping on the Characters tab (both use prepareVariants in asset-import.ts). A newly made character is also added as a speaker, and for its first variants, the first variant becomes defaultVariant. When you drop onto a panel that takes drops itself, such as the Assets tab, the list of variants on the Characters tab, or the import text field, that panel takes them. When you drop onto the script panel, asset files are taken by this screen, and text files are left to the editor as before.