Coh3n
2011-03-14 16:16:41
From later in the thread.. Seems to be a good direction to head right now.
Now that MSI is, well, huge, we have A LOT of global arrays that hold objects/items/locations/whatever in memory, 90% of which aren't used. In my opinion, this is bad as it uses a lot of unnecessary resources. If a user is autoing with one player with one script, why load every other script as well? No point really.
So what I was thinking (Nava suggested it when I was looking into the memory leaking), why not set the global arrays when needed (i.e. in player setup). We'll load just the script/locations/items/whatever, for just that player, and unload them when the player is finished. This will make MSI use less resources when it's running (maybe get rid of some Simba crashing, I dunno), and decrease setup time (which really isn't a big deal, but we shouldn't have to wait 3-5 seconds for MSI to setup).
The only thing I'm not sure about is exactly how it will be set up. To make the transition as smooth as possible, we can still set the length of every array to the total amount of scripts/locations/etc., but only set the indexes that will be used. This way, there should be virtually no changes throughout the include.
The other option would be to set the length each time we switch players, which would require a lot more thinking and changes in the include, and as far as I know, empty indexes in an array take up virtually no memory, so I don't think it's a big deal.
What do you thik?
P.S. I think the most significant difference will be the DTMs in TItems, but if we're to do one array this way, we should do them all.
From: Coh3n
I don't remember if I said this already, but here's another direction. I think this is the easiest to do, most organized and easiest to understand.Again, can't remember if I said that already, I can't be bothered to check.
- Locations, items, objects, animations, etc. are loaded/unloaded in the functions their used. That way when none are being used, no extra memory/CPU is being used.
- Only scripts are loaded for each player, and the CurrentScript variable will serve more of a purpose. This way we have only that player's script loaded instead of all. Right now, that would be only one script until we have support for more.
- MSI_Scripts This may involve more work than other arrays simply because this array is what MSI is revolved around.
- MSI_Locations
- MSI_Items
- MSI_Spells
MSI_ObstaclesMSI_AnimationsMSI_MaterialsMSI_ObjectsMSI_Obstacles- MSI_Extras and Tracking need to remain global to work properly I think.
Now that MSI is, well, huge, we have A LOT of global arrays that hold objects/items/locations/whatever in memory, 90% of which aren't used. In my opinion, this is bad as it uses a lot of unnecessary resources. If a user is autoing with one player with one script, why load every other script as well? No point really.
So what I was thinking (Nava suggested it when I was looking into the memory leaking), why not set the global arrays when needed (i.e. in player setup). We'll load just the script/locations/items/whatever, for just that player, and unload them when the player is finished. This will make MSI use less resources when it's running (maybe get rid of some Simba crashing, I dunno), and decrease setup time (which really isn't a big deal, but we shouldn't have to wait 3-5 seconds for MSI to setup).
The only thing I'm not sure about is exactly how it will be set up. To make the transition as smooth as possible, we can still set the length of every array to the total amount of scripts/locations/etc., but only set the indexes that will be used. This way, there should be virtually no changes throughout the include.
The other option would be to set the length each time we switch players, which would require a lot more thinking and changes in the include, and as far as I know, empty indexes in an array take up virtually no memory, so I don't think it's a big deal.
What do you thik?
P.S. I think the most significant difference will be the DTMs in TItems, but if we're to do one array this way, we should do them all.