Spawning bullets best practices

What scenario do you suggest to spawn many short-life objects like bullets for example. In meaning of optimalization, I’m worry about memory wasting and fragmentation.

So typical scenario:

def Load(self):
    self.model = loader.loadModel("bullet.egg")

def Shoot(self):
    self.model.copyTo(render)
    #..start moving here..

def End(self):
    self.model.removeNode()

Do you think that python is good enough to hadle this scenario or maybe better prepare e.g. 200 copies of bullets which always resides in memory and make them visible/unvisible only ?

In the big picture, 200 copies is not really so many, and bullets are small. I’d say, do it the naive way first, then optimize later if it turns out to be a problem.

For the record, you don’t even need to explicitly call copyTo(render). Just call self.copy = loader.loadModel(‘bullet.egg’) for each copy you want, then self.copy.removeNode() when you’re done with it. loadModel() automatically caches the model internally and returns an in-memory copy for second and later loads of the same egg file.

David