After trying several ways of coding generic way of creating Ability blueprints, or to speak more generic way, of creating generic classes and functionality for Blueprints I have several findings:
Good example for point 2 is something I did recently and now just revised it, because it could be potential bottleneck and also added unnecessary complexity. Effects that modify other effects before the other effects are applied to target.
Purpose of that was to create modifier effects like Spell Damage, Fire Damage, Physical Damage etc. These effects would the modify upcoming effects (like Damage Pure) and change the attribute it modify according modifier effect.
For example Spell Damage can amplify damage of Spell by attribute SpellDamage and Intelligence, but damage will also be reduced by target Spell Resistance.
This can be chained with Fire Damage. So for example damage could be further amplified by Fire Damage Attribute, and reduced by Fire Damage Resistance. So in the end you could have Fire Spell Damage effect. It might now be what you want, but in that case you might create modifier effect better suited to your needs.
My other solution was to just create Damage Effects that will cover all possible combinations of damage types calculations. In that. It is still not ideal solution because it might create very big clutter of blueprint classes in content. Though it bit better in terms of performance, because create object only once, instead of 2 or more times.
Solution I though I try to day is completely specific for game, at least in terms of coding in C++. I just created static Blueprint Function Library. Each function in that library covers single case of damage calculation. Just like modifier effect, just without objects (;. Functions can be chained in any way you might wish.
These functions are fairly easy to create, you really don't need to be master of coding to make them on your own. You just need to understand basics of programming. I say if you use blueprints, with bit of effort you should be able to handle it.
The solution have two disadvantages:
From that point on I will just create two sets of functionality. If something can be generic I just add it to RPGSystem and something can be easier used as game specific I will add it to Game. I will try to keep game specific functionality as simple as possible. More like simple template that can be used as starting point, than fully fledged solution, that will be hard to modify and understand.
- Creating generic functionality have it place and is certainly possible for Blueprints. Like in my case generic way of creating effects, applying them to actors or in some cases modifying other effects by effects (like spreading effect in Area).
- But in most cases while it is somewhat possible, it create very awkward to use solutions. Or very complex ones. Or very inefficient ones, because you have to account for things you can predict that might be or might not be in the game.
I say, save yourself troubles, and if you want to expose as much as functionality to blueprint as possible, just make it specific for your game, which will account for you game specific functionality. With a little bit of planning most of it could be reused without much changes in other games from the same genre.
Good example for point 2 is something I did recently and now just revised it, because it could be potential bottleneck and also added unnecessary complexity. Effects that modify other effects before the other effects are applied to target.
Purpose of that was to create modifier effects like Spell Damage, Fire Damage, Physical Damage etc. These effects would the modify upcoming effects (like Damage Pure) and change the attribute it modify according modifier effect.
For example Spell Damage can amplify damage of Spell by attribute SpellDamage and Intelligence, but damage will also be reduced by target Spell Resistance.
This can be chained with Fire Damage. So for example damage could be further amplified by Fire Damage Attribute, and reduced by Fire Damage Resistance. So in the end you could have Fire Spell Damage effect. It might now be what you want, but in that case you might create modifier effect better suited to your needs.
My other solution was to just create Damage Effects that will cover all possible combinations of damage types calculations. In that. It is still not ideal solution because it might create very big clutter of blueprint classes in content. Though it bit better in terms of performance, because create object only once, instead of 2 or more times.
Solution I though I try to day is completely specific for game, at least in terms of coding in C++. I just created static Blueprint Function Library. Each function in that library covers single case of damage calculation. Just like modifier effect, just without objects (;. Functions can be chained in any way you might wish.
These functions are fairly easy to create, you really don't need to be master of coding to make them on your own. You just need to understand basics of programming. I say if you use blueprints, with bit of effort you should be able to handle it.
The solution have two disadvantages:
- You must create new C++ function if you want, to add new possible formula for damage calculations. In theory you can also create Blueprint Function Library in editor using blueprints. But honestly you will loose perfomance, on something that is used very often, and it is not that hard to code.
- It's not generic. It's specific for your game. But Modifier Objects are also specific to your game. So does it really matter ? I say no.
From that point on I will just create two sets of functionality. If something can be generic I just add it to RPGSystem and something can be easier used as game specific I will add it to Game. I will try to keep game specific functionality as simple as possible. More like simple template that can be used as starting point, than fully fledged solution, that will be hard to modify and understand.