Hello everyone,
I am working on a prototype of an idea where items in the game act as cards. Imagine a regular RPG (for the sake of explanation) where each sword, bow, staff, armor, potion, etc... is just a card similar to card games.
Now the conundrum I am encountering is how to effectively handle loot without too much hassle (if that is even possible).
Right now, I am thinking of two ways:
1- Each item is a separate sprite that belongs to a type family. So MeleeWeapons family in C3 would contain swords and daggers for example while RangedWeapons would contain bows and crossbows. I'd manually apply a sprite appropriate for the item and add family variables such as name, damage, range, durability and skill.
This would require that when, say, I loot a chest, I would have to generate a random number from 0 to how many types of items I have in the game. Each type has a number ID and that random number decides the family I'll create an item from. Then another random number from 0 to max family member size to choose which item in the family to specifically create for the player.
2- I create a XML/JSON file with all the items. I load up the JSON/XML file at the start. I create a single sprite called "LootItem" for example that spawns when the player loots the chest from the first example. Then at that moment, I randomly pick an ID from the XML/JSON file instead of the above method. The issue here will be that I need a specific PNG for each item and to my knowledge, I can't reference "X.png" in the JSON to load it in a sprite, I'd have to apply it as an animation or frame and know these animation names/frame number by heart to reference in the code. Not to mention the sprite will need to cater to every possible item type's setup. A weapon may have damage and range but a potion won't need those things for example so it might get confusing as the game gets more complex.
To me, the first solution is more work generally speaking than the second but it is far easier to maintain. If an item changes I just change the specific sprite for it. The ID ranges would require me to remember to change if let's say a family of items became 5 instead of 6.
The second method seems to save time at first but the issue with loading the art file would make it a complete mess if I decide to use "X.png" for weaponA instead of WeaponB or if any of the IDs changed for any reason. Not to mention the whole mess from dealing with different types of items that do different things, if not for anything, then when I display a tooltip so I don't display "damage: 5" for an HP potion. I am also not a fan of how you extract information from JSON/XML it just feels off in the events sheet.
What do you folks think? Any feedback/ideas/suggestions are welcome.
Note I don't want to jump into coding for this setup.