Optimizing RPG variables

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • So... I have seen a few people trying to make an RPG, and that made me start to wonder, "Where is everything stored?"

    So, like I just said, if I were to start on such a massive project, where would I even begin to store all those player vitals, stats, inventory, progress

    What are fine as instance variables? global variables? What are better off in a text file, array, XML, hash table, instance, etc.?

    This isn't exactly my focus at the moment as I am not working on an RPG, but I would like to hold the information in a back pocket of sorts.

    Heck, even if I am not working on an RPG, some elements may be useful for my project.

    I feel like I may be asking a very broad question, so for anyone that can take the time to answer, thank you in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've been kind of thinking of the whole RPG element system. Anything that you want saved for a specific character, I would use as an instance variable for that sprite.

    And anything that would be used multiple times at different layouts/maps, you would set that as a global variable.

    By this, you would have multiple variables on one sprite, such as MaxHP, CurrentHP, MaxAtkDmg, etc.

    Lets say you want multiplayer, you would want to use a global variable to kill slimes, so that if different players kills a slime almost at the same time, it would increment the same global variable. Its generally how you want to design it.

    I don't know how the code is optimized in scirra, but an instance variable would be faster to use than a global variable in most cases.

    I hope i am making sense, but that is what i came up with after dabbling in construct 2 for awhile.

  • I would personally use a dictionary to store them. Its very easy to work with, meaning to get what you need, to store new stuff, update delete etc. And you don't have so many Global variables. Other than that you could also just make a "variable" holder. Like a small sprite and just add everything to it, and just make it global.

  • I don't know how the code is optimized in scirra, but an instance variable would be faster to use than a global variable in most cases.

    I hope i am making sense, but that is what i came up with after dabbling in construct 2 for awhile.

    Where did you hear that ?

    An instance variable is relatively heavier because it is stored for each instances of an object , and a global one is only stored once

    Anyways , check out arrays

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