Dev blog 28 - Making an encounter
Hey folks!
This time around, I’ll be talking about the encounter syntax. The reason why I’m talking about the internal systems sometimes is because being on Serious Engine, it gives us the possibility to deploy the editor as well. This opens up the game to modders to create their own content for the game, which includes new characters and monsters, new Skills and Spells, new Guardian Cores, and (today’s topic) new encounters.
Early on, we knew we wanted each world location to have a small story encounter, similar to FTL. The initial implementation in the old engine used Lua to define each encounter. It followed a tree or graph structure, where each “page” seen in the game was defined with a couple of strings: the text itself and the text for the possible choices the player can make to drive the encounter forward. Since this was all written in Lua, part of it was essentially code that drove the transitions between the different pages and choices, another part of it was text to show in the UI and the last part was providing rewards, like gaining or losing gold or supplies.

When Jonas and Verena Kyratzes joined the team, we knew we didn’t want them to bother with writing the code, so we decided to make a special file format for the encounters where the only thing you’d need to think about was writing the flow of the encounter. This boils down to writing a declarative list of elements that define the encounter: encounter name, default image, and a list of pages with their options. We went with a text format because that's what the writers are comfortable with, but it also means creating a visual tool isn't too difficult because all it has to do is spit out the file with the same format. It's something I'm interested in trying to make at some point.
Each encounter starts with a header of sorts, where we define the name, default image, type, and zone. After that, we start listing the pages that form the encounter. Every encounter has to have an “Intro” page - this is the first page we open when an encounter starts. Each page is defined by the text on it and a list of options that form the choices the player makes on the page. Each option can have a large list of conditions and triggers. Conditions are checks that control whether the option can appear on the page and if it does, whether it’s enabled (clickable). Triggers are side effects that happen after clicking the option - gaining or losing currency, recruiting a hero, acquiring a relic, or setting some session or profile variables. These variables can be used by other encounters to control their internal flow, like setting up long term rewards. Each option has to link to a “next“ page which should open when that option is clicked. This is the name of the page (which can be any page), or a special value of “END” which ends the encounter.

There are 3 types of pages we use: normal pages, fight pages, and wheel pages. Normal pages are the standard generic page you can see in any encounter. Fight pages are not really pages you can see but are used to start a combat map. Wheel pages are incorrectly named due to historical reasons but are used to spawn cards to provide the player with a random choice. There are improvements we’re planning with the cards, but that’s a topic for another time (when we add them).
A lot of these also allow a way to randomize things with the OR keyword. For example, the next page for an option can be chosen between multiple possible pages - Page1 OR Page2 OR Page3, etc. The cards also define their individual next page, which again opens up a multitude of possibilities. Finally, using session or profile variables, it's possible to start the entire encounter on a page that isn't strictly the Intro page, which we occasionally use for making the encounter different based on the chosen king for that session.
Thanks for reading! This was a very general overview of the encounter syntax. We have some internal documentation for this which will be exposed to modders when/if the editor is released, and I'll always be available for questions about it should things be unclear.
If you want to ask those questions straight away, join our Discord server and ask! I also occasionally post stuff on my Twitter.
MarkoP
This time around, I’ll be talking about the encounter syntax. The reason why I’m talking about the internal systems sometimes is because being on Serious Engine, it gives us the possibility to deploy the editor as well. This opens up the game to modders to create their own content for the game, which includes new characters and monsters, new Skills and Spells, new Guardian Cores, and (today’s topic) new encounters.
Early on, we knew we wanted each world location to have a small story encounter, similar to FTL. The initial implementation in the old engine used Lua to define each encounter. It followed a tree or graph structure, where each “page” seen in the game was defined with a couple of strings: the text itself and the text for the possible choices the player can make to drive the encounter forward. Since this was all written in Lua, part of it was essentially code that drove the transitions between the different pages and choices, another part of it was text to show in the UI and the last part was providing rewards, like gaining or losing gold or supplies.

When Jonas and Verena Kyratzes joined the team, we knew we didn’t want them to bother with writing the code, so we decided to make a special file format for the encounters where the only thing you’d need to think about was writing the flow of the encounter. This boils down to writing a declarative list of elements that define the encounter: encounter name, default image, and a list of pages with their options. We went with a text format because that's what the writers are comfortable with, but it also means creating a visual tool isn't too difficult because all it has to do is spit out the file with the same format. It's something I'm interested in trying to make at some point.
Each encounter starts with a header of sorts, where we define the name, default image, type, and zone. After that, we start listing the pages that form the encounter. Every encounter has to have an “Intro” page - this is the first page we open when an encounter starts. Each page is defined by the text on it and a list of options that form the choices the player makes on the page. Each option can have a large list of conditions and triggers. Conditions are checks that control whether the option can appear on the page and if it does, whether it’s enabled (clickable). Triggers are side effects that happen after clicking the option - gaining or losing currency, recruiting a hero, acquiring a relic, or setting some session or profile variables. These variables can be used by other encounters to control their internal flow, like setting up long term rewards. Each option has to link to a “next“ page which should open when that option is clicked. This is the name of the page (which can be any page), or a special value of “END” which ends the encounter.

There are 3 types of pages we use: normal pages, fight pages, and wheel pages. Normal pages are the standard generic page you can see in any encounter. Fight pages are not really pages you can see but are used to start a combat map. Wheel pages are incorrectly named due to historical reasons but are used to spawn cards to provide the player with a random choice. There are improvements we’re planning with the cards, but that’s a topic for another time (when we add them).
A lot of these also allow a way to randomize things with the OR keyword. For example, the next page for an option can be chosen between multiple possible pages - Page1 OR Page2 OR Page3, etc. The cards also define their individual next page, which again opens up a multitude of possibilities. Finally, using session or profile variables, it's possible to start the entire encounter on a page that isn't strictly the Intro page, which we occasionally use for making the encounter different based on the chosen king for that session.
Thanks for reading! This was a very general overview of the encounter syntax. We have some internal documentation for this which will be exposed to modders when/if the editor is released, and I'll always be available for questions about it should things be unclear.
If you want to ask those questions straight away, join our Discord server and ask! I also occasionally post stuff on my Twitter.
MarkoP