Hi!
Starting a big game project now and I want to ask some basic questions.
1. What's the best way to keep track of all the active units and similar. Since they're not of the same class I can't put them all in the same container? or?
2. A good way to store data, can I keep going with lousy *.txt files even though the amount of data gets really large or do I have to store it in a database or XML?
3. Dynamic memory allocation, do I keep this in the constructors, deconstructors or do I do something else? (Heard somewhere that they had some extra functions for this kind of deal).
1. Define what you mean by "units"
2. You can use txt files, or binary data files. XML is the same as text except it takes up more room because it's quite verbose.
3. Dynamic allocation in constructors is fine if you handle possible exceptions correctly. Otherwise it's best to do it when it's going to be needed (e.g load() method)
I mean any active intractable object in the game. For example an army, a village, a building, a part of the map and so on.
Simply, a good way to store them all.
I mean I want a village to contain buildings of different types, an army needs to contain different unit types.
I've previously used containers to contain the objects I want them to but as far as my knowledge for containers go they can only contain stuff of the same type. correct?
If you're talking about storing them on file system then keep them in their native format, for distribution you can pack them all in a zip.
For using them in code, you need to be an object hierachy for your game. Your question show that you're very new to C++; so I would recommend studying Object Orientated development to understand how to use inheritence and polymorphism to accomplish this.