Does Irrlicht provide spatial indexing (searching) utility?

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!
Ico
Posts: 289
Joined: Tue Aug 22, 2006 11:35 pm

Post by Ico »

I don't think a RTS would get that complex ... ;)

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).

Code: Select all

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.
sfncook
Posts: 36
Joined: Sun Jul 01, 2007 6:32 pm

Post by sfncook »

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
Frosty Topaz
Posts: 107
Joined: Sat Nov 04, 2006 9:42 pm

Post by Frosty Topaz »

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...
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

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.
a screen cap is worth 0x100000 DWORDS
Post Reply