0 Favourites

Character Stats in a scalable/efficient form

  • Hi,

    I've been researching how best to create character "stats" in a game. From what I read, a dictionary was recommended and so I tried but came across an issue where, because everything is stored as a string, it wouldn't evaluate a number correctly. And I had to set it to and from a local variable before adding/taking from the dictionary.

    It would be a semi complex stat system, where there is base stats (str, int, agi, etc) and skill stats (unarmed, gun, bow, etc) which can be manipulated (by a character adding points) along with other stats which aren't directly manipulated but do change depending on other stats (HP, evade, etc).

    There would be multiple game levels and multiple save/load slots. It would also be nice if I could use these stats externally (future thinking) via AJAX/JSON. I may also change the formulas and add/remove/change stats as I work on the game (if that bears any significance).

    Is a dictionary my best bet? (vs arrays, or something else?) If so, what would be the best way to implement this system?

    On load could I transfer all dict keys/vars to instanced variables or global or something? Instanced/Globals I find are easier to work with than dictionaries, but they're also a bit messier than dictionaries.

    I'm also thinking inventory/progress would probably be tracked in a similar way.

    If anyone has any advice, or would like to tell me how they implemented a system like this themselves, I would very much appreciate it.

    Thanks.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • I'd use an array for this, maybe even put it in a container with the character..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)