Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
14
First Language
English
Primarily Uses
RMMV
Is there a recommended limit to not exceed with the number of variables (and let's include switches as well) in your game? I've once read a user comment on someone else's game having 100+ variables as inefficient. I've been trying to be efficient with the number I use, but should I really try?

30 variables vs 300 variables for example. Would there be any difference in performance?

EDIT: Bonus question. Say I create 200 variables, but variables 100-130 are unused... can there be any impact on performance? Are those empty slots taking up any memory?
 
Last edited by a moderator:

Allinardo

Dungeon Crawler
Veteran
Joined
Jan 2, 2013
Messages
63
Reaction score
24
First Language
English
Primarily Uses
In my current project there are 500 variables. There really shouldn't be limits to these sorts of things. Having a lot of variables won't harm anything, and if there's any impact on performance...well, there just won't be really.

It all has to do with what you want to do with your game. Use as many as you see fit.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
6,114
Reaction score
5,887
First Language
English
Primarily Uses
RMVXA
Is there a recommended limit to not exceed with the number of variables (and let's include switches as well) in your game?

No.

I've once read a user comment on someone else's game having 100+ variables as inefficient. I've been trying to be efficient with the number I use, but should I really try?

No.  In fact, trying to re-use variables in order to "conserve" them is really risky, because you might have two different events trying to work with them at the same time, or you may fail to reset them properly.

30 variables vs 300 variables for example. Would there be any difference in performance?

No difference in performance whatsoever.

EDIT: Bonus question. Say I create 200 variables, but variables 100-130 are unused... can there be any impact on performance? Are those empty slots taking up any memory?

No difference in performance whatsoever.
 

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,737
First Language
English
Primarily Uses
N/A
   I mean, obviously you want to do things as efficiently as you can, but in this case efficiency is fairly subjective. For instance, say you use variables to create a custom encounter system or some such, where different events draw a random number as a variable and match it with a troop found on that map. Since only one of these instances will ever play out at once it would be silly to add a new variable to every new area/troops pool when you could just start each event by disposing of any previous data and continue to use a single variable for that function. On the other hand, say you have a camp/home base/fortress system in play and you want your party members to chat with you at said base and you use variables to progress those conversations, obviously each party member needs to have their own variable only controlled while advancing that characters conversations, far to easy to make mistakes and break things otherwise.


   Short answer- The question is too subjective to answer as is, and depends on what you are using said variables for. You can use 500 variables efficiently to the point you need every single one, but you could also use 5 variables very inefficiently and run into problems because of it, it's impossible to tell you which without knowing exactly what you are using them for and how you are using them.


   Generally speaking though you aren't going to lose performance by just declaring extra variables, so having a few redundant variables is probably a better alternative to accidentally using the same variable in two events that could be triggered at the same time as that's more where you're likely to run into problems.
 
Last edited by a moderator:

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
14
First Language
English
Primarily Uses
RMMV
Thank you everyone for the answers <3
 

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
453
Reaction score
180
First Language
Not English
Primarily Uses
N/A
The problem i faced when i make a lot of variables is when you want save it will take longer time, more variables you have longer time to save 
 
Last edited by a moderator:

Squirrelzone

Expert at being lazy
Veteran
Joined
Aug 13, 2016
Messages
51
Reaction score
2
First Language
English
Primarily Uses
IT DOESNT MATTER GUYS WHO CARES ABOUT SAVE TIME USE AS MANY VARIABLES AS NEEDED
 

Latest Threads

Latest Posts

Latest Profile Posts

i think this girl has to be my favorite though :)
62702017_JJKXazrs2LInoZh.png
Wouldn't you know it? Every woman that is interested in me on FB is a bot. Maybe I should respond with 000100100011. If u r willing to date women on FB something has definitely went wrong with your life.
woootbm wrote on TheAM-Dol's profile.
On your last stream you were talking about dev's who remake or remaster the same game rather than moving on. Does this happen a lot? Me and Tony were thinking of covering a game that did this. We're baffled by the idea and wanted to investigate the game.
...Damn it has been a hot minute since I was here. How y'all doing, how's life been?
Figured I would make some edits of the enemy art pack I use (Made by SeraphCircle) and I regret my decision xD

Wendigo.png

Forum statistics

Threads
129,743
Messages
1,204,763
Members
170,827
Latest member
YRR
Top