Inventory item properties

Xer0botXer0

Senpai
Good day all!

So I'm neeearing the end of the registration process code, about now I need to store the players registration info into a file.

I'm using a text file to store the information and found that they can get pretty indepth compared to ini files.

I'm using opening and closing tags as containers for sections of information, now I've gotten to the point where I'll be creating the players inventory.

Here's what I believe it'll look like

player_inv_txt.JPG

I feel like there's a lot of work when it comes to txt files, like atm I can only append, otherwise from what hear I've to load it all into an array or so, then update the inbetweens, then send it back..

But my question here what sort of properties besides for item_info_ref, item_instance_id, item_count that's unique to this item should I consider or is generally used in MMORPGs ? or just multiplayer games basically.

I imagine my items system like this, each item holds a position in a 2D array as the first dimension where the second dimension is its properties such as links to sprites, icons, description, booleans like stackable, harvastable, edible, etc.
when a player gets an instance of that item I only link back to the 2D array otherwise there's duplicate code, but the properties from the 2D array is read only, now for each instance those read only properties will be used to determine how the player can interact with it.


I think the main issue is I don't want to lose track of the item.
I've got item_instance_id..


How do you keep track of your instance ?

say you chop down a tree, logs fall on the ground.. thump! so the tree disappears, the logs are created.. as object instances but since it's multiplayer they've got to be in a list somewhere, how does one keep track of world placed items ? should that go into a server side text file ? perhaps zone based. yes maybe.

In any case, so a log is created and receives an instance id (should this be randomized, what if there are duplicate instance ids ? oof. maybe hold a variable server side that increments when a new item is created..)
this instance id I just realized is better called a UID or Unique Identifier which is then used to encase the properties of the instance.

okay so the player picks up the log, which is validated by the server upon pickup request(with minimal data) the server already knows the clients position so take that position and determine distance between, and if the players inventory is full, and if the instance still exists in the game world(like in minecraft where you could lag and mine the same block twice lol)so those checks, then I wonder.. you first copy the instance id information over to the players inventory if everything checks out, then delete it from the game world, then remove it from the game worlds items list..

so now the player has the item in her inventory which checks out for me, any criticism or suggestions or shortfalls you notice here ?


One more thing..

I feel like there may be an issue with storing and handling of different types of objects,

Say you've got a apple in your games items textfile with it's default properties as mentioned before
now you pickup two instances of it in your inventory and perhaps the first apple that fell has rotten..

so they're in your player inventory and they link to the same game item but they're unique due to what ever laws you've put into place.

now you pick up a sword.
which is you cant eat, you can swing it.. it probably has some stats and so on.

if I place both types of items in my inventory, how do first go about recognizing the interactions with the selected item ?

say I right click on the apple in my inventory, it should pop up a list of interactions like eat(edible specific), or drop.
with the sword it should say equip to weapon slot(on hand weapon specific), drop(universal),


maybe I could create a few dozen interaction lists, one for edibles, one for weapons, one for logs..
I'm not entirely sure here.

for one I know that each list will have drop where it's dropped back onto the floor if possible, then in comes those specific interactions.. how and where do i store the information that says 'these are the interactions available for this item'..

I remember the first time I made an items list, it looked sort of like this.. can you imagine how large the 2D array was ?


arr_items[i,0] = "apple";
arr_items[i,is_edible] = true;
arr_items[i,can_equip_on_hand] = false;
arr_items[i,can_equip_off_hand] = false;
arr_items[i,hit_damage] = -1;
arr_items[i,regen_period] = room_speed *3;
arr_items[i,HP_recovered] = 100;
arr_items[i,equip_head] = false;
arr_items[i,durability] = 5;
arr_items[i,armor_count] = -1;


arr_items[i,0] = "sword";
arr_items[i,is_edible] = false;
arr_items[i,can_equip_on_hand] = true;
arr_items[i,can_equip_off_hand] = true;
arr_items[i,hit_damage] = 30;
arr_items[i,regen_period] = -1;
arr_items[i,HP_recovered] = -1;
arr_items[i,equip_head] = -1;
arr_items[i,durability] = 60;
arr_items[i,armor_count] = -1;


arr_items[i,0] = "Hat";
arr_items[i,is_edible] = false;
arr_items[i,can_equip_on_hand] = false;
arr_items[i,can_equip_off_hand] = false;
arr_items[i,hit_damage] = -1;
arr_items[i,regen_period] = -1;
arr_items[i,HP_recovered] = -1;
arr_items[i,equip_head] = true;
arr_items[i,durability] = 20;
arr_items[i,armor_count] = 2;

so these items all share the same 2nd dimension properties, where certain properties are only applicable to certain items, while other properties are applicable to all items..

If I consider real world inventory, there's often directions to use,and when we purchase the item we sort of already know what it's for based on its appearance and labeling or prior research, so perhaps I should leave item information that's universal like the item name, description, sprite and such in arr_items, and then include a set of second dimension properties for each item like so

arr_items[i,name] = "Hat";
arr_items[i,description] = "you can wear it, it's snazzy!";
arr_items[i,sprite] = spr_snazzyhat;
arr_items[i,is_wearable] = true; //
arr_items[i,arr_wearable_ref] = "arr_items_wearables";
arr_items[i,is_weapon] = false; //
arr_items[i,arr_weapon_ref] = "arr_items_weapons";
arr_items[i,is_craftable] = true; //
arr_items[i,arr_craftable_ref] = "arr_items_craftables";
arr_items[i,is_edible] = false; //
arr_items[i,arr_edibles_ref] = "arr_items_edibles";

this sort of looks better doesn't it ?

then we've got

arr_items_wearables[i,0] = "Hat" //reference name
arr_items_wearables[i,1] = 6; //equips type (1 - shoes, 2 - pants, 3 - top, 4 - gloves..)
arr_items_wearables[i,2] = 5; //durability
arr_items_wearables[i,3] = 2; //armor count




Does this make sense so far ?
 
Top