Skip to content

Blueprint と Scene ​

Blueprint の構造 ​

BlueprintExport は LSDE エディターから出力される JSON ファイルです。engine が必要とするすべてのデータを含んでいます。

ts
interface BlueprintExport {
  format: "lsde-blueprints";       // anything else is refused outright
  version: 1;                      // the FORMAT version, not the editor's
  generator: Generator;            // which software wrote the file
  exportedAt: string;              // ISO 8601
  project: string;
  locales: string[];
  referenceLocale: string;         // the locale written first
  dictionaries: DictionaryDefinition[];
  functions: FunctionDefinition[];
  cards: Card[];                   // what a block's `actors` and `emotion` cite
  scenes: BlueprintScene[];
}
csharp
public class BlueprintExport {
    public string Format { get; set; }              // "lsde-blueprints"
    public int Version { get; set; }                // 1
    public Generator? Generator { get; set; }
    public string ExportedAt { get; set; }
    public string Project { get; set; }
    public List<string> Locales { get; set; }
    public string ReferenceLocale { get; set; }
    public List<DictionaryDefinition> Dictionaries { get; set; }
    public List<FunctionDefinition> Functions { get; set; }
    public List<Card> Cards { get; set; }
    public List<BlueprintScene> Scenes { get; set; }
}
cpp
struct BlueprintExport {
    std::string format;                          // "lsde-blueprints"
    int version = 0;                             // 1
    Generator generator;
    std::string exportedAt;
    std::string project;
    std::vector<std::string> locales;
    std::string referenceLocale;
    std::vector<DictionaryDefinition> dictionaries;
    std::vector<FunctionDefinition> functions;
    std::vector<Card> cards;
    std::vector<BlueprintScene> scenes;
};
gdscript
# Dictionary with keys:
# "format":          String  — always "lsde-blueprints"
# "version":         int     — the FORMAT version, 1
# "generator":       Dictionary
# "exportedAt":      String  — ISO 8601
# "project":         String
# "locales":         Array[String]
# "referenceLocale": String
# "dictionaries":    Array[Dictionary]
# "functions":       Array[Dictionary]
# "cards":           Array[Dictionary]
# "scenes":          Array[Dictionary]

Scene ​

scene は独立した対話シーケンスです — 会話、カットシーン、チュートリアル、ショップのやり取りなど。ゲームでは通常、スクリプトイベントによってトリガーされます:プレイヤーが NPC に話しかける、ゾーンに入る、アイテムを拾うなど。

各 scene は独自のエントリーブロック、独自のフロー、独自の状態を持ちます。複数の scene を並行して実行できます(例:メインダイアログとチュートリアルオーバーレイ)。scene は BlueprintScene インターフェースで定義されます:

ts
interface Scene {
  scene: string;        // the path — reactor_breach. Builds the i18n keys; changes on a rename.
  id: string;           // the stable id — sc_u0vqg2g8. Store THIS outside the payload.
  label?: string;
  start?: string;       // the id of the entry block. The scene names it; blocks carry no flag.
  blocks: Block[];      // wires live on each block, in block.next. There is no connection table.
}
csharp
public class BlueprintScene {
    public string Scene { get; set; }        // the path — reactor_breach
    public string Id { get; set; }           // the stable id — sc_u0vqg2g8
    public string? Label { get; set; }
    public string? Start { get; set; }       // the id of the entry block
    public List<BlueprintBlock> Blocks { get; set; }
}
cpp
struct BlueprintScene {
    std::string scene;                       // the path — reactor_breach
    std::string id;                          // the stable id — sc_u0vqg2g8
    std::optional<std::string> label;
    std::optional<std::string> start;        // the id of the entry block
    std::vector<BlueprintBlock> blocks;
};
gdscript
# Dictionary with keys:
# "scene": String        — the path, reactor_breach
# "id": String           — the stable id, sc_u0vqg2g8
# "label": String (optional)
# "start": String (optional) — the id of the entry block
# "blocks": Array[Dictionary] — wires live on each block, in block["next"]

Connection ​

connection は block 間のワイヤーです — どの block がどの block に繋がるかを定義します。エクスポートに connection テーブルは存在しません:各 block が自身の出力ワイヤーを block.next に持ち、ワイヤーはどの port から出てどこへ向かうかだけを示します。

ワイヤーが scene の境界を越えたことは、この形式のどのバージョンでも一度もありません:to は常に同じ scene の block を指します。

