Dev Diary: Events and Modding
[p]Hello all! This week we're going to look at two of the systems that have been the most interesting to develop: the dynamic event system, and the modding framework that lets you create your own content for Fall of an Empire.[/p][p]You'll be familiar with event pop-ups if you've played a grand strategy game before: a bit of flavour text, a scenario, and a set of options for the player to choose between. Fall of an Empire has these too but rather than being entirely hand-written, many of the game's events are generated dynamically by a local langauge model that runs alongside the game. This is, of course, optional: the models that generate these events are quite large (2, 4 and 8GB - the 8GB model will be an optional separate download).[/p][p]How it works: The game keeps a library of event topics - high-level scenarios like "a governor is skimming taxes", "an allied faction requests military aid", or "your heir's education needs guidance". Every month or so, the system picks a topic that fits the current state of your empire. It then gathers context from the game world: which characters are involved, what settlements are relevant, what factions are at war, and so on. All of this gets fed to the model, which writes the actual event text and options.[/p][p]
An example of one of the generated events.[/p][p]The result is that events feel specific to your playthrough. If you're at war with the Himmelsvolci and your treasury is running out, you might get an event about a desperate general requesting funds for a siege - naming real characters, real settlements and real armies from your game. If your heir is being educated by a clever courtier, the events about their upbringing will reflect both that courtier's personality and your heir's developing traits.[/p][p]Events can also chain together. If you choose to investigate a corrupt governor rather than punish them immediately, a follow-up event will appear weeks later with the results of that investigation, written with full knowledge of what happened before. The AI keeps summaries of previous events in the chain so that continuity is maintained across the whole story.[/p][p]Each option in an event has consequences: gold gained or lost, changes to character stats and traits, shifts in loyalty, unrest in settlements, character deaths. Options are decided by traits, so a merciful emperor will see different choices than a cruel one. To keep the model from going off the rails, the system uses a grammar that constrains the model's output. It can only reference characters, factions and settlements that actually exist in your game, and it can only apply effects from a defined set. So you'll never get an event that mentions a character who doesn't exist or gives you a million gold by accident.[/p][p]Alongside all of this, there are also hand-written scripted events for the most important moments: great famines, barbarian hordes, plagues, crises of succession. These follow the same presentation and effect system.[/p][p]I've also wanted to make Fall of an Empire moddable as it can be. The game's content is built on a system of auto-discovery: rather than registering each trait, building, unit or interaction in some central list, the game simply searches for all classes that extend a base type and makes them available. This means that adding new content is as simple as dropping a script file into the right folder.[/p][p]Mods live in a Mods/ directory. Each mod is a folder with a mod.json file describing it, and then whatever content the modder wants to add: AngelScript files for gameplay logic, DataTables for icons and data, and optionally a PAK file for packaged assets like textures and sounds.[/p][p]Here's what you can create:[/p][p]Traits - new character modifiers with stat effects, inheritance chances, gain/loss conditions and conflicts with other traits. Want to add a "Paranoid" trait that boosts cunning but tanks loyalty? A few lines of AngelScript will do it.[/p][p]Buildings - new settlement structures with resource costs, economic effects, and level-up progression. Each building can have custom logic for what happens when it's built or destroyed.[/p][p]Units - new military unit types with their own damage profiles, recruitment costs, and special abilities. These can be tied to specific cultures, so a Tarhanic steppe mod could add new cavalry types that only Tarhanic factions can recruit.[/p][p]Interactions - new diplomatic actions, spy operations, personal schemes, and political manoeuvres. Each interaction has its own success chance calculation, cost, requirements, and effects.[/p][p]Policies and Edicts - new governance options for factions. Policies are sliders that the player can adjust over time; edicts are one-off decrees.[/p][p]Cultures and Religions - entirely new cultural and religious groups, complete with their own naming conventions, stat bonuses, and gameplay modifiers.[/p][p]Scripted Events - hand-authored event chains with branching narratives, context requirements, and mechanical consequences. These use the same system as the base game's events.[/p][p]Event Topics - new scenarios for the event system. Modders can add their own topic prompts to the DataTable, and the model will generate events from them using whatever context the topic requires.[/p][p]The icon system is also fully moddable. Icons are stored in DataTables that get merged at runtime - the base game loads its tables first, then each mod's tables are layered on top in load order. Later mods can override earlier ones, so compatibility patches are straightforward.[/p][p]In addition to these I'm also working on improving it some more so that you'll be able to use an Unreal plugin that includes all the game's systems and tools, so you'll be able to produce entirely new campaigns and scenarios and edit the UI as much as you want. This should be ready to go a couple of weeks after release.[/p][p]All user-facing text goes through the localisation system, so mods can be translated into any of the game's nineteen supported languages.[/p][p]I've included an example mod in the game's files that demonstrates a custom trait, building, diplomacy interaction, and scripted event. It should serve as a good starting point for anyone who wants to get their hands dirty.[/p][p]The modding documentation - covering content types, interactions, events, assets and packaging - will be available on the game's website.[/p][p]Thank you for reading! Next up is the game's launch which is coming up quickly![/p][p][/p]