DevDiary 11 Frameworks - Battle-Modders/mod-reforged GitHub Wiki
Dev Diary #11 - 11-Sep-2024
LordMidas
- Introduction
- Dependencies Instead of Bundle
- Modular Vanilla
- Dynamic Perks Framework
- Dynamic Spawns Framework
- Item Tables Framework
- Nested Tooltips Framework
- Stack Based Skills
- Unified Perk Descriptions
During the development of Reforged a key consideration was to write the code from the ground up in a way to maximize compatibility with other mods. Therefore, for certain features we decided to create standalone frameworks which we are publishing separately to be used by the entire Battle Brothers modding community. The code of these frameworks has also been written with maximum compatibility and flexibility in mind.
Reforged makes extensive use of each of these frameworks, but we hope that other modders will also find them useful for their own projects. As these are open source projects, the community is also welcome to contribute to them.
We have decided to keep these frameworks as separate mods and therefore they must be downloaded separately as dependencies of Reforged. This is because:
- They are not a part of Reforged, but rather frameworks for the entire community to use. So we don't want to set a precedent that they are somehow part of the Reforged package.
- There may be other mods, independent of Reforged, who may want to use these frameworks.
- Keeping them separate allows us to maintain and update each framework separately.
While we understand that this requires Reforged players to download several dependencies before they can start playing, this is a worthwhile compromise for the benefits it brings. Once downloaded, the MSU update notification system will notify users of any individual updates to frameworks so it shouldn't be a tedious process.
This is an ambitious project that will probably remain in development for a long time. The goal of this project is to rewrite large swathes of vanilla code to make it more modular so that modders can modify individual aspects of vanilla without having to overwrite large monolithic functions. The importance of this for enhancing moddability while also greatly increasing the scope for inter-mod compatibility cannot be overstated.
This framework provides functionality for modders to easily create dynamic perk trees for characters. It provides important features such as creating perk groups and writing complex logic for generating perk trees based on weighted multipliers, and various parameters such as the character's backgrounds, talents etc.
In vanilla Battle Brothers each enemy party you see on the world map is generated from a list of hard-coded predefined parties. This system has two inherent flaws: it can only scale as high as the highest defined party and is limited by the total variety of parties that are defined.
The Dynamic Spawns Framework provides extensive functionality for creating dynamically generated enemy parties. It provides a plethora of levers that designers can use to write highly complex and intricate party generation systems based on unit types, units grouped into unit blocks, dynamically generated parties which are composed of nested dynamic blocks or even nested dynamic parties. For example, using this framework a designer can say that I want a party that is composed of 50-75% frontline units and 25-50% backline units - the party will then be dynamically generated at all stages of the game by picking units from the available units that the designer has defined for the frontline and backline unit blocks, automatically upgrading units into higher tier variants as required based on the stage of the game using upgrade policies that the modder can define within the party's building blocks.
This is just the tip of the iceberg and the framework provides possibilties for customization to go a lot deeper.
This framework provides the ability to define sets of items from which items can then be rolled using complex logic. For example, you could have a table of some specific weapons and you may want to roll from it to equip an entity based on parameters such as the item's value, damage, durability etc. or you may want to roll from an item table for generating loot for a certain event or location.
A great benefit of using item tables to equip entities is that adding/removing an item to an item table automatically makes that item available to all entities using that item table. For example, if certain Bandits in Reforged roll from the BanditArmor item table to equip their armor, a submodder for Reforged who adds new armor types simply has to add his armor to that armor table and all those bandits in Reforged will now have access to that - without the modder having to modify or worry about the individual bandits' code.
The possibilities with this framework are many and we intend to create and use many item tables in Reforged for generating the equipment of recruits and enemies.
This framework is being developed by the MSU Team (who also happen to be part of our team: Battle Modders) and provides functionality to create nested tooltips within tooltips. This feature is found in many modern games but was missing from Battle Brothers, until now. We make extensive use of it in Reforged to streamline our users' experience and provide easily accesible information about skills, effects and concepts in all the relevant places.
This provides functionality for multiple sources to add the same non-stacking skill to a character and then stackwise remove that skill. This fixes the issue where if you had a perk provide you with the Indomitable skill, but perhaps there is a weapon that also grants the Indomitable skill upon equipping, then if you have the perk and you equip the item, then unequipping the item or losing the perk would cause the Indomitable skill to be removed from the character. This happens because the game does not keep track of how many sources added the same skill to a character and whenever any one of those sources is removed it would remove the skill. With the Stack Based Skills framework, this memory is now kept and a skill is only removed when all sources providing it are removed from a character.
We make extensive use of this in Reforged e.g. whereby certain perks provide certain other perks under certain conditions e.g. the Weapon Master perk which provides the perks of other weapon groups when you have a weapon equipped.
This framework provides a standardized format for perk tooltips and provides tools for modders to automatically generate these standardized formatted tooltips by specifying the passive, active and one-time effects of perks. We are not sure yet if this will remain as a standalone framework or will be significantly modified/merged into another framework.