Jump to content
Sign in to follow this  
badosu

Help with elevation code

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Yeah, sigmoidal might look better, or include noise.

 

But im mostly interested in functionality for now

Share this post


Link to post
Share on other sites

Lul, does 0ad not allow water to be painted above a certain elevation? The original slopes map has sidelakes I wanted to recreate:

 

screenshot0010.png

Share this post


Link to post
Share on other sites

So, since it seems not possible to make elevated lake, I brought the land elevation down. If that happens though, everywhere gets flooded even if no tWater was placed.

Any ideas if what I want to do is feasible?

 

screenshot0011.png

Share this post


Link to post
Share on other sites

One could create a 3D actor with obstruction to create a small lake uphill.  Currently there is only one water plane.

  • Like 1

Share this post


Link to post
Share on other sites

Well, for now I am using low elevation changes, unfortunately. It seems anything below 0 elevation it painted as water and anything above a certain elevation can't be painted as water. Is there any reason for this?

 

screenshot0013.png

  • Like 1

Share this post


Link to post
Share on other sites

You don't paint water, the water in 0ad is just a big plane under the terrain at a certain z position, you can change that z pos to make it look higher or lower

  • Like 2

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...