Singleton Dictionary vs Other CollectionPools

Been doing research for next part of prototype and was looking at methods of how to handle what I want to work on. Right now I am looking at research for access to specific types of minions, which would be accomplished via a research/unlock tree.

I am trying to determine when and why you would use say a DictionaryPool or ListPool vs storing whats’ available/unavailable in a singleton’s dictionary or list?

So far everything I have found talks about Objectpooling but outside of some rare descriptions of what they do, they don’t provide any use cases.

I’m not sure an Object Pool is exactly what you’re looking for in this circumstance. Object pools (regardless of implementation) are mainly used for things that yo instantiate and destroy frequently in a scene. For example: If you fire a lot of bullets off into the distance, the system needs to create the bullets, make them go, then destroy them at some point to recapture the memory. With an Object pool, the bullets are returned to a “Pool” where they can be re-used and recycled for the next time the shooter has a go.

It looks like you’re building a Tech tree, which would best be accomplished with a Dictionary<Technology, bool> (Where Technology is the specific bit of tech achieved, the bool is just a throwaway to use the Dictionary which is faster than searching a list). That handles the research that has been completed…

Then anything that requires tech would have a List<Technology> which would contain all of the technology required to unlock that thing. Tech that requires other Tech also has this list. You can then simply check to see if all of the tech in the List is found in the static dictionary

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms