1

Regarding this old video: https://www.youtube.com/watch?time_continue=13&v=9-zDOJllPZ8

In the video they have one global instance of an object pooler that handles the bullets object pool. The guy also says that handling multiple lists is worse than keeping one list (in another scenario).

But what if I know how much bullets each player can use at a given time, wouldn't it be more efficient to give each player their own object pool with their own list of bullets?

Say a ship can shoot 20 bullets, then has to reload. By the time it's done reloading those bullet objects are free once more. But if the amount of ships die and you just used grow instead, you could be having 5 ships on a given map with a list of bullets for 10 ships. Alternatively it could check how many ships there are and adjust the size of the array, but that seems inefficient.

KVN
  • 65
  • 5
  • 2
    A "pool" is intended to be "as many as you'll ever need at once." Its not "if a ship shoots 20, the pool is 20." It's ALL bullets from ALL sources on the screen at once big. Typically object pooling systems have ways of making the pool bigger, if it gets exhausted. – Draco18s no longer trusts SE Jul 28 '19 at 01:48
  • Sure, thanks. I'll just go with the big pool then. Didn't think the difference'd be big, was just curious. – KVN Jul 28 '19 at 03:54

0 Answers0