Behind the Scenes Polishing

Status
Not open for further replies.

Ragpuppy87

Veteran
Veteran
Joined
Apr 17, 2019
Messages
308
Reaction score
245
First Language
English
Primarily Uses
RMMV
I'm currently approaching the end of development for my first RPG Maker project.
It's a ways off but still but close enough that I wanted to ask this question.

Being my first project it is full of unnecessary switches and variables. Things I started to put in but eventually
cut out. Instances where I found a solution other than a switch or a variable, but never deleted it. I know that
this takes up unnecessary space and can potentially affect performance.

I know that there is a menu to bring up the status of switches and values of variables. I'm wondering if there is also a way
to see if that switch/variable has even been used in game . A switch might say OFF or a variable might be set at 0, but it could
still have been used at a certain point. I have of course named all of them, but there are quite a few that are very similar in name and function.

Is there a simpler way than just individually going back through every single event to see if it has been used?
Or am I in for a long tedious clean up process?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
I know that
this takes up unnecessary space
This is true but
can potentially affect performance.
this is most likely false. An unused variable is equal to 0 (which is a Fixnum in ruby). Even if you had around a hundred unused ones, they will still have little or no impact at all on the memory usage (the total space they take is still less than 10KB). On top of it, as long as they are unused, they do not require updates so they have no impact on performance as well. In VX Ace you have direct access to variables (T(N) = O(1)); it does not matter how many variables you have, you can still find the required one in the same amount of time. The same goes for switches.

Just think of how much space a single image takes into memory: a single image can take the same space as thousands of Fixnum instances.

Or am I in for a long tedious clean up process?
It is a very long and tedious process indeed. Let me explain with an example: if you have 100 variables and you did not use the ones from 40 to 80, you can reduce the number of variables from 100 to 60. However, this also means that the maximum ID for your variables is going to be 60. What happens to all those variables with ID greater than 60 (in my example those from 81 to 100)?

The answer is simple: you have to check your whole game and change your events so that whenever they use a variable whose ID is greater than 80, it uses a different variable instead.

Long story short: do not waste time doing that. It is not worth the effort if we talk about memory consumption, even less if we talk about performance.
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,254
Reaction score
1,254
First Language
Spanish
Primarily Uses
RMVXA
you *could* (maybe, very *theoretically*) run a function to scan every single event in every single map, and tally up the calls to variables and switches.

they are printable to a file, and the events are readable in plain code form (as long as you don't have any non-editor-based events, AKA code-based events, that wouldn't be saved in each map).... the issue would be, what to do with the amount of data collected, and how to read it.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
you *could* (maybe, very *theoretically*) run a function to scan every single event in every single map, and tally up the calls to variables and switches.
Yes, this approach is similar to the mark & sweep one that ruby uses to handle your memory. However, more than handling the information, the problem lies with editing every single event after finding which variable is unused, and even once that much is done, it would still have 0 effect on performance and a very limited effect on memory usage.

they are printable to a file, and the events are readable in plain code form (as long as you don't have any non-editor-based events, AKA code-based events, that wouldn't be saved in each map).... the issue would be, what to do with the amount of data collected, and how to read it.
You could theoretically check code-based events as well. Ruby is an interpreted language, if you do not call the eval method on script calls, they are just simple strings. You can use a Regex to store every variable and switch ID used in a script call, and you can theoretically do the same for scripts.

If the OP wants to do it, this is the way to go. Scan every event in every map with a function and print all the unused switches/variables ID on a file. You could write the function in a way that it prints the upper and lower limits of a batch of IDs if it finds contiguous unused variables, effectively increasing the readability of the said file. But once again...it takes a few hours to write something like this, and it has no effect on performance. I definitely think it is not worth the effort.
 

Ragpuppy87

Veteran
Veteran
Joined
Apr 17, 2019
Messages
308
Reaction score
245
First Language
English
Primarily Uses
RMMV
Thank you everyone for your input.
I will admit a lot of that did completely fly over my head.:dizzy:

What I did take away however, is that the unused switches and variables don't have as much of an effect as I thought they would.
So thank you for potentially saving me hours of unnecessary work.:cutesmile:

This thread can now be closed due to the issue being resolved.
Thanks again.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
@Ragpuppy87 To Report a thread for closing you have to use the button 'Report' at the bottom of your post.
Thanks

[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top