Help with organizing variables in RPG-style game


I’m relatively new to game design so there are a few big-picture things that I’ve been struggling with.

My main thing right now is that I’d like a better idea of which variables should be stored where. For instance, I want to make an RPG where depending on what you’ve done already, NPCs will say different things, cutscenes will trigger, different items will be offered in the shops, etc. I can imagine that somewhere down the line, I’ll end up having a ton of variables saying who I’ve talked to, what bosses I’ve beaten, what parts of the map I’ve unlocked and all these things will affect other parts of the game. I guess my question is: Is it normal to end up having tons and tons of variables that track your progress? If so, are there any recommended tutorials to help me categorize them and help me decide what actors they should be attached to? Should I be storing any in my level?

Thanks for any replies!

1 Like

There are a few ways to do it, but I keep most of the variables in the game instance and then just copy over the ones I need to save between log-out/log-in in a save game slot. Most of my stat formula are in there too. If you have a lot of data, then it’s worth taking some time to learn about tables, enums and structures to help organise things. You’ll want to split your data into smaller groups such as inventory items, weapons/gear, quest dialogue, etc to make it easier to handle later on. When you need to use the variables, just cast to the game instance to get the stored values to use in the level map blueprint (or whatever it is).

There are other ways of doing it depending on your specific game design/size. But the above is just the method I’ve sucessfully used so far. Organisation is key. I’m pretty OCD about keeping my data tidy, as when you are working with tens of thousands of variables (which an rpg can easily get to) you need to stay on top of that.

I’d recommend playing with a smaller project just to get your head around how different components fit/work together and to decide what structure you need for your game. Then apply that to your main project. It’s a bit more work up front, but will save you a ton of work in future. Restructuring a small project with a handful of variables is a lot easier than having to redo a big rpg!

Edit: Another useful set up task is to create a testing menu early on that you can quickly use to add/remove/check data in your game. It’ll save you time in the long-run.


Thank you so much for the reply! This has given me a really good starting point. I’m glad to hear that there are solutions for data organization, because it has definitely proved to be a bit overwhelming for a newbie like myself. I’ve used enums a little bit, but I’ll play around with them more, as well as research tables and structures.

No worries. It’s super basic, but also assign a category to any variables and/or functions you store in the game instance (or wherever else). I didn’t even notice it was there until several months in, but it helps to find things more quickly.