Create Sprite, FreeSprite

Blitz3D Forums/Blitz3D Programming/Create Sprite, FreeSprite

Neochrome(Posted 2005) [#1]
At the moment im knocking out a few sample code for some one, but im not sure about sprites and entitys

basically in this example im create a sprite, using it, then freeing it, then im doing the same for about 2 minutes continues.

Does this fragment VRAM seriously enough to warrent "REUSABLE" sprites?


jfk EO-11110(Posted 2005) [#2]
You can test this easily when you monitor the AvailVidMem()


Neochrome(Posted 2005) [#3]
*DOH!!!!!!
Yeah there it goes!! memory going going... CRASH! whoohoo

Dang it, more complicate coding!! hehe

using the Flag 256 would make thins faster too wont it?


Damien Sturdy(Posted 2005) [#4]
That shouldn't use too much memory...! Let's see your code? :)


Neochrome(Posted 2005) [#5]
ive change the code now, im using single surface sprites... took me a little while to do... using vertex are fun *NOT*

but it was free the sprites, but eventually the computer was slowing down. so i had to use another method.
It works and it seems to work find on lesser machines too! a good result in the end!!


Damien Sturdy(Posted 2005) [#6]
Cool, But i'm worried about the fact you got it to use alot of ram just by load/free-ing... Blitz memory leak? or just bad code? :)


Neochrome(Posted 2005) [#7]
i susspect bad code, iv done it before. it could also be a driver error on my gfx card too!
im using a GFx5800 its fast.


Damien Sturdy(Posted 2005) [#8]
Hmm... if it was a driver error, you'd see it elsewhere :) hehe

For teh sake of it. im using a "GFx"6800. its faster. by tons :P

haha. Just for peace of mind, could you post your memory crunching code?


Neochrome(Posted 2005) [#9]
i dont have it anymore... it dissapeared when i re-wrote that engine.
but it kinda went like this
while not keyhit(1)
  cls
   t% = createsprite()
   

   positionentity(t%,.5,.5,50)
   renderworld()
   freeentity(t%)
wend


it started to feel like the computer was memory fragmenting and started to judder as new sprites where being created
the memory went down and down cos the freentity wasn't being executed ALL the time still when i sorted that bug out, it still started juddering after about 2 minutes of continueus sprite handling

my computer is fast enough for the stuff i do on it, and programming with a slightly less than industry standard can guarentee my games will work nice enough on most computers 3 years old


Ross C(Posted 2005) [#10]
I'm sure Blitz doesn't actually free the memory, until something else needs loaded in. So your mem usage isn't an accurate way of telling. I did read this on a thread a while back, i don't know if it's what actually happens tho :o)


Neochrome(Posted 2005) [#11]
i suspect that too Ross, i remember something about that in a tread a while now you mension it!

hmm, its not a problem now anyway. im hoping i have the single surface stuff accurate enough :)