Jump to content

Help with elevation code


badosu
 Share

Recommended Posts

3 hours ago, badosu said:

Hello folks,

I want to recreate the slopes map from hidden cup on 0ad:

I am stuck on making the elevation to sides, which should be pretty simple though, I wondered if someone knows of any map that has a similar feature?

well something could be found here https://trac.wildfiregames.com/search?q=elevation  https://trac.wildfiregames.com/wiki/Atlas_Manual_Starting  i will ping @FeXoR @vladislavbelov @elexis they could know more.

Link to comment
Share on other sites

Hi @badosu ;)

For a random map I would suggest using an ElevationPainter for the two areas with differing heights and afterwards using the SmoothElevationPainter to generate the ramp (and you could use the random argument to add some noise to the slope). For the latter also add a cliff texture to be painted with the TerrainPainter and you are done ;)

  • Thanks 2
Link to comment
Share on other sites

Awesome! Unfortunately it seems the SmoothElevationPainter tries to return elevation to base creating a kind of a hill instead of a ramp, this was my attempt using it:

 

Spoiler

const heightTop = 20;
const lowlandsWidth = fractionToTiles(0.4);
const rampWidth = fractionToTiles(0.1);
const elevationPainter = new ElevationPainter(heightTop);
const rampPainters = [
  new TerrainPainter(tCliff),
  new SmoothElevationPainter(ELEVATION_SET, heightTop, 20),
  new TileClassPainter(clRamp)
];

createArea(
  new RectPlacer(new Vector2D(halfMapSize + lowlandsWidth / 2 + rampWidth, mapSize), new Vector2D(mapSize, 0)),
  elevationPainter);

createArea(
  new RectPlacer(new Vector2D(0, mapSize), new Vector2D(halfMapSize - lowlandsWidth / 2 - rampWidth, 0)),
  elevationPainter);

createArea(
  new RectPlacer(new Vector2D(halfMapSize + lowlandsWidth / 2, mapSize), new Vector2D(halfMapSize + lowlandsWidth / 2 + rampWidth, 0)),
  rampPainters
);

 

With createPassage I was able to obtain the desired result:

 

Spoiler

const heightTop = 20;
const lowlandsWidth = fractionToTiles(0.4);
const rampWidth = fractionToTiles(0.1);
const elevationPainter = new ElevationPainter(heightTop);
const rampPainters = [
  new TerrainPainter(tCliff),
  new SmoothElevationPainter(ELEVATION_SET, heightTop, 20),
  new TileClassPainter(clRamp)
];

createArea(
  new RectPlacer(new Vector2D(halfMapSize + lowlandsWidth / 2 + rampWidth, mapSize), new Vector2D(mapSize, 0)),
  elevationPainter);

createArea(
  new RectPlacer(new Vector2D(0, mapSize), new Vector2D(halfMapSize - lowlandsWidth / 2 - rampWidth, 0)),
  elevationPainter);

createPassage({
  "start": new Vector2D(halfMapSize + lowlandsWidth / 2, halfMapSize),
  "end": new Vector2D(halfMapSize + rampWidth + lowlandsWidth / 2, halfMapSize),
  "startWidth": mapSize,
  "endWidth": mapSize,
  "smoothWidth": 2,
  "tileClass": clRamp,
  "terrain": tHill,
  "edgeTerrain": tCliff
});

createPassage({
  "start": new Vector2D(halfMapSize - lowlandsWidth / 2, halfMapSize),
  "end": new Vector2D(halfMapSize - rampWidth - lowlandsWidth / 2, halfMapSize),
  "startWidth": mapSize,
  "endWidth": mapSize,
  "smoothWidth": 2,
  "tileClass": clRamp,
  "terrain": tHill,
  "edgeTerrain": tCliff
});

 

 

screenshot0008.png

screenshot0009.png

  • Like 1
Link to comment
Share on other sites

  • 9 months later...

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