BlueprintConnection はそれらのワイヤーをフラット化したビューで、engine.getSceneConnections(sceneRef) が返すものです — 出発元の block を付け直したワイヤーです:

ts
// A Link, plus the block it leaves. `Link` is what the payload carries, on block.next.
type BlueprintConnection = Link & { from: string };

interface Link {
  port: string;    // the exit port NAME: out, then, catch, default, C1, K1, or a card id
  to: string;      // the id of the target block, IN THE SAME SCENE
  toPort: string;  // always "in"
}
csharp
public class BlueprintConnection {
    public string From { get; set; }    // the id of the block this wire leaves
    public string Port { get; set; }    // the exit port NAME
    public string To { get; set; }      // the id of the target block, in the same scene
    public string ToPort { get; set; }  // always "in"
}
cpp
struct BlueprintConnection {
    std::string from;             // the id of the block this wire leaves
    std::string port;             // the exit port NAME
    std::string to;               // the id of the target block, in the same scene
    std::string toPort = "in";
};
gdscript
# Dictionary with keys:
# "from": String    — the id of the block this wire leaves
# "port": String    — the exit port NAME: out, then, catch, default, C1, K1, or a card id
# "to": String      — the id of the target block, in the same scene
# "toPort": String  — always "in"

通常、これらを検査する必要はありません — engine が内部でルーティングを処理します。engine.getSceneConnections(sceneRef) はグラフ検査のために公開されています:scene を再生せずに配線を見るデバッグビューです。

Dictionary ​

dictionary はゲームのレジスタを記述します — スイッチ、変数、インベントリなど。開発者が LSDE エディターで宣言し、ナラティブデザイナーにゲーム内で利用可能な変数を公開します。ランタイムでは、開発者が各 dictionary をゲームの対応するシステムにマッピングします。condition と onResolveCondition がこれらのキーを使ってゲーム状態を評価します。DictionaryDefinition インターフェースで定義されます:

ts
interface DictionaryDefinition {
  id: string;                                  // what a ConditionTest.dict cites
  valueType: 'boolean' | 'number' | 'string';  // what its entries hold
  entries: string[];                           // the entry names, flat
}
csharp
public class DictionaryDefinition {
    public string Id { get; set; }
    public string ValueType { get; set; }      // "boolean" | "number" | "string"
    public List<string> Entries { get; set; }
}
cpp
struct DictionaryDefinition {
    std::string id;
    std::string valueType;                     // "boolean" | "number" | "string"
    std::vector<std::string> entries;
};
gdscript
# Dictionary with keys:
# "id": String
# "valueType": "boolean" | "number" | "string"
# "entries": Array[String]

Function ​

function はゲームが実行できる処理を記述します — set_flag、play_sound、give_item。開発者が LSDE エディターで宣言し、ナラティブデザイナーが型付きパラメーターでシーケンスを構成できるようにします。ランタイムでは、function の id を開発者が自分のシステムにマッピングします:ACTION block が call.fn でそれを参照し、引数は call.args に名前で渡されます。FunctionDefinition インターフェースで定義されます:

ts
interface FunctionDefinition {
  id: string;                  // what an ActionCall.fn names
  params: FunctionParameter[];
}

interface FunctionParameter {
  name: string;                // ActionCall.args is keyed BY NAME, never by position
  type: ValueType;             // 'boolean' | 'number' | 'string' | 'dictionaryKey'
  dictionary?: string;         // for type 'dictionaryKey': the DictionaryDefinition.id it draws from
}
csharp
public class FunctionDefinition {
    public string Id { get; set; }
    public List<FunctionParameter> Params { get; set; }
}

public class FunctionParameter {
    public string Name { get; set; }
    public string Type { get; set; }
    public string? Dictionary { get; set; }
}
cpp
struct FunctionDefinition {
    std::string id;
    std::vector<FunctionParameter> params;
};

struct FunctionParameter {
    std::string name;
    std::string type;
    std::optional<std::string> dictionary;
};
gdscript
# FunctionDefinition Dictionary:
# "id": String
# "params": Array[FunctionParameter]
#
# FunctionParameter Dictionary:
# "name": String   — args are keyed BY NAME, never by position
# "type": "boolean" | "number" | "string" | "dictionaryKey"
# "dictionary": String (optional) — for type "dictionaryKey", the DictionaryDefinition id