Item generation

How a merchant generate weapons and parts when a player interact with it:

for i in range(1-n+1):    //n is randomly generated
    check the player level and rank
    set the item_level
    set the item_quality    //common, uncommon, rare, unique, set
    set required_level and required_rank
    select item_type
    if item_type == weapon:
        Randomly select a weapon_type  //ex: Ballistic
        Based on item level generate semi random stats
        Randomly select a sub_type based on weapon_type  //ex: Cannon
        Randomly select attributes based on item_quality //ex: Medium weight
        Randomly select a manifacturer based on its presence on the market //ex: Sbortec
        Apply the modifier given by the sub_type, attributes, item_quality and manifacturer
        Return WEAPON
    else if item_type == mechanical_part:
        Randomly select a body parts
        Based on item level generate semi random stats
        Based on weight generate a appropriate number of slots
        Based on proper stats choose if the slot are for weapon (what kind) or devices
        Randomly select attributes based on item_quality
        Randomly select a manifacturer based on its presence on the market
        Apply the modifier
        Return MECHANICAL_PART
    else
        Return OTHERSTUFF

All the item's attribute values are stored in a database. We need to structure this DB and insert some basic values.
  • item_level is an attribute of a specific item. We can base it on player's level or we can use a DB of raw items each of them with a item_level value. Greater is the item_level more powerfull is the item. Our goal, in generating items, is to provide items to the player appropriate for its level.
  • item_quality is a global attribute defined in a table, with a single row, where we express all the global attributes for the items. Ex: we have the table "global_value" where we store rare=285 common=1234, uncommon=689, unique/set=12. This value represent the frequency of these quality. A common item is generated with a probability of 1234/285+1234+689+12.
  • required_level and required_rank are attributes of a specific item. In order to use items the player has to match the right level and the right rank.
  • item_type: an item could be a weapon, a mechanical part or something else (other stuff). Each of these "item_type"s represent an item class so we have to define three item classes with the right attributes and values.
  • weapon_type is a subclass of the weapon class. weapon_type are Ballistic, Missiles, Melee or Laser.
  • sub_type is a subclass of the weapon_type class. Ex: we can generally speak of Ballistic weapon or we can talk specifically of cannons, gaussian weapons, shotguns and so on.
  • **manifacturer ** is a kind of data we have to store in a table DB. The manifacturer must have a value for his presence in the market. Furthermore, a manifacturer is characterized by some attributes that modifies the item's attributes. We must have manifacturers for weapons and manifacturer for mechanical parts.

The algorythm may be split in three different way. We can use the first part for weapons vendor, the second for mechanical part vendor and the third for other stuff vendor.
We have to define "other stuff"

Salvo diversa indicazione, il contenuto di questa pagina è sotto licenza Creative Commons Attribution-NonCommercial-NoDerivs 3.0 License