07-03-2024, 05:10 PM
(07-01-2024, 10:41 PM)Steel Beast 6Beets Wrote: I see.Not necessarily.
It seems my main project is simply too big and that's causing the memory usage spike. My other projects only use half as much.
If there is a memory usage spike, it would suggest that (perhaps) a script in use was not 'optimized'. For an example, consider HUD or menu windows. You do not wish to have the screen refresh on every instance/frame that occurs as that would cause lag and a necessary spike. For HUDs that I craft, I prefer to run a timer to update the window every 1/2 a second or so... and even then, I run a test to see if the HUD's data had changed.
Insofar as maps, perhaps it is the tileset(s) in question. As I said, the larger the file, the more memory is used. Loading a tileset with 5000 tiles (yes, they exist) for a map of 100x100 tiles would use more memory than a typical tileset with 50-100 tiles for even a large 500x500 map. And setting up a graphically beautiful parallax map for a large expansive map, likely more.
So I figure that you need to examine or re-examine what is in play.
Meanwhile, I've been a little busy. There have been a number of scripts that let the player spend 'points' to improve their stats. Gain 5 points, you may be able to improve your hero's HP, SP, Strength, Dexterity and Intelligence. OR you may shove all five points into Agility. But they never considered one thing... What if you were suddenly reduced a level? Should not the bonuses you gained for leveling up not also be lost with that level?
The above screenshots shows that I actually solved this. Each actor has a hash array for their individual stats and the bonuses gained for each level. Once you gain a new level, the hash array immediately grows. Once you add the points to your stats, the hash array updates with the new values. And if you lose a level or two, the hash array reduces in size.
I am developing this as two separate scripts. The first script for the mechanics of calculating your hero's underlying spendable points when a level is gained, or the erasure of past gained points if the hero's level drops. And the second script is the mechanics of actively spending the points gained, within the Status Menu in this instance. Clunky right now, but designed to be customizable.
A third script is in my noggin, allowing an event (like a trainer or holy rabbit statue) to bring up a stylized menu solely for stat increasing. And this menu could possibly be triggered upon actual level upgrade. But I have some things to consider. I have a means to merely add points by way of a script command, but I wish to ensure that you may only access these menus once you have actually leveled and not before.
And the manner of the system's design should allow one to 'add' their own stats to upgrade, whether it be "TP", "Stamina", or "Charisma". Being able to add custom stats with ease is one of the facets of which I had been concerned.