• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Game Mechanics Advanced Item / Skill / Attribute System

P

Pepasone

Guest
I'm curious to see what others are thoughts are on how to handle a system like this.

I already have a very in depth RPG system built in-engine; Base Player Stats, Class Based Stats, Attribute Point System, Equipment System (with up to 100+ stats on each item), Socket/Gem System, Item Enchant System, Item Leveling, Inventory / Equipment Window / Item Upgrade via Useables

For instance, my player has well over 100 possible stat modifiers right now. Simple things like Health to more complicated stats like Elite Damage / Gold Find / Drop Rates, etc...

Item information is traded via grid sections. Scripts update the player stats based on taken actions; Socketing a Gem, Leveling up, Equipping / Swapping Gear, etc...

I'm getting ready to build traditional RPG equipment "sets." As part of a set engine, we would need to track a few pieces of information, outlined below:

  • Set ID
  • Item Set ID
  • If the item in the given set is equipped
  • Set Name (could also just be the ID if passed as a string)
  • Set 2/3/4/5/6 piece bonus "text"
  • Set 2/3/4/5/6 piece bonus "stat"
Passing the stat bonus is the piece I'm most interested in thoughts on. Passing flat stats is quite simple. i.e: +5 Attack, 25 HP, etc.... (no issues here)

I'm more interested to learn from you, how you would pass and take advantage of bonuses that have both real and string values:

"2 Piece Bonus: Deal 10% additional Fire and Ice Damage on Attack"

I'm NOT worried about "on Attack." I'm only concerned with how others would create a system in which you can pass both flat values and string values to translate to stat increases or effects that can happen during proc events.
 

NightFrost

Member
If I were to code an effect system, strings would only be for player convenience, so they know what the effect does other than observing results. Beyond that, the effects would exist as some sort of structured data. Player's active effects would be tracked in a list, and possibly subcategorized through types so they can be sorted through more quickly. For example, some would be of type "on attack" and checked only when resolved action is player attack, otherwise skipped. The effect details I'd probably do by dividing into conditions and effects. In your example there would be two conditions of "attack element is fire" and "attack element is ice", the effect would be "10% damage bonus". Types, conditons and effects would be defined as enumerators. (Well, with GMS update 2.3 one could also use structs to define their data, but right now I'd probably go with enums as I'd know how to do that quicker.)
 
P

Pepasone

Guest
If I were to code an effect system, strings would only be for player convenience, so they know what the effect does other than observing results. Beyond that, the effects would exist as some sort of structured data. Player's active effects would be tracked in a list, and possibly subcategorized through types so they can be sorted through more quickly. For example, some would be of type "on attack" and checked only when resolved action is player attack, otherwise skipped. The effect details I'd probably do by dividing into conditions and effects. In your example there would be two conditions of "attack element is fire" and "attack element is ice", the effect would be "10% damage bonus". Types, conditons and effects would be defined as enumerators. (Well, with GMS update 2.3 one could also use structs to define their data, but right now I'd probably go with enums as I'd know how to do that quicker.)
This was really good feedback. Especially your idea about having a list for each proc event. This will make determining my payload of each event much quicker and easier to track. Thanks so much!
 

Yal

šŸ§ *penguin noises*
GMC Elder
If your system lets you pass array effects, you can use that to make arbitrarily complex effects. Make an array which in turn contains zero or more arrays with a [conditionType, conditionValue, effectType, effectValue] tuple of data in them. For instance, "10% damage bonus to fire and ice attacks" corresponds to [[AttackElement, elementFire, AttackPowerBoost, +10], [AttackElement, elementIce, AttackPowerBoost, +10]] data in the set bonus field. Add these to a big list of all player bonuses when equipping, and remove the first match when unequipping. Then wherever applicable in your code, you check if the player currently has any applicable bonuses in that big list, and perform the necessary changes (e.g. when attacking, check for AttackPowerBoost bonuses, and if there's any, check if their conditions hold - in this case, whether the attack's element matches the conditionValue, since conditionType is AttackElement.
 

YanBG

Member
I'd have both attack% and attack value item stats. Btw are you using external file like csv? I do that and having 100+ columns is a lot to read!
 
P

Pepasone

Guest
If your system lets you pass array effects, you can use that to make arbitrarily complex effects. Make an array which in turn contains zero or more arrays with a [conditionType, conditionValue, effectType, effectValue] tuple of data in them. For instance, "10% damage bonus to fire and ice attacks" corresponds to [[AttackElement, elementFire, AttackPowerBoost, +10], [AttackElement, elementIce, AttackPowerBoost, +10]] data in the set bonus field. Add these to a big list of all player bonuses when equipping, and remove the first match when unequipping. Then wherever applicable in your code, you check if the player currently has any applicable bonuses in that big list, and perform the necessary changes (e.g. when attacking, check for AttackPowerBoost bonuses, and if there's any, check if their conditions hold - in this case, whether the attack's element matches the conditionValue, since conditionType is AttackElement.
This is what I'm going with. Essentially for the different events that occur in battle, there is going to be an associated list. When the user performs and "On Attack" action for instance, it will check list size to see if any values exist, if so, it will iterate through and apply those affects.
 
P

Pepasone

Guest
I'd have both attack% and attack value item stats. Btw are you using external file like csv? I do that and having 100+ columns is a lot to read!
I do have % and flat stats already. I'm not using any external files. Stats are generated on items. When they are equipped, they are passed to the player. Inventory is a grid where each column is an item. All item stats are stored in a 2x110 grid, where the first column is the reference grid and the 2nd column is the value held. When passing stats between inventory and equip window. It simply copies column 2 of the item grid into the slot column in the inventory / equip window grid.

When items are equipped, it scans through column two of the item grid and passes the reference value from column one to the player to update.

ie: I equip a sword with 3% attack, 15 attack, 2 str and 1% critical chance. It passes "item_attack_physical","item_attack_physical_percent", "item_str", and "item_chc" to the player and says, update these stat totals.
 
P

Pepasone

Guest
Actually I use a reference column in all my grids so I can use "ds_grid_value_y" and pass along the stat reference to always accurately look up the correct values when updating different systems.
 

YanBG

Member
Yes i load my csv into a grid, similar to your column but each item is a line. I like your setup with the string/description ID. I have the stats named at the top line of the csv but it's not used in game, just hardcoded position(e.g. 2nd for hp)

My issue is that so many stat entries makes the file big and difficult to read later, in RPG i'll have a lot of balancing to do. Some devs split the items into a few files but it will take longer to open and close. One option is a tool or in-game editor, idk if you modded games like DIablo but there are character editing tools. All this is only about readability not coding or mechanics though :D
 
Last edited:
Top