Ways of storing all possible variants of variables for a class

I am writing an RPG creator for an RPG tabletop game where each variable has an array of all possible values. Currently those variable arrays are stored as Global variables temporarily until I can think of a solution. For example the character 'lifepath' options (i.e possible character childhoods) is stored as a string array with the columns representing where the character comes from, and the rows the characters upbringing (Peasant, merchant family ect) the row number acts as an ID when the character creator stores the value.

The issue I have at the moment is that I don't want the computer to store all these arrays for every character created, as would be the case if left inside the character class object. Hence why these arrays are currently global variables until I figure out another approach.

Methods I am considering include just reading in from a text file containing all possible variables, though I would not now how to do this.

The approach I am actively looking at is storing them in another .cpp and/ header file, but not sure how to approach this.

Just thought of another approach after posting. Make a separate class to just store the variables. Make one of these variable objects and get the 2 classes to talk to each other. Would that work?

Any suggestions?

Last edited on
Was overthinking the problem.
Topic archived. No new replies allowed.