I've decided to get into games development and have quite a bit of catching up to do.
Currently, I'm writing a shmup engine (which I've done before, but I lost my code!).
For my bullets, I have an object pool which can grow to +2000 objects very quickly.
What strategies can I use to minimise the time to find an available object in the pool?
Currently I'm using arrays for performance reasons, but I don't like the linear search required
to find an available object...
I'm thinking of using a running index together with a stack for object's that die ie. when an object in the pool dies,
push the index of that object onto the stack. In this way I could use the stack until it's empty before I initiate a linear search.
Come to think of it, I could push all indexes onto the stack and then use the stack exclusively... Any suggestions?