[p]Hi everyone! Of Roots and Gears team is here![/p][p]We’re continuing to work on the game. And in the process, decided to share some notes and ideas which we discovered during development.[/p][p]When work on Of Roots and Gears began, there was a huge number of variables to account for and configure. Tackling them one by one would’ve resulted in a messy set of quick fixes, while we wanted a more cohesive system.[/p][p]After experimenting with our own game and analyzing other projects, we came up with the idea for a [b]flexible RPG system architecture[/b]. It’s built around four core entities:[/p][p] [/p][p][b]1. Object[/b][/p][p]Any interactive object in the game world – character, door, chest, etc.[/p][p]Includes:[/p][list][*][p]inventory[/p][/*][*][p]modifiers (more on that below)[/p][/*][*][p]stats (health, speed, etc.)[/p][/*][*][p]AI information[/p][/*][*][p]known actions (kind of like a “spellbook”)[/p][/*][/list][p] [/p][p][b]2. Action[/b][/p][p]Any change in state happens through an action.[/p][p]Any action has:[/p][list][*][p]source (the one who’s performing the action)[/p][/*][*][p]target[/p][/*][*][p]parameters (max distance, allowed target types, etc.)[/p][/*][/list][p]An action can be anything from a fireball to opening a door – any interaction with the game world.[/p][p]Typically, it works like this: there’s an abstract Action class with specific implementations like Fireball, where the action is defined (e.g. "takes the mage’s spell power, multiplies it by 2, and deals damage").[/p][p][b]Important note![/b] Actions can be modified with modifiers. That’s why they’re created by Objects – so they can account for, say, a buff that increases fireball range.[/p][p]Plus, this architecture allows for dynamic tooltips: distance to the target isn’t stored statically – when you hover the cursor, an instance of Fireball is created, and data is pulled from it.[/p][p] [/p][p][b]3. Modifier[/b][/p][p]In gameplay terms, this is a buff or debuff.[/p][p]It can:[/p][list][*][p]change a character’s stats[/p][/*][*][p]modify created actions (e.g. the character’s code has CreateAction(), which calls OnActionCreate() for each modifier, and each modifier can change the fireball’s parameters).[/p][/*][/list][p]Modifiers can also have callbacks that are triggered:[/p][list][*][p]by taking damage[/p][/*][*][p]by healing[/p][/*][*][p]on a timer (e.g. for Damage-over-Time effects)[/p][/*][/list][p]And so on – the list of modifiers depends on the game’s needs.[/p][p] [/p][p][b]4. Item[/b][/p][p]This refers to something in an inventory – not to be confused with an Object in the game world.[/p][p]It can:[/p][list][*][p]modify stats (if equipped)[/p][/*][*][p]apply modifiers (if equipped or even just put in a bag)[/p][/*][*][p]have an active action (e.g. the item can be used in the game world)[/p][/*][/list][p][/p][p][b]Conclusion:[/b] This structure helps create a flexible and expandable system where new abilities, items, or effects can be added quickly without breaking the existing code.[/p][p]P.S. We hope to share some code snippets built with this architecture in the future. For now, we hope these insights help other indie developers embarking on their own RPG journey.[/p][p][/p][p]To get more info about the development process, check out our blog on X: [/p][p][url="https://x.com/roots_and_gears"]https://x.com/roots_and_gears[/url][/p][p][/p][p]See you soon![/p]