Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Deleting and creating sprites fragments memory?

Author
Message
Marco A G Pinto
20
Years of Service
User Offline
Joined: 26th May 2006
Location: Portugal
Posted: 22nd Mar 2011 03:09
Hello!!!

I was wondering if instead of using:
sprite 1000,0,0,1 : show sprite 1000

and later: hide sprite 1000

If, instead of just hiding I could delete them (and later create again) but I am not sure if this fragments the video memory and/or the standard memory.

I believe that if I just hide the sprites they will continue to use game speed and if I have dozens/hundreds of them hidden it will slow down the game.

Green Gandalf and IanM, do you know the answer?

Thanks!

Kind regards,
>Marco A.G.Pinto
---------------
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Mar 2011 15:22
TBH, I've no idea.

However, if you are constantly creating and deleting sprites, it might be more efficient to reuse them instead. What the break-even point on that is though, I have no idea.

And I do know that leaving a sprite intact but hidden doesn't have that much of an impact - they are eliminated from the display processing very early in the display update routine, so it wouldn't take too many creates/deletes to end up taking more processing time than just hiding them.

You'll have to try it and see.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 22nd Mar 2011 15:53
I can only second that.

Login to post a reply

Server time is: 2026-07-17 13:57:45
Your offset time is: 2026-07-17 13:57:45