I'm wrapping up the finalizations of my crafting system (aptly named: JAFTING), and looked at the code and realized maybe others handled it better, so here I'm asking:
In my JAFTING system, the player can create stuff from one of two ways: via "Recipe" or via "Refinement".
- "Recipe" is probably the more common of the two, where you sacrifice X number of Y ingredients, and !!!! you get new things in your inventory that the recipe's output specified (a bit more complicated than that, but most RPG gamers are familiar).
- "Refinement" is also probably familiar, where the player picks a "base" weapon/armor, a "material" weapon/armor, and sacrifices the "material" to pass on the rpg maker traits that the "material" had onto the "base". There is a bit more magic behind the scenes (about 800 lines of it), but the end result is basically your "base"+1 with some new/upgraded/replaced traits based on the "material". In order to achieve this though, all newly "refined" weapons are given a brand new entry in the database of their corresponding type ($dataWeapons for weapons, etc). When it comes to saving, all refined equips ever created are captured into the save file, and upon loading we re-inject the refined equipment into the $dataWeapons/$dataArmor where they can continue being used.
I am a bit nervous about releasing this functionality publicly, as I fear if the player decided "today is the day we refine 70k weapons", well, then all those database objects will be captured into the save file and I am fairly certain there is a limit. I did it this way because I just couldn't come up with a better way...
At a glance, I didn't even see any other plugins that covered this type of functionality (quick google search, though I didn't try hard), but, to those of you who have done something like this, how did you accomplish it? Is there a better way?
- "Recipe" is probably the more common of the two, where you sacrifice X number of Y ingredients, and !!!! you get new things in your inventory that the recipe's output specified (a bit more complicated than that, but most RPG gamers are familiar).
- "Refinement" is also probably familiar, where the player picks a "base" weapon/armor, a "material" weapon/armor, and sacrifices the "material" to pass on the rpg maker traits that the "material" had onto the "base". There is a bit more magic behind the scenes (about 800 lines of it), but the end result is basically your "base"+1 with some new/upgraded/replaced traits based on the "material". In order to achieve this though, all newly "refined" weapons are given a brand new entry in the database of their corresponding type ($dataWeapons for weapons, etc). When it comes to saving, all refined equips ever created are captured into the save file, and upon loading we re-inject the refined equipment into the $dataWeapons/$dataArmor where they can continue being used.
I am a bit nervous about releasing this functionality publicly, as I fear if the player decided "today is the day we refine 70k weapons", well, then all those database objects will be captured into the save file and I am fairly certain there is a limit. I did it this way because I just couldn't come up with a better way...
At a glance, I didn't even see any other plugins that covered this type of functionality (quick google search, though I didn't try hard), but, to those of you who have done something like this, how did you accomplish it? Is there a better way?
