Currently working on an RTS game with the main gameplay revolving around cloning.
I noticed that there’s a familiar structure involving cloning in sandbox games. It’s not like Minecraft-like sandbox, but more of a material-construction game where you need to plot down multiples of the same object, called “blueprints,” on the land, while you wait for workers to bring resources and materials to the destination. In this sandbox game, the player is allowed to place as many blueprints as possible while the workers are slowly constructing them.
What this type of sandbox game does is that it instantiates the same prefabs over and over, many many times. When you see it in the Hierarchy tab, you would see a list of so many (Clone) prefabs of that blueprint object. The same goes for my RTS game, where the player is allowed to instantiate as many units, as arbitrary as the player needs to win a battle. Of course there’s a hard limit, but in comparison with the sandbox game I gave as an example, it’s “low key” and “trivial”.
Hoping that I can adapt my RTS game to this sandbox-type resource management system, what kind of data structure do I need to use to do this? And if possible what scripting techniques are used that is recommended by those who knew how to handle such resource management?
EDIT:
I have this thought. I would make a class that extends a List<>, with a few more List<> variables, and would add functionality to it on terms of removing, adding, and iterating through the elements in the list. Of course that while the list is iterating through each elements, since the player is arbitrarily choosing which unit to clone (instantiate), I am thinking of a PriorityQueue or a LinkedList sort of data structure. This is where I am stuck at. Maybe there are better Collections I can use, so it would be viable?