I am creating an RPG dungeon game in Java and I am stuck in creating a data structure.
I have many Thing objects that I can copy to fill the dungeon. For example, there is a Thing object for bread and a Thing Thing object, a Thing chain Thing object and a Thing monster (s), etc. I want to store them in a central library, and then be able to retrieve an object using specific queries. I want to save them using the following fields:
int minLevel int maxLevel double probability int[] types
Thus, a rusty sword would have minLevel 1, a maxLevel of 3, a probability rarity (3%) and [type.SWORD,type.WEAPON,type.ITEM,TYPE.EQUIP] . The best sword would have minLevel 2, maxLevel 10, rarity (1%).
Then I want to get a random type.SWORD from the library and say that I am at level 3. I should get a rusty sword more often than the best sword based on their probabilities. If I got type.SWORD from a library requesting level 10, I would only return the best sword.
Hope this makes sense.
EDIT At the initialization stage, all basic objects will be created. Things like affordable weapons, armor, food, potions, wands, all the main possible things that have a unique graphic tile in the game. Then, when I want to place the object somewhere, I just make a copy of one of the available things, slightly adjust the statistics and put it into the world. Actual elements are all subclasses of the Thing root class, such as Creature, Item, Equip (extends Item), Weapon (extends Equip), Armor (extends Equip), Food (extends Item), etc. But I want to note they are different in the library database, I want to use additional tags, such as type.RARE, type.ARTIFACT, type.CURSED, so I want to add additional tags in addition to the class.
The game uses LIBGDX for Android and Applet. I use the free Rltile suite, which has thousands of good snippets. I will use Pubnub or Google App Engine to support multi-user support.