Nixxi
Member
I'm playing around with a script that generates 100 items based on a pair of nested loops and switches that fill a 2D array with strings for item names, and writing those names along with data to define the characteristics of those items to an INI file - just to see if I can generate a list of gear similar to how Diablo 3 creates loot with a combination of random stats and expected rules. Each item in the INI file looks something like this when it's output:
[ITEM_VARIANT0 ITEM_NAME0]
StatN0 = 1.5
StatV1 = 2.6
[ITEM_VARIANT1 ITEM_NAME0]
StatN0 = 0.4
StatV1 = 4.5
[ITEM_VARIANT2 ITEM_NAME0]
StatN0 = 3.3
StatV1 = 3.0
[ITEM_VARIANT0 ITEM_NAME1]
StatN0 = 1.0
StatV1 = 0.9
[ITEM_VARIANT1 ITEM_NAME1]
StatN0 = 2.5
StatV1 = 2.3
[ITEM_VARIANT2 ITEM_NAME1]
StatN0 = 1.1
StatV1 = 1.8
...
I'm sure the more advanced users can already see where I'm going with this. The "ITEM_VARIANT0" is the index for the 2D array and is the "Firey/Icy/Weak/Powerful/Normal/Enchanted/Whatever" variant of an item (including a signature stat that accompanies the variant name), and every 10th listing in the index is the start of a new item type like "Belt/Boots/Hat/Sword/Fruit/Etc." with a base stat that is expected for the item type. The level requirements and stat values are augmented by multipliers based on the player's level when he/she earns them, and quality of the item is a random chance to receive anything from "poor" to "legendary".
This is of course going to be very unwieldy and difficult to manage over time as the list gets bigger and changes need to be made for balance. It's not very flexible or scalable, and I'm wondering if there is a much better solution for managing data-driven content. I really don't want an INI file (regardless of whether or not it's incripted) to be the go-to source for the game to look up and apply values for items to player loadouts. Is there a better way to manage this data beyond 2D/3D arrays and data structures like ds_grid? Anything that gets me closer to generating loot similar to Diablo 3 or Destiny would be fantastic.
[ITEM_VARIANT0 ITEM_NAME0]
StatN0 = 1.5
StatV1 = 2.6
[ITEM_VARIANT1 ITEM_NAME0]
StatN0 = 0.4
StatV1 = 4.5
[ITEM_VARIANT2 ITEM_NAME0]
StatN0 = 3.3
StatV1 = 3.0
[ITEM_VARIANT0 ITEM_NAME1]
StatN0 = 1.0
StatV1 = 0.9
[ITEM_VARIANT1 ITEM_NAME1]
StatN0 = 2.5
StatV1 = 2.3
[ITEM_VARIANT2 ITEM_NAME1]
StatN0 = 1.1
StatV1 = 1.8
...
I'm sure the more advanced users can already see where I'm going with this. The "ITEM_VARIANT0" is the index for the 2D array and is the "Firey/Icy/Weak/Powerful/Normal/Enchanted/Whatever" variant of an item (including a signature stat that accompanies the variant name), and every 10th listing in the index is the start of a new item type like "Belt/Boots/Hat/Sword/Fruit/Etc." with a base stat that is expected for the item type. The level requirements and stat values are augmented by multipliers based on the player's level when he/she earns them, and quality of the item is a random chance to receive anything from "poor" to "legendary".
This is of course going to be very unwieldy and difficult to manage over time as the list gets bigger and changes need to be made for balance. It's not very flexible or scalable, and I'm wondering if there is a much better solution for managing data-driven content. I really don't want an INI file (regardless of whether or not it's incripted) to be the go-to source for the game to look up and apply values for items to player loadouts. Is there a better way to manage this data beyond 2D/3D arrays and data structures like ds_grid? Anything that gets me closer to generating loot similar to Diablo 3 or Destiny would be fantastic.