2 registered members (dr_panther, 7th_zorro),
1,203
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: What happens with particles, Memory wise?
[Re: jumpman]
#468164
09/21/17 12:06
09/21/17 12:06
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
For particles you assign global BMAP pointers. Unless you create them dynamically/ manually yourself they are created and allocated at game start (this is while the default acknex compile window is still active, printing out the "..." dots). Like here:
BMAP* coolParticle_tga = "coolParticle.tga";
void p_coolParticle(PARTICLE* p)
{
p.bmap = coolParticle_tga;
...
}
You could write BMAP* coolParticle_tga = NULL; and then bmap_create the image at runtime - once. Once is the keyword though, as there's no memory allocation in terms of image memory done for particles or their instances. So... you wouldn't have to worry about that case normally. Btw 2048^2 sounds awfully large for a particle, do you really need that size?
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: What happens with particles, Memory wise?
[Re: Superku]
#468169
09/21/17 16:32
09/21/17 16:32
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
2048 is just a hypothetical, i wanted to exaggerate So help me understand, if I got it right: So when you declare a non-null BMAP* in the script, the engine loads that image during the dots and puts it into memory, so when you run the effect, even with a 2048/huge image, the engine wont pause/stutter while the camera sees it for the first time. However the image is still loaded into memory correct? From the dots and onward, that image has been placed into memory, its area flagged as being used. Is there a way to purge this image later? What if I dont ever want the particle image used in a level? I would still have that area marked for usage in a level that wouldnt require that effect. bmap_create on a BMAP* that was initially declared NULL, then fills that BMAP* with an image, as if you declared it regularly in the beginning. How does this help, besides saving memory in the beginning, before the image was filled with bmap_create? How will you remove that image from memory?
|
|
|
Re: What happens with particles, Memory wise?
[Re: jumpman]
#468170
09/21/17 16:38
09/21/17 16:38
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
Another example would be this: In my volcano level, I have an animated sprite (emulated particle) that is used on the top of the volcano, a 32 frame animation of a cool fire cloud effect, it looks all cool and magma . I use BMAP* SuperMagma+32.tga; in the script. But in the next level, which is a snow level, I have no use for the magma sprite, I want to get rid of it from memory, so that I can use a snow avalanche animated sprite. How will I purge the magma sprite from memory?
|
|
|
Re: What happens with particles, Memory wise?
[Re: Superku]
#468180
09/22/17 17:33
09/22/17 17:33
|
Joined: Apr 2002
Posts: 1,246 ny
jumpman
OP
Serious User
|
OP
Serious User
Joined: Apr 2002
Posts: 1,246
ny
|
hi superku, thank you!
"Then bmap_create with allocate 8MB first, then additional 8MB when the bmap is visible for the first time."
An 8mb image actually takes up 16mb of space? The first 8mb is allocated, meaning its marked for this specific bitmap, then why is an additional 8mb consumed when you see it for the first time? I thought it was already loaded into memory.
How does ptr_remove() work better? Im assuming ptr stands for pointer, which means it just an address, like an address to a house for example. Wouldnt ptr_remove just remove the address to that house, instead of removing the house altogether? But if that works, that looks like I should use that method, thank you.
So level_load only frees up memory that was loaded into the wmb file correct? It doesnt automatically free up all memory, especially BMAP* that were declared (not null)
Do you manually ptr_remove stuff when level_loading in your game? Or do you make automatic systems?
|
|
|
Re: What happens with particles, Memory wise?
[Re: jumpman]
#468185
09/22/17 19:52
09/22/17 19:52
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
The bitmap lives in VRAM as well, which is where the second 8Mb come from.
ptr_remove() frees up the memory the pointer points to. Although that only works for engine objects that are created via xyz_create (eg. ent_create, bmap_create etc)
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: What happens with particles, Memory wise?
[Re: Superku]
#468194
09/23/17 18:26
09/23/17 18:26
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
The good news is that render targets on pretty much every newer GPU are compressed and aren't eating the full VRAM cost or even the full bandwidth cost. AMD has a good overview here. Nvidia does something similar for much longer already (around Fermi times, potentially even before with Tesla). In any case, render targets aren't that expensive anymore these days. Although I guess one big problem with Gamestudio is that it's 32bit so not only VRAM is a concern.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
|