Godot Version
Godot 4.6
Question
Hello every one! I’m kind of new in this world and I’m struggling implementing an ability system for a turn based jrpg-like game. I’m going for a resource driven approach but I think it is getting too convoluted.
There might be tutorials, guides or other posts about this but I can’t seem to find them.
My general achitecture/idea is that I have a resource called actor that represents the battler, it might be an enemy or the player, and each of them can have 1 or more ActionData (I used the suffyx data as a convention for everything that exents Resource).
Such ActionData have multiple attributes that describe them but the most peculiar is that they have an array of StatusData they can apply. StatusData is another different resource that describes the status itself and apart from attributes that describe it there is an array of EffectData. Each one of those represents the description of the effect, being it a tick effect or a stat buff/debuff etc.
This not mentioning I need also to insert the Element affinity stuff.
My issue is that it is getting maybe too “spaghetti” and even to implement a simple “Poison Slash” where there is a tick effect at end of turn it needs 3 .tres file to be defined.
Is there a smarter way, am I going too deep with this system? Any of you have an example that can share?
Thanks very much in advance from a passionate newbie that wants to jump in this world.
Sounds ok.
Sometimes in cases like this it may be preferable to build resource objects from spreadsheet tables via tool or startup scripts, instead of editing stuff in the inspector.
This all sounds logical - using nested resources is par for the course when creating RPG-style systems in Godot.
One thing to consider is the use of Arrays and Dictionaries. You’ll need to examine your data flow carefully, but you may find that it’s easier to store some data in Arrays and some in Dictionaries.
For example, my RPG has an inventory system. Each item is represented by an ItemResource, which contains basic metadata (item name, gold value, the number of them I have, etc.).
These resources are stored in an array within an Inventory Resource - they’re in an Array because they don’t need to be stored in a specific order. The player can search and reorder things as they see fit, or sort things automatically using the UI.
This whole Inventory system itself is stored within a Dictionary called player_data, which also contains other non-inventory data about the player, such as movement speed and the player name.
Then when the game is saved, this Dictionary is saved into a custom resource named SaveResource, which stores all relevant data about the player.
So we’ve got a Resource (SaveResource) which contains a Dictionary (player_data) which contains a Resource (Inventory) which contains an Array of Resources (ItemResource). It’s Resources all the way down baby!
Here’s a plugin that I’ve found helpful for visualizing and quickly editing my hierarchies:
2 Likes
Thanks for the tool link, I’ll give it a try 
1 Like
Thanks for the reply I was starting to think it’s related to my lack of experience in the field, I just followed what I would normally do in my every day life as a programmer, but it seemed very confusing at a certain point.
About startup scripts what you mean?
Creating a separate project with all my resources, then from those extract a script that would create the “db” and add it to a fake scene or as auto-load in the real project? (stupid question spoiler maybe)