Slope question

Slope question

Discuss maps & map creation - from concept to execution to the ever elusive release.

Moderator: Moderators

Post Reply
User avatar
RogerN
Posts: 238
Joined: 24 Jul 2006, 23:29

Slope question

Post by RogerN »

I'm a bit confused by pathing and slopes. I thought I understood this stuff, but now I'm not so sure...

Consider the hill to the left of my commander in this screenshot:

Image

It's plainly obvious that the hill is steeper than 36 degrees. It looks closer to 60 degrees, in fact. Yet my commander and k-bots can walk up it just fine. Why? I thought BA kbots were limited to slopes of 36?

All of my vehicles, however, are working exactly as I would expect them to. The areas which are steeper than 18 degrees (according to my slope map) are inaccessible.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Slope question

Post by Forboding Angel »

It's not in degrees roger.

We call it, the spring magic slope system. Actually there is an explanation of it floating around, but tbh I'm just so used to it that I can't remember.

However your mistake is a common one. You aren't alone :-)
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: Slope question

Post by Kloot »

Spring doesn't represent terrain slopes in degrees, internally it uses
(1.0 - the terrain normal's y-component) so the slope of vertical faces
is 1 and that of horizontal ones 0. A unit's maxSlope value (which is in
degrees in its movedef) is converted so that the "can we go here?" (ie
"maxSlope > terrainSlope?") comparisons are meaningful, the formula
is 1.0 - cos(DEG2RAD(maxSlope * 1.5)). If you want to know the terrain
angle in degrees, compute RAD2DEG(arccos(1.0 - terrainSlope)). For a
kbot with a maxSlope of 36 degrees (~0.41221 in "Spring format"), the
maximum tolerable terrain angle is approximately

RAD2DEG(arccos(1.0 - 0.41221))

or 54 degrees. If maxSlope was 30, the MTTA would be 45, and if it was
60 (the highest sensible value due to that 1.5 scalar and the absence
of overhanging cliffs) the kbot could mount any terrain. In other words
you do not need the long mathematical derivation, just remember that
maxTerrainAngle = maxSlope * 1.5. ;)
User avatar
RogerN
Posts: 238
Joined: 24 Jul 2006, 23:29

Re: Slope question

Post by RogerN »

Thanks a bunch. That explains it... I'll need to tweak my slope map generator to use Magic Spring Slope instead of degrees.
Post Reply

Return to “Map Creation”