delete or hide?

Blitz3D Forums/Blitz3D Programming/delete or hide?

Picklesworth(Posted 2004) [#1]
I have an object stored in a type instance that is a part of another object, so it only appears occasionally. To make it disappear, I am using hideEntity and then showing it again when it is selected. Is this fine, or would it be better if I delete the object rather than hide it, and recreate it when I select it again?


ChrML(Posted 2004) [#2]
Well, that depends on what you are hiding/killing and showing/creating. If it's a cube, or something, recreating it takes no time, but if it's a large scenario, that can take several seconds, and is therefore not smart to do dynamically while the player plays. Primitives without textures takes very little memory, so it should be fine to just hide them. If they are simple models with highres textures, I guess killing them would be best to save vidmem.


Neochrome(Posted 2004) [#3]
if the object is going to be used through out the gameloop, you should keep it, since deleting and creating fragments memory, I sugguest Entityalpha 0 instead of Hideentity. its faster (it was a older versions of Blitz)


Picklesworth(Posted 2004) [#4]
oops, forgot to mention: It's a 'program' program, not a game. Thanks for the help though, I think I see what I should do.


Neochrome(Posted 2004) [#5]
i would suggest a pool of objects then, and move the hidden object outside of the camera viewport, Blitz wont render anything outside the camera viewport.
I do stress tho that creating and killing objects does fragment memory, and excessive creating and killing will slow down the program eventualy


Rob(Posted 2004) [#6]
If you are dealing with huge numbers of objects and you do not manipulate them frequently then delete and create is best.

If you are dealing with a moderate amount, hiding is best.

Moving it off the camera view is just going to cause more problems that solutions.