Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Released] STATINATOR - Generic character stats back-end system

Discussion in 'Assets and Asset Store' started by LaneFox, Jul 16, 2017.

  1. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462

    STATINATOR is a backend stats system for your game characters.

    Want character stats but don't want to buy an RPG kit? Well here's your magic sauce right here, bring this asset into your project, implement the IUseStats interface on your drab characters and watch them explode with Stat driven awesomeness.

    You can expect STATINATOR to do all the hard work of calculating the current Stat data and self managing all the weird StatModifier's you throw around in your game, but you will have to actually do some work and implement any special Modifiers or methods that use your stats in your game like Damage, Leveling up, calculating damage against other stats - for instance if you throw a potato at Steve you'll need to check PotatoResistance stat to see how much real damage from the Potato he will take.


    1b8d38e5-12dc-47ca-94b2-9aa41f147abc.jpg

    STATINATOR uses ScriptableObject's for StatPresets and StatModifiers and that makes it easy as pie for you to do all the stat goodness you need to in your game.

    Don't be scared. Embrace the Stats. Be one with the Stats.

    Download the Documentation you probably don't need.​
     
    Last edited: Jun 17, 2020
    TeagansDad and AGregori like this.
  2. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Live!
     
  3. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Yup, found this thread about an hour ago due to seeing the product in the store. ;)

    Is this part of Deftly, broken out?
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    It's part of the big upgrade coming. I'm modularizing it into separate products and Deftly II will have all of them.

    This is the initial release, as I make progress on the kit it'll be updated with new stuff and more features accordingly.
     
  5. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Free voucher codes!

    If you're interested in a free copy of STATINATOR and perhaps also want to swim through amazeballs stat calculating code to offer some honest feedback because free stuff is great then reply here!
     
  6. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Hey LaneFox, sounds interesting. I wouldn't mind checking it out!
     
  7. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Looks great, I’m interested :)
     
  8. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    PM's sent! Let me know!
     
  9. TeagansDad

    TeagansDad

    Joined:
    Nov 17, 2012
    Posts:
    957
    I'm interested in giving it a try as well!
     
  10. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Sent! Let me know what you think! =)
     
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    @LaneFox - If I don't want to use levels as a means of raising stats in my game, I assume I can just leave "Level" at 0.

    Then, when I want functions in the game to adjust stats, sometimes I'll want them to be permanent (adjusted from base on character creation), sometimes toggled on/off, and other times temporary (expiring after a time). Does this cover those scenarios?
     
  12. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Yes, regulated stats (STR/DEX/END) are auto-scaled by the Level stat which you can certainly leave at zero (or one?). Unregulated stats (HP, LVL, XP) are not scaled by level. The noted stats are just examples, all of this is adjustable by you. STR could easily be an unregulated stat like HP or vice versa.

    You could, for example, level up and award "points" to a character and create a UI to assign those points to stats - basically just increasing their Root value.

    You can change the root value of a stat when you want to permanently increase it. It will be constrained by the Min/Max property of that stat. If you want no min/max, just set them to unreachable values (-9999 and 9999, for example).

    Stats Modifiers can infer semi-permanent adjustments to any Stat. You can create Stat Modifiers on the fly via code or use premade ScriptableObject's of them. They can be on a timer, or be endless. They can also be removed later very easily if you needed to.
     
    Last edited: Aug 11, 2017
  13. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,676
    Sounds great! :)

    Okay, rather than leave the level at 0 (or 1?), I can have all of my stats be unregulated, so they don't get scaled. I like that.

    I'll use the level instead to give points, which is indeed what I want to do (basically, 1 level = 1 skill point).

    I think I'll avoid changing root values. I don't see where it would cause problems, but it just sounds like bad form. Probably it is best for me to have all modified values be handled by stat modifiers, so that potentially any modifier could get negated at some point in the game. If the mods can be endless in duration, it sounds like that would work well for the permanent type of modifier.

    I guess the toggling type function is really just equipping and un-equipping a mod that has endless duration. So I'll do that.

    I like the idea of using SOs, so I'll definitely be going down that path.

    Thanks! :D
     
  14. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    v1.1 update is in the pipe.
    • Moved some code and files around to separate Core and Example content better. This also clarifies what you should edit versus what you should avoid editing.
    • Updated the demo scene. Added some effects to give slightly more feedback and easy to see when you do something and stats update.
    • Included Shared content folder. This is a bunch of shared stuff between the Cleverous product suite which other products will be using - materials/textures/ui and stuff to keep the demo scenes consistent.
    CropperCapture[1].jpg CropperCapture[2].jpg
     
    digiross and hopeful like this.
  15. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
  16. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    41
    This asset looks interesting - I have a few questions.

    Does Statinator let me drain and restore stats? For example, this would let stats decrease, such a 'restore' action would add to the stat again, but never over and above the amount drained. Such as healing HP, rather than increasing the max HP.

    Does statinator let me create stat modifiers that would be % of the max amount. I.e. a Spell that heals 35% of your max HP, not 35% of the current HP value.

    Does statinator have support for stats modifiers boosting a stat by a random value (such a dice-roll), or must all values be hard-coded?

    If these functions would require me to modify/extend the existing code, is there way to try before I buy, to see if the code is well structured and readable etc?
     
  17. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Statinator doesn't have implemention for specific stuff like dice rolls. It's a tool for a back end character stat system that makes it easy and safe to do 'things' to character stats. Things might be modifiers which are an included convenience to do abstract things to stats or you can affect them in any way by directly changing values on your own code. Depending on what you need, you'll write the formulas to adjust the stats and statinator will regulate the results and keep it all from breaking. The included example does both and working with the code is very straightforward.

    You can download the documentation via the link in the OP, I think that will answer most of your questions. Can you check it out and let me know if it's still unclear?
     
  18. Silverlode

    Silverlode

    Joined:
    Apr 9, 2013
    Posts:
    41
    The documentation helps somewhat. I'm still unclear how cleanly I could add drain/restore functionality to stats.

    Assuming my code would need to keep track of a drain value and ensure no stat was restored more than it had been previously drained, what would be involved:

    • Modifying a core statinator class and ever afterwards manually avoid overwriting this when updating the statinator asset from the asset store?
    • Adding to a core class helpfully marked as partial?
    • Inheriting from a core class and saving in a folder outside tr statinator asset folder. Would this be compatible with statinator editors/viewers?
    • Having an additional drainable class which handles that type of stat modification and sync up pairs of objects to represent a stat's final value which considers if it's been drained? (Sounds horrible)
    • Writing an implementation of iStatCalculation which handles drain/restore and referencing this class when creating new stat objects which must support being drained
    Any pointers on the implications for adding new stat calculation methods given the way Statinator is design would be appreciated.
     
  19. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    The example scene has Health Regeneration, and the code looks like this:

    Code (csharp):
    1.             // Use a stat to Regen Health
    2.             Stats[(int)StatType.Health]
    3.                 .AddToRoot(StatProperty.Value,
    4.                 Stats[(int)StatType.RegenHp].Get(StatProperty.Value) * Time.deltaTime);
    Here it uses the RegenHp stat to restore the Health stat over time in the character's Update loop. You don't need to worry about clamping, just apply the effect and the Stats class will make sure it is handled within the correct constraints.

    Because of the structure of the tool I would not recommend putting Drain/Restore functionality into the Stats classes directly. Rather, I would suggest putting that functionality into what is causing the drain, like a spell or effects system that attaches to the character separately and affects the Stats independently. However, the code to actually do the drain/restore is pretty simple, as you can see. This is an architectural choice, and may not be what you prefer.

    If you were to extend the Stat's classes then they are virtual classes and not partial, so you could do something like import the asset, inherit a couple of classes and start using those in your game code so when you update the tool it won't break anything. Otherwise, check out the core code and see if the approach is something you might want to adopt and maybe you won't even want to make those inherited classes.

    The included StatModifiers are things like flat adjustments to a Stat for a period of time. They look like this:

    CropperCapture[3].jpg

    Stat Modifiers aren't what you want for Drain/DoT type effects.

    Internally when this is applied to a Stat the Stat itself will consider all of the StatModifiers attached to it and calculate the True stat values. It calculates Root values + Modifiers to get True stat values, so Root is preserved and the modifier values are the attached to each stat individually. This allows you to access either Root or True values in your, say, Effect or Drain class and gives you flexibility in how you want those affects to behave.

    The enums look like this:
    Code (csharp):
    1.     public enum StatProperty { Value, Base, Min, Max, Affinity, MaxAffinity }
    2.     public enum StatModType { Active, Direct }
    3.     public enum StatModEffect { Add, Multiply }
    So, I think this helps clarify your question. Essentially the architecture is such that you want to talk to the Stats and build stuff like Drain/Restore independent of the Stats class itself.
     
    Last edited: Feb 19, 2018
  20. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
    You know Ork framework's status value curve generation? I want to have that functionality
    Is it possible?
     
  21. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Not familiar with this, can you post an example?
     
  22. Cartoon-Mania

    Cartoon-Mania

    Joined:
    Mar 23, 2015
    Posts:
    320
  23. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
  24. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Now free!
     
    darknubis365, hopeful and TonyLi like this.
  25. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462
    Statinator will be getting an update! It's part of the Hydrogue product suite and will be updated to work as a module with all of the other products that will be included in the suite!

    Check out the Hydrogue progress thread for more.
     
  26. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,462