Understanding the maps provided by the interface?

Understanding the maps provided by the interface?

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Understanding the maps provided by the interface?

Post by PauloMorfeo »

Ok, if I'm understanding correctly there's a whole bunch of map sizes.

#1 - There's what I'll call the LargeMap - which represents the area where units can be in.
Marble_Madness_Map = 2048x2048 (256x256 *8)

#2 - There's the HeightMap - which represents the terrain height, and has 1/8 of the granularity of the LargeMap.
Marble_Madness_Map = 65536 (256x256)

#3 - CornersHeightMap? Couldn't figure out properly what that is but I think it might not be super relevant to AIs...
Marble_Madness_Map = 66049 (256+1 x 256+1)

#4 - JammerMap - 1/8 the granularity according to method summary but:
Marble_Madness_Map = 1024 (?equiv. to 32x32!? Does the Jammer Map have a granularity of 1/64?)

#5 - LosMap - Line Of Sight, but I couln't really figure out what's the stated granularity on this one.
Marble_Madness_Map = 16384 (128x128 - granularity of 1/16?)

#6 - RadarMap - 1/8?
Marble_Madness_Map = 1024 (as JammerMap)

#7 - ResourceMapRaw - As in a map of Metal density? And .. 1/2 the granularity?
Marble_Madness_Map = 16384 (as LOS?)

#8 - SlopeMap - 1/2 the granularity? Does this indicate the .. slope? (by name I assume so but then, why is the HeightMap 1/8 and this 1/2!?)
Marble_Madness_Map = 16384 (as LOS?)

#9 - Interface.getElevationAt (x, z) - is this expecting (x,z) coordinates at the granularity 1/1 or 1/8 or ?

#10 - Is the SlopeMap directly related to Unit.Definition.getMaxSlope()? as in: anywhere on the map, if the map's slope <= the unit's MaxSlope the unit will be able to go there?

#11 - _Callback.getPathing () - SpringRTS seems to pre-calculate path related things, which I assume pre-calculations of where each unit will be able to pass through. Is this getPathing allowing access to query the engine over that information? I assume this to be very well performant...

#12 - With which map do the building blocks interact? I'm kind of thinking it is the SlopeMap. A building's size appear to be Decal Size X and Decal Size Y - does each of the units in Decal Size correlate to 1 unit in the SlopeMap or?

---
Sorry so many questions but they're all related and I think it's better than spamming the forum...
User avatar
Anarchid
Posts: 1384
Joined: 30 Nov 2008, 04:31

Re: Understanding the maps provided by the interface?

Post by Anarchid »

I think the los map has a granularity defined by taking the heightmap (already lower granularity than actual) and then dividing some more.

In particular, it seems that LosMap has granularity of heightmap * 1/(2^LosMipLevel).

Here's a function i made (some trial and error involved) to check if a real world-position such as unit coordinates is in line of sight based on the granular los map. The gridsize values come from here.
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

Re: Understanding the maps provided by the interface?

Post by PauloMorfeo »

Hoooo!!! So each specific granularity is relative to the HeightMap, not the "LargeMap".
So if a map is 1/2 the granularity, it will be 1/2 of the HeightMap (1/16 of the LargeMap). Now things make a lot more sense.

And thanks for pointing to your code. It solved 2 problems for me:
- Helped me understand how to relate the LosMipLevel to the LosMap granularity (a bit tricky);
- Gave a very nice example of how to print an area for debugging purposes.* (I don't think you need the Math.min(), though)

* this is huge - absolutely invaluable in debugging an AI and was my next point of focus on what to figure out. Now off to the wiki!
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: Understanding the maps provided by the interface?

Post by hoijui »

the documentation for the AI interface for this stuff is (starting from) here:
https://github.com/spring/spring/blob/d ... ck.h#L1724
i would say there is quite some info about the maps already. if you want to add more, change it, do it in this file, and make a pull request. the documentation in this file should be used in all AI interfaces. for the Java AI Interface for example, it is converted to JavaDoc, and if you add the sources jar, you get this as doc text in your IDE when the cursor is at the given function.
Post Reply

Return to “AI”