Can an entity actually add an entity?


(Bora Kasap) #21

i wanna ask a little question about recycling entities…

firstly, i want to say what i understand about creating and recycling entities… if an entity is constructed before? then create function doesn’t construct it again, but if it is not constructed, create function works like add(new entity()) function for 1 time? Am i right? if i’m right about that, please help me about this question: what if i use create function for creating entities without using recycle function when removing, because my entities are generally creating while they have a reference? and generally that makes performance problems(like lots of bullets etc.) so am i have to use recycle function to get “create” function’s great(if it is) potantial?


(Ultima2876) #22

Absolutely; it’s as you describe. The create function works best paired with recycle because if you do not recycle any entities, there will be no pooled entities for it to re-use and it will create a new one each time. In that case, it’s basically exactly the same as just using ‘new’ and ‘add’. Always use create and recycle, there is NO good reason to do it any other way (and in fact, if it was my engine I’d abstract this from the user and make manual entity management with new and world.remove an advanced feature).


(Bora Kasap) #23

thanks very much, now i don’t have to think about that again :smiley: recycling is the best