Bruce
Active member
Hello everyone,
First of all, sorry if any of these questions has been asked before.
My project is very critical in terms of OOM issues that I have been having.
I love having more sprites for smooth animations, but it looks like I can't do that in my high-res OpenBor game anymore.
I don't have much problems with the slow down or frame rate problems, but the OOM is killing me, especially whenever I play webm videos.
I only load about 10-15% of sprites of what I intended to do, but it is already causing the OOM, and even OOM at the game logo screen!
Therefore, I really need to make sure I know what I am doing to avoid memory leakages as much as possible.
I have the followings questions below if you guys can help me, it would be greatly appreciated.
1. When I load the sprite with
(A)
if I accidentally load it again without unload it first, will it overwrite it or add another one on top of it?
If I unload the sprite with
Will this remove it completely off the memory?
(B)
If I am using the same sprites to create more entities, how would they affect the OOM?
I know that everytime you load a model into the engine, it costs memory, but I don't know by how much.
2. Scripts
(A)
I know I have way too many scripts that I will use them later, mostly a copycat from this forum.
For example,
If I have 50 scripts on 1 file, and I am only using only 20 of them, will the other 30 scripts affect the memory?
(B)
Right now I have 1 main script file (MainAnim_All.c) that includes all other scripts files inside like this:
Then I load this MainAnim_All.c in the entity's header.
What if the entity only needs 1 or 2 scripts from the Spawns_Anim.c,
should I load the Spawns_Anim.c instead of MainAnim_All.c in this entity's header?
3. killentity function
When I use this function, will it remove the spawned entity off the screen and also off the memory?
I know that once you load the entity model, all the sprites inside the model will be loaded to the memory forever until you manually remove them.
How do you know manually remove the sprites off the memory?
4. Sound and Music files
How would they affect the OOM?
I have a lot of sounds and music files.... so I am wondering if these actually affect OOM a lot or not.
5. High Definition Stage Backgrounds
I love high-res background pngs, but I don't know how much these would affect the OOM.
How would they affect the OOM?
Sorry for the noob questions, and thank you very much for your help in advance.
First of all, sorry if any of these questions has been asked before.
My project is very critical in terms of OOM issues that I have been having.
I love having more sprites for smooth animations, but it looks like I can't do that in my high-res OpenBor game anymore.
I don't have much problems with the slow down or frame rate problems, but the OOM is killing me, especially whenever I play webm videos.
I only load about 10-15% of sprites of what I intended to do, but it is already causing the OOM, and even OOM at the game logo screen!
Therefore, I really need to make sure I know what I am doing to avoid memory leakages as much as possible.
I have the followings questions below if you guys can help me, it would be greatly appreciated.
1. When I load the sprite with
(A)
Code:
setlocalvar("TitleScreenPNG", loadsprite("data/bgs/Title.png"));
If I unload the sprite with
Code:
void titleScreenPNG = getlocalvar("TitleScreenPNG");
if(titleScreenPNG)
{
free(titleScreenPNG);
setlocalvar("TitleScreenPNG", NULL());
}
(B)
If I am using the same sprites to create more entities, how would they affect the OOM?
I know that everytime you load a model into the engine, it costs memory, but I don't know by how much.
2. Scripts
(A)
I know I have way too many scripts that I will use them later, mostly a copycat from this forum.
For example,
If I have 50 scripts on 1 file, and I am only using only 20 of them, will the other 30 scripts affect the memory?
(B)
Right now I have 1 main script file (MainAnim_All.c) that includes all other scripts files inside like this:
Code:
#import "data/scripts/anim/MainAnim.c"
#import "data/scripts/anim/Mobility_Anim.c"
#import "data/scripts/anim/MpSmSpEx.c"
#import "data/scripts/anim/Spawns_Anim.c"
#import "data/scripts/anim/Grabs_Anim.c"
#include "data/scripts/common/constants.h"
What if the entity only needs 1 or 2 scripts from the Spawns_Anim.c,
should I load the Spawns_Anim.c instead of MainAnim_All.c in this entity's header?
3. killentity function
Code:
@cmd killentity getlocalvar("self")
I know that once you load the entity model, all the sprites inside the model will be loaded to the memory forever until you manually remove them.
How do you know manually remove the sprites off the memory?
4. Sound and Music files
How would they affect the OOM?
I have a lot of sounds and music files.... so I am wondering if these actually affect OOM a lot or not.
5. High Definition Stage Backgrounds
I love high-res background pngs, but I don't know how much these would affect the OOM.
How would they affect the OOM?
Sorry for the noob questions, and thank you very much for your help in advance.