What I'm wondering is if the amount of how many variables I have matters and the more I have the (much - even with empty variables) bigger the game will get and the performance will drop, or does it not change anything?
Do more variables in the data put pressure on the game optimization?
RPG Maker MZ SupportIf you just have a bunch of variables you declared once and did nothing with them I don't see how it would have any effect on performance.
It might marginally increase the filesize by a few bits.
It might marginally increase the filesize by a few bits.
All I've noticed is it increases the file size. Though in editor I've heard of some slowdowns loading your database if you got waaaaaaaaaaaay too many (like near the maximum of the editor), though that might be a fringe case based on PC specs.
TLDR answer: no.
why? because in modern systems, most of the data load will be graphics rather than plain numbers.
even if you load the entire database to it's full capacity with data, it will still pale in comparison to the lot of assets per individual object, to their lowest resolution.
....unless you over-optimize everything to use the smallest print possible, which is nearly impossible.
where you will suffer, is when comparing sets of variables or objects, if you go through loops that are not optimized.
when comparing big arrays, use the built-in methods for those objects, things like sort, reverse, split, inject, etc, not loops.
why? because in modern systems, most of the data load will be graphics rather than plain numbers.
even if you load the entire database to it's full capacity with data, it will still pale in comparison to the lot of assets per individual object, to their lowest resolution.
....unless you over-optimize everything to use the smallest print possible, which is nearly impossible.
where you will suffer, is when comparing sets of variables or objects, if you go through loops that are not optimized.
when comparing big arrays, use the built-in methods for those objects, things like sort, reverse, split, inject, etc, not loops.
The only thing that matters is that you don't accidentally update a Switch or Variable 60 times in a second. Any update in a Switch or Variable causes a whole map refresh.
I once had a Switch operation in a parallel process that only tracked whether the player is riding the airship, but because I didn't have a wait command, the map was refreshed 60 times in a second - that decreased by FPS noticeably.
I once had a Switch operation in a parallel process that only tracked whether the player is riding the airship, but because I didn't have a wait command, the map was refreshed 60 times in a second - that decreased by FPS noticeably.
I noticed the games (MV) get lag when I have a huge database. This means hundreds of actors, or 1000+ of weapons/armor/enemies. Even if many of them are blanco and unused.
I tried things like: All helmets are 1 till 500, and chests were 501 till 1000, and shields were 1001 till 1500... Even if I had only 10 helms and 15 chests or somethings. Yeah, that was a bad idea.
For variables and switches, I've worked with 100's and 100's of variables without any issue. Even if those variables were storing large formula's or arrays with Kb's worth of info per variable. Only, saving and loading saved games might get slower, but than I am talking about 0.2 or 0.3 second or so... Noticeable, but if you only save in the menu (not automatically when walking or something) then it should be acceptable. Saving taking a brief moment is expected.
Note: This is all on an outdated computer. The better the PC of the player, the less problems you will encounter.
I tried things like: All helmets are 1 till 500, and chests were 501 till 1000, and shields were 1001 till 1500... Even if I had only 10 helms and 15 chests or somethings. Yeah, that was a bad idea.
For variables and switches, I've worked with 100's and 100's of variables without any issue. Even if those variables were storing large formula's or arrays with Kb's worth of info per variable. Only, saving and loading saved games might get slower, but than I am talking about 0.2 or 0.3 second or so... Noticeable, but if you only save in the menu (not automatically when walking or something) then it should be acceptable. Saving taking a brief moment is expected.
Note: This is all on an outdated computer. The better the PC of the player, the less problems you will encounter.
Original thread: https://forums.rpgmakerweb.com/threads/do-more-variables-in-the-data-put-pressure-on-the-game-optimization.175110/