Jump to content

Analyzing Passability Map


Recommended Posts

I've found a way to render internal maps on a HTML canvas providing some visual confirmation. Only the passabiltiy map gives some headache. pathfinder.xml defines these PassabilityClasses:

unrestricteddefault  <MaxWaterDepth>2  <MaxTerrainSlope>1.0ship  <MinWaterDepth>1building-land  <MaxWaterDepth>0  <MinShoreDistance>1.0  <MaxTerrainSlope>1.0building-shore  <MaxShoreDistance>2.0  <MaxTerrainSlope>1.25

The API knows these classes + values:

//uneval(sharedScript.passabilityClasses);pathfinderObstruction:1, foundationObstruction:2, building-land:4, building-shore:8, default:16, ship:32, unrestricted:64  

Here are the classes rendered using the Arcadia 02 map:

post-16051-0-93335300-1405700631_thumb.ppost-16051-0-36026900-1405700634_thumb.ppost-16051-0-66990400-1405700636_thumb.ppost-16051-0-99178600-1405700637_thumb.ppost-16051-0-04963900-1405700639_thumb.ppost-16051-0-63938300-1405700640_thumb.ppost-16051-0-61151100-1405700641_thumb.p

(the mouseover title shows the mask value)

pathfinderObstruction is surely no-go area for everything. What I want is where land/water units can go, so default looks good for land, however slope is not indicated in the map and ship also has area on land indicated. I know I can bitmask what I need, but somehow API and pathfinder.xml do different things. Which one is reliable?

  • Like 1
Link to comment
Share on other sites

There are two other issues, on the left is a height map I've imported into atlas, in the middle the resulting passability map and on the right both blended, they do not align on the east side.

post-16051-0-04393700-1405885858.pngpost-16051-0-10476300-1405885886.pngpost-16051-0-59103600-1405885886.png

Also, deep sea and shallow water do not connect. There is a gap indicated by black pixel below.

arcadia.png

What is the trick to get a continuous passability?

Link to comment
Share on other sites

One reason for this might be that we use different code (for e.g. slope) in the different parts of the game (e.g. Engine, Simulations, Random maps).

[i'd prefer one shared lib for such functions]

In this case however it's more likely that it's simply the "Import Heightmap" functionality that cuts a part of the image (AFAIK to please the engines need for square maps with even side lengths). So the original and the resulting map do not fit.

Also take into account that if the image is (eventually cut to) X*X in size the slope map is [X-1]*[X-1] in size because you need 2*2 heights to get a plane witch than has a slope.

The "neither deep nor shallow water" thing is entirely unknown to me.

Edited by FeXoR
Link to comment
Share on other sites

> the slope map is [X-1]*[X-1] in size because you need 2*2 heights to get a plane witch than has a slope.

Yes, that's documented for *.pmp and leads to a very tiny offset in NE direction, barely a pixel.

> Afaik there is a tool that let´s you set passability. Maybe you need some tweaking ?

Sorry, should have mentioned the passability info is needed to steer a bot's units around. No chance to edit maps while playing.

Link to comment
Share on other sites

> neither deep nor shallow water

Would you set them to deep or shallow?

Perfectly I'd look into the code or ask at http://webchat.quakenet.org/?channels=0ad-dev what's up about this (In fact it looks like a bug to me).

If I felt to lazy for that (or as a temporary solution) I'd set it to deep water to not confuse the player that this area would be passable (If meant for the player at all though bots would likely be confused too).

Edited by FeXoR
Link to comment
Share on other sites

  • 4 weeks later...

Hannibal is coming along nicely.

Your recent Map Analysis wiki entry is related to this topic.

Any news on if it will be integrated into 0AD as experimental bot prior to the planned Git transition? Or do we have to provide it as a mod?

Funny I now reused our AI tournament state machine for a storylineMachine too. I like those 0AD bots. Always makes me want to continue on the Hybrid AI, of course it will build upon Hannibal, perhaps turning my command machine (yet another usecase of the state machine) into Hannibal compatible plugins.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...