How Tsumugi reads your game
Tsumugi reads your GameMaker project the way GameMaker saves it. It needs no plug-in in GameMaker, and GameMaker doesn’t need to be running.
Finding the game
Tsumugi looks for a .yyp file in the folder you open, in a game folder inside it, or in the folders above your story file. The folder with the .yyp is the game.
It reads the game again by itself whenever a sprite, object, room, script, tsumugi.json or .yarn file changes. To read everything again by hand, run Tsumugi: Reload Game Project.
What it reads
- The project’s resources: sprites, objects, rooms, fonts, sounds and scripts, and the folders they are in.
- Included Files: the files your game ships with.
- Story files: every
.yarnfile indatafiles, or the files listed underdialoguein tsumugi.json. - Your game’s code: the GML in your objects and scripts. Library code, like Chatterbox and Scribble, is skipped.
tsumugi.json, if your game has one.
What it learns from your code
Tsumugi reads your GML for the parts that touch the story:
| In your code | Tsumugi uses it for |
|---|---|
ChatterboxAddFunction(...) |
The events and checks the story can use. A // @tsumugi comment above gives the writer’s words (Events). |
ChatterboxLoadFromFile(...) |
Which story files the game loads. |
ChatterboxVariableDefault(...) and other variable calls |
Variables your code sets up, and their starting values. |
ChatterboxJump(...), ChatterboxHop(...) |
Where your game’s code starts the story: the Game code boxes on the map. |
story_start_scene(...) |
Where the game starts: the Game start box. See Testing in GameMaker. |
ChatterboxCreate(...) |
Whether the game shows one line at a time, or several. |
| Scribble’s default font, colours and typing speed | Drawing the preview, and measuring text that fits. |
Other places in your code that start the story can be added under entryPoints in tsumugi.json.
Loading story files
For your game to play a story file, two things must be true:
- The file is in your game’s Included Files, so it ships with the game.
- Your game’s code loads it with Chatterbox:
ChatterboxLoadFromFile("ChapterTwo.yarn");
Tsumugi checks both. If a file is missing either one, the Story files list says not in the game yet, and the story shows needs code.
- New story file… adds the file to Included Files for you.
- Tsumugi can add the load line under your game’s last
ChatterboxLoadFromFileline. It shows the change and asks first. If your game loads no files yet, add the first line yourself.
When GameMaker is open
When Tsumugi adds something to the project while GameMaker is open, GameMaker asks to reload the project. Say yes. Tsumugi tells you before it writes, if it sees GameMaker running.
Next
- tsumugi.json: tell Tsumugi how your game names things.
- What Tsumugi changes: every file Tsumugi may write, and how it keeps them safe.