I’ve been poking around for the answer for this question, but I keep getting questions and answers that are close in wording, but not exactly what I’m looking for.
My current project is a game with RPG elements, and my current problem right now is items.
The player’s current inventory seems like a pretty straight forward concept: Use a list/associative array to create a list of items actively in the player’s inventory, with their associated values set to the number of items of that name. Pretty straight forward.
But what about the overall item list/table?
My item class will look something like this:
psuedocode:
Public Class Item
{
int ID //The item's relative ID in the game.
string Name // Item's displayed name.
boolean equip // Can item be equiped?
boolean use // Can item be used?
enum location //None, Body, Hands, Feet, Accessory
int modAttribute //A few of these, for each of the game's attributes.
//Other variables, such as item# limit, game icons, etc, including all
//of the "Gets/Sets" for these properties.
}
Naturally, I could create a huge array(of this item class) to contain all of the game’s inventory data in code, but it seems like it would be a pain to work with both in adding/removing/editing items, and with assigning items to certain enemies/chests/etc in order to be dropped/otherwise handled.
I’ve worked with databases before, but only non-local/web databases(MySql and the like.) They seem like they would be a good solution, if only they were local and/or light weight enough to use with a game. I’ve stored data as CSVs before, but it seems like a horrible idea to publish a game where the game’s data is stored in plain/mostly plain text, and editing a CSV formated inventory list still feels… sub-optimal.
Is there an easy way to store this kind of data outside of scripts, without a web database, and preferably in a format that couldn’t easily be edited by a curious gamer in notepad?