{{indexmenu_n>3}} ====== JSON Structure ====== ====== Game ====== Globally, the game JSON consists of several large sections: { "game": {} /* Game settings, such as start time and passage sequence */, "gbonuses": [] /* List of global bonuses in the game */, "lines": [] /* List of passage lines */, "tasks": [] /* List of game levels */, "translations": {} /* The game's translations, by language. Only for a multilingual game */, } ===== Game Settings ===== { "game": { "type": "1", /* Winner is determined by: "0": Points "1": Time */ "stat": "5", /* Statistics: "0": Open "1": Open without bonuses "2": Closed during the game "4": Summary only "5": Closed always "6": Completed tasks */ "team_limit": 0, /* Limit of players in the team */ "name": "#New Unnamed Game", /* Name */ "description": "", /* Description */ "finish_text": "", /* Finish text */ "html_header": "", /* Common HTML header */ "image": "", /* Image */ "start_time": "2021-10-17 12:00:00", /* Start */ "end_time": "2022-10-17 12:00:00", /* Finish */ "status": "3", /* Roster entry: "0": Automatically all "1": Automatically paid "2": Automatically all as testers "3": Manually */ "start_type": "0", /* Game start: "0": Simultaneous "1": Individual start time */ "price": 0, /* Price */ "currency": "UAH", /* Currency of price: "UAH" "USD" "EUR" "RUB" */ "kind": "0", /* Game type: "0": other "1": green "2": yellow "3": red "4": virtual */ "scenario": "0", /* Scenario: "0": Closed "1": Open in archive "2": Open in archive, but only to those who played "3": Open to teams that finished the game */ "answer_prefix": "ff", /* Code prefix */ "default_line": "", /* Default line (name) */ "lang": "ru", /* Game language - the language every text is written in. Empty when localization is off */ "langs": "{\"en\":null,\"uk\":null,\"*\":\"en\"}" /* Translation languages: a string holding the JSON map "translation language" -> "language it falls back to" (null - to the game language). The "*" key is where every other language is sent. See en:authors_main:game_management:localization */ } } ===== Global Bonuses ===== { "gbonuses": [ /* List of global bonuses in the game. Multiple items can be separated by commas */ { "code": "cc, dd", /* Answers */ "time": 0, /* Bonus time for completion */ "description": "", /* Task details */ "hint": "", /* Text after solution */ "first_task_n": 1, /* Available from task */ "last_task_n": 2 /* Available up to task */ } ] } ===== Lines ===== { "lines": [ /* List of lines in the game. Multiple items can be separated by commas */ { "title": "Line 2", /* Line name */ "task_order": "1,2,3+4,5-7" /* Order */ } ] } ===== Translations ===== The section only appears for a game that has translations, and comes back on import. The key is a language code (two letters) or ''"*"'' — the pseudo-language holding the "do not translate anywhere" marks. { "translations": { "en": [ { "src": "The string from the game, as it is in the text", /* The original, and the key as well: a translation is matched by the text, not by a task or field id */ "dst": "The string as the player sees it" /* The translation. Empty means there is none */ }, { "src": "Nokia", "dst": "", "skip": true /* Do not translate this string in this language */ } ], "*": [ { "src": "Nokia", "dst": "", "skip": true } /* Do not translate anywhere: a mark for every language at once */ ] } } Inside ''src'' and ''dst'' there may be placeholders ''⟦N⟧'' and ''⟦/N⟧'' — standing for markup, links and images — and substitutions such as ''!username!''. A translation that does not preserve them is refused by the import as a whole. What these strings are, where they come from and how to translate them: [[en:authors_main:game_management:localization|Multilingual Game]] and [[en:authors_main:game_management:localization_ai|Translating a Game with AI]]. The ''translations'' section replaces the dictionaries of the listed languages entirely. For a partial edit there is ''translations_edit'': a list of ''{"lang": "en", "src": "...", "dst": "..."}'' entries, where ''"delete": 1'' or an empty ''dst'' removes the pair. The two sections cannot be used in one import. ===== Level ===== A level in the game also has a composite structure: An [[en:authors_main:admin_api:admin_json_export#export_with_identifiers|export with ids=1]] adds one more field to the ''task'' section: ''id'', the identifier the level can be addressed by when [[en:authors_main:admin_api:admin_api_import_game#editing_single_items|editing single items]]. Codes, bonuses and hints then get ''id'' and ''number'' too. { "task": {}, /* Level settings, such as name or auto-transition time */ "codes": [], /* List of sectors or codes in the level. Multiple items can be separated by commas */ "bonuses": [], /* List of bonuses in the level */ "hints": [], /* List of hints in the level */ } ==== Level Settings ==== { "task": { "number": 1, /* № */ "max_time": 3600, /* Auto-transition (seconds) */ "score": 10, /* Penalty/Score for no auto-transition */ "time_k": 1.0, /* Time multiplier x */ "delay": 0, /* Delay (for storm levels) */ "working_name": "Title", /* Name in the game */ "name": "In statistics", /* Name in statistics */ "surrender_code": "GiveUp", /* Skip Code */ "task": "Test", /* Task text */ "script": "alert(1)", /* Task script */ "answer": "Word in English", /* Answer format */ "answers_limit": 10, /* Input limit */ "answers_per_time": 60, /* per time interval */ "answers_limit_penalty": 10, /* penalty for each extra try */ "codes": 0, /* Codes needed for completion */ "code_bonus_time": 0, /* Auto-transition reduction (seconds) */ "code_bonus": 0, /* Bonus (in seconds) */ "finish_confirmation": "1", /* Close task: "0": Forcefully "1": Reasonably */ "hidden_bonuses": "0", /* Bonuses: Display in task: "0": List format "1": Compact in one line */ "bonuses_kind": "0" /* Bonuses: Open order: "0": Any "1": In order */ } } ==== Sectors ==== { "codes": [ /* List of sectors or codes in the level. Multiple items can be separated by commas */ { "name": "Sector 1", "code": "a, b" /* Synonym codes separated by commas */ }, { "name": "Sector 2", "code": "c, d" /* Synonym codes separated by commas */ } ], } ==== Bonuses ==== { "bonuses": [ /* List of bonuses in the level. Multiple items can be separated by commas */ { "number": 1, /* Sequence number of the bonus */ "code": "c, d", /* Answers */ "time": 0, /* Bonus time for completion */ "description": "", /* Bonus task description */ "hint": "", /* Text after solution */ "delay": 0, /* Delay of bonus appearance */ "duration": 0, /* Duration */ "duration_k": 0 /* Multiplier for remaining time */ } ] } ==== Hints ==== { "hints": [ /* List of hints in the level. Multiple items can be separated by commas */ { "number": 1, /* Sequence number of the hint */ "info": "", /* Hint description */ "hint": "", /* Hint text */ "delay": 0, /* Time delay */ "penalty": 0 /* Penalty cost */ } ] } ====== Example of a Whole Game ====== Description of fields is [[en:authors_main:admin_api:admin_api_json#game|here]]. Example without descriptions: { "game": { "type": "1", "stat": "5", "team_limit": 0, "name": "#New Unnamed Game", "description": "", "finish_text": "", "html_header": "", "image": "", "start_time": "2021-10-17 12:00:00", "end_time": "2022-10-17 12:00:00", "status": "3", "start_type": "0", "price": 0, "currency": "UAH", "kind": "0", "scenario": "0", "answer_prefix": "ff", "default_line": "" }, "tasks": [ { "task": { "number": 1, "max_time": 3600, "score": 10, "time_k": 1.0, "delay": 0, "working_name": "Title", "name": "In statistics", "surrender_code": "GiveUp", "task": "Test", "script": "alert(1)", "answer": "Word in English", "answers_limit": 10, "answers_per_time": 60, "answers_limit_penalty": 10, "codes": 0, "code_bonus_time": 0, "code_bonus": 0, "finish_confirmation": "1", "hidden_bonuses": "0", "bonuses_kind": "0" }, "codes": [ { "name": "Sector 1", "code": "a, b" } ], "bonuses": [ { "number": 1, "code": "c, d", "time": 0, "description": "", "hint": "", "delay": 0, "duration": 0, "duration_k": 0 } ], "hints": [ { "number": 1, "info": "", "hint": "", "delay": 0, "penalty": 0 } ] } ], "gbonuses": [ { "code": "cc, dd", "time": 0, "description": "", "hint": "", "first_task_n": 1, "last_task_n": 2 } ], "lines": [ { "title": "Line 2", "task_order": "1,2,3+4,5-7" } ] } ====== Example of a Whole Level ====== Description of fields is [[en:authors_main:admin_api:admin_api_json#level|here]]. Example without descriptions below: [ { "task": { "number": 1, "max_time": 3600, "score": 10, "time_k": 1.0, "delay": 0, "working_name": "Title", "name": "In statistics", "surrender_code": "GiveUp", "task": "Test", "script": "alert(1)", "answer": "Word in English", "answers_limit": 10, "answers_per_time": 60, "answers_limit_penalty": 10, "codes": 0, "code_bonus_time": 0, "code_bonus": 0, "finish_confirmation": "1", "hidden_bonuses": "0", "bonuses_kind": "0" }, "codes": [ { "name": "Sector 1", "code": "a, b" } ], "bonuses": [ { "number": 1, "code": "c, d", "time": 0, "description": "", "hint": "", "delay": 0, "duration": 0, "duration_k": 0 } ], "hints": [ { "number": 1, "info": "", "hint": "", "delay": 0, "penalty": 0 } ] } ]