파일과 JSON 이해하기
JSON이란 무엇입니까?
JSON은 구조화된 데이터를 담은 텍스트 파일입니다. 중괄호에는 이름이 있는 속성, 대괄호에는 순서가 있는 목록이 들어갑니다. 문자열은 큰따옴표로 감싸고 숫자와 true/false에는 따옴표를 쓰지 않습니다. ID는 항목들을 연결합니다. 텍스트 편집기로 파일을 살펴볼 수 있지만, 보통은 VNLE에서 이야기를 수정한 뒤 다시 내보냅니다.
편집용 프로젝트와 게임용 내보내기 파일은 용도가 다릅니다. VNLE에서 내용을 수정한 뒤 다시 내보내세요. 아래 예시는 함께 제공된 프로젝트에서 가져왔습니다.
내보내기 폴더
story.json Game data: flow + text + catalogs
assets/files/…png Images used by the game
story-index.json Entry points for starting conversations
export-info.json Export result
project/
project.vnle.json Project name, languages, catalog references
chapters/ Chapter structure
flows/ Scene nodes and entry points
layout/ Node positions in the editor
characters/ Characters and portrait references
variables/ Variable definitions and initial values
commands/ Game actions, inputs and outcomes
items/, quests/, locations/ Resources
localization/ Source texts and translations
assets/ Asset catalog and image files학습용 예제에는 ID를 읽기 쉬운 이름과 연결하는 guide-map.json이 추가되어 있습니다. 이 파일은 예제 전용이며 모든 프로젝트에서 생성되지는 않습니다. 일반 내보내기에서는 story-index.json에서 시작점을, story.json에서 카탈로그를 찾으세요.
대화 시작
시작점은 flowRef와 entryRef로 구성됩니다. 둘 다 표시 이름이 아닌 ID입니다. execution.entries[entryRef].nodeRef가 가리키는 곳에서 실행을 시작합니다. 다음은 예제에서 실제로 사용하는 ID입니다.
{
"flowRef": "1f69a7b6-1bdc-4dff-b8ee-9b2819b35168",
"entryRef": "5e6b2e12-1ac1-4c46-8221-1a051e87370a"
}대화 읽기
{
"continuation": {
"kind": "node",
"nodeRef": "85b3aadf-2b95-4150-bc44-c0c796337874"
},
"flowRef": "1f69a7b6-1bdc-4dff-b8ee-9b2819b35168",
"id": "ffa7141b-97ed-44c1-a346-8bba7e26d94f",
"kind": "dialogue",
"speakerRef": "807b2957-7bab-4a28-83a4-1f3d1589bbc2",
"text": {
"bindings": {},
"textRef": "fd7b61a3-8233-4ba7-8f77-b88b119a91bf"
}
}kind는 노드 종류를 나타냅니다. speakerRef는 content.characters의 캐릭터를, text.textRef는 content.texts의 텍스트를 참조합니다. continuation은 Continue를 눌렀을 때의 동작을 설명합니다.
언어에 맞는 텍스트 가져오기
{
"id": "fd7b61a3-8233-4ba7-8f77-b88b119a91bf",
"category": "dialogue",
"sourceMessage": {
"kind": "segments",
"segments": [
{
"kind": "text",
"text": "Welcome to the harbour. I am Mira."
}
]
},
"placeholders": {},
"externalUse": false
}content.translations[language][text ID].message가 있으면 사용하고, 없으면 sourceMessage를 사용하세요. 텍스트 세그먼트에는 표시할 글이 들어 있으며, 자리표시자 세그먼트는 노드의 바인딩에서 값을 받습니다. 언어는 게임 설정이므로 바꾸어도 진행 상황은 변하지 않습니다.
이름과 초상화 표시하기
{
"id": "807b2957-7bab-4a28-83a4-1f3d1589bbc2",
"name": "Mira",
"key": "character_2fbfc3b256cb4ecf94a89965ef8e4549",
"nameTextRef": "ff2cf3d4-08d3-47d8-b41a-86f1a801e1b7",
"color": "#82d5e6",
"defaultPortraitRef": "eacb484c-0663-4ffd-876d-401664b980db",
"emotions": {}
}nameTextRef도 다른 텍스트처럼 처리하세요. 이미지는 선택한 감정의 초상화 또는 defaultPortraitRef를 사용합니다. content.assets[portrait ID].relativePath에서 파일 경로를 찾고, story.json 옆에 assets를 복사하세요.