You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
If I understood the basic problem right you search for an easy way to find enemies nearby, powerups nearby or whatever?
I'd just try to organize my units in a simple tree (two classes: UnitGroup and Unit). The following tree shows groups only. You could then just iterate through it starting where it's usefull and use a flag to exclude different paths not wanted (for example, ground units only).
Units
+- Player0
+- Ground Units
+- Tanks
...
+- Infantry
...
+- Air Units
...
+- Player1
...
+- Player2
...
This might not be very effective just to get objects by their position/proximity but I'm sure you'll also need other selections (finding units for AI, drawing own units on minimap, ...) etc. anyway. And you don't have to walk all objects all the time if you don't really need to.
I think the spatial proximity is really the key here. Let's say I'm a unit patrolling my little bit of space. I don't care if the guy next to me is some kind of fighter or just a cargo ship. I'm going to attack him anyway, so long as he's in range. So I don't see much gain in dividing based on unit type. Dividing based on player makes sense and can quickly exclude ~50% of units from certain checks (for 2 players obviously).
But primarily I think this is a spatial problem and best solved by a spatial division. In some form or another. As I said before I'd most likely just divide the map into a 3D grid of some arbitrary size of cube and use maps since this is likely to be fairly sparse (given that it takes place in space). If maps weren't fast enough a 3D matrix would be quicker, but also take more memory.
Frosty Topaz
=========
It isn't easy being ice-encrusted aluminum silicate fluoride hydroxide...
sfncook wrote:That book looks pretty interesting. Amazon reviews are pretty high. How about this one though? http://www.amazon.com/Game-Programming- ... im_b_img_5 Has anyone ready it or heard any positive/negative reviews?
-S
All of the Game Programming Wisdom and the Graphic Gems, etc books have the following in common:
they are a collection of articles by different authors which means
a) some articles are well written and others are not
b) some articles will be on a topic you care about, others will not
it really comes down to whether or not the particular book has an article on what you want to learn or not.