Hello, I’ve been working on an mmorpg for a bit. I’ve created some odds and ends, prototyped some things and etc.
However, there is a question that I don’t think I’ll be able to answer myself. I’ve written some code for an inventory system, all fine and dandy there, but I can’t figure out a good/efficient way to store item information client-side to query/access when information is needed about a specific item such as itemname, item type, stats and etc.
I’m interested in possible solutions to this problem, aside from a clientside sql database unless that’s the best option, so if you have any ideas or suggestions I’m all ears.
SQL? That’s rather overkill. I doubt you will ever have tens or hundreds of thousands of item descriptions.
Seriously, you could just make something like;
public class ItemDescription : ScriptableObject
{
public string name;
public string description;
public Texture2D icon;
public ItemType type;
public List<ItemStat> stats;
}
and so on.
You could also be clever and put all those in separated files in Resources folder, and load them by their names only when you need them.
Or you could make yourself a kind of dictionary that contains all the item data into a single ScriptableObject.
Thank you very much LightStriker I think you’ve given me exactly what I need. I’ll be reading that documentation tonight, I’ve been searching around about it to see if it was what I needed and it is perfect. So thank you.
Thank you Meltdown, I know that such things would be susceptible to exploiting which is why I’d be using this method specifically for client-side data that would be for representation only. All stats, when the items are equipped, and all uses, when the items are used, will be calculated server-side. I’m currently using Photon Server and I’ve grown quite fond of it. Do not worry though, I will not allow the user to simply modify the item data so that they can cheat the system. Definitely useful advice though.