Jump to content

Terrain Decals


Recommended Posts

I added some like this, based on data files like this - you just set an actor to use a decal instead of a mesh, and it turns into a textured rectangle that follows the terrain. This also avoids z-fighting problems (the ugly flickering that sometimes occurred with the old decal meshes when they precisely overlapped, visible in e.g. the Pathfinding Demo map with the maze of corrals).

With the foundations, the mesh is still hanging out into the air. What should we do about that? (Flatten the land immediately when the foundation is placed, so the mesh is never on uneven ground? Change the mesh to have some parts going vertically downwards below the zero plane, so it looks like it's still got support if the terrain is lowered? Do some fancy dynamic mesh modification to conform to the terrain?)

Some things that still need to be added: (How important are these to people?)

* Actor Editor support.

* Floating decals (e.g. for lily pads, where using decals would probably be good to prevent z-fighting).

* Support for large numbers of special-effect decals, e.g. shadows or footprints or pools of blood. (Currently it's just designed for buildings, which are few and large and stationary.)

(Also someone probably needs to update all the actors to use the new decals.)

Link to comment
Share on other sites

I'd say flatten the terrain beneath the building's <obstruction> footprint. The decals generally extend beyond this, so that they can do their business of blending the building into the surrounding terrain (which is not flattened). Long ago I actually planned for this to work that way (one of the few instances of forethought on my part, lol).

This looks great so far though! Can't wait for Alpha 5 now. lol

Link to comment
Share on other sites

Brilliant work (y)

Could a similar approach be used to change the height positioning of building propS? Instead of the props following the node’s z axis they instead follow the z point of the terrain.

With the foundations, the mesh is still hanging out into the air. What should we do about that? (Flatten the land immediately when the foundation is placed, so the mesh is never on uneven ground? Change the mesh to have some parts going vertically downwards below the zero plane, so it looks like it's still got support if the terrain is lowered? Do some fancy dynamic mesh modification to conform to the terrain?)

My choice would be the second option - Change the mesh to have some parts going vertically downwards below the zero plane.

Some things that still need to be added: (How important are these to people?)

* Actor Editor support.

* Floating decals (e.g. for lily pads, where using decals would probably be good to prevent z-fighting).

* Support for large numbers of special-effect decals, e.g. shadows or footprints or pools of blood. (Currently it's just designed for buildings, which are few and large and stationary.)

Low priority IMO

Link to comment
Share on other sites

I'd say flatten the terrain beneath the building's <obstruction> footprint.
As soon as you click to place the building? (even if e.g. animals or friendly/enemy units are currently standing in the way?) (even if you immediately delete the foundation and get all your resources back, so it's kind of a free terraforming tool?) (I'm not familiar enough with other RTS games to know whether this kind of thing would be exploitable for unfair advantages.)
Could a similar approach be used to change the height positioning of building propS? Instead of the props following the node’s z axis they instead follow the z point of the terrain.
No. A totally different approach could be used for that, though - probably some kind of flag in the actor which means it takes the (x,y,z) of the parent actor's attachpoint and then replaces the y coordinate [the vertical axis] with the terrain height (or water height). I think that'd be easy to add - is it something you'd find useful?
Link to comment
Share on other sites

As soon as you click to place the building? (even if e.g. animals or friendly/enemy units are currently standing in the way?) (even if you immediately delete the foundation and get all your resources back, so it's kind of a free terraforming tool?) (I'm not familiar enough with other RTS games to know whether this kind of thing would be exploitable for unfair advantages.)

In AGE game I think the foundation doesn't show up until the unit approaches the spot and begins hammering.

No. A totally different approach could be used for that, though - probably some kind of flag in the actor which means it takes the (x,y,z) of the parent actor's attachpoint and then replaces the y coordinate [the vertical axis] with the terrain height (or water height). I think that'd be easy to add - is it something you'd find useful?

Possibly for farm fields?

EDIT: I committed a farm field hack. Looks ugly, but it's the best solution for now.

Link to comment
Share on other sites

Hmm... In AoM, it looks like steepness is ignored entirely - units can walk up near-vertical slopes, and buildings can be placed on them. When a building is placed, the construction-site mesh appears immediately (possibly partially floating in air or stuck into the ground); once a builder has reached it, and other units have moved out of the way, the terrain instantly gets flattened. Units will never get stranded by the flattening, because they don't care about the steepness.

Building near water can cause land tiles to become submerged, and can cause water tiles to become dry. Pathfinding seems to ignore that entirely - units can still walk across the newly-submerged areas but not the dry areas, while ships can still move along the dry areas and not the newly-submerged.

That seems like cheating and/or a bug, but I suppose it's a reasonable way to avoid overcomplicating the issue. Determine all pathfinding based on the initial state of the terrain, and let the building flattening be a purely cosmetic effect that the gameplay code never even notices. Then there's no way a player could exploit it to trap enemy units, or to get across an impassable mountain, etc, and it'd be easy enough to implement that way.

Link to comment
Share on other sites

So if we went for the terrain flattening option, units would need to walk up near-vertical slopes to allow for movement between buildings (where flattening would have caused a slope to form)?

No. A totally different approach could be used for that, though - probably some kind of flag in the actor which means it takes the (x,y,z) of the parent actor's attachpoint and then replaces the y coordinate [the vertical axis] with the terrain height (or water height). I think that'd be easy to add - is it something you'd find useful?

If we went for the second, none terrain flattening option, then yes it would be very useful for all building props that sit on ground level. As Mythos says, the most obvious usage would be for farm fields and corral fences.

But it sounds like we're going for terrain flattening, so that removes the need for it.

Link to comment
Share on other sites

As Michael said, being able to prop things directly on the terrain would be very useful for farms where individual plants would need to conform to the terrain. I imagine that there are other cases as well. Personally, I would like terrain flattening to either be used sparingly or less intrusively / obviously if possible.

My main point is this: building location constraints should remove the need for excessive flattening. AoK didn't even let players build on shorelines, so the issue Philip mentioned with water becoming walkable shouldn't happen.

I know there are times when it really is needed, but I don't want to see it over used. Farms not only do not need it, but shouldn't even have terrain flattening.

Link to comment
Share on other sites

Do they change the terrain under the buildings like they did in AoK? That would let players know that a building had been there once (had it been destroyed) and might make anomalies like that more understandable.

In AoM it looks like the terrain texture gets changed once the building reaches 100% completion (and stays permanently changed). When you destroy/delete a completed or under-construction building, it creates a pile of smoking rubble underneath the building's old location, which disappears after tens of seconds.

Looks like AoK is similar - change texture at 100%, display temporary rubble on destruction. It only seems to support about one angle of slope, so it doesn't have to care about steep terrain, and there's no flattening.

So if we went for the terrain flattening option, units would need to walk up near-vertical slopes to allow for movement between buildings (where flattening would have caused a slope to form)?

Not quite - I think what we could/should do is allow units to walk across tiles that were not steep at the start of the match. We can still have units and buildings be blocked by steepness if we want (unlike AoM's approach of ignoring slope and just using a special impassable terrain texture for mountainsides/cliffs), but the computation of steepness will ignore dynamic changes caused by building placement. If a unit's limit is 30 degrees, and a building flattens some terrain and causes a nearby tile to tilt from 29 degrees to 31 degrees, the unit will still be able to walk on it. If buildings are not allowed on very steep terrain, they'll never cause a huge amount of tilting, so we won't have a tile tilting from 29 to 89 degrees and nobody will really notice the discrepancy.

(The fundamental issue I want to avoid is a unit being on passable terrain, then constructing a nearby building, and suddenly finding itself on impassable terrain, because that messes up the pathfinding code quite badly - it doesn't work when a unit's path starts on an invalid tile. We still could hypothetically have other effects that leave permanent gameplay-affecting changes to the terrain, e.g. a meteor crater or a rising water level, as long as we added special code for handling units which would suddenly find themselves on invalid tiles, e.g. by crushing them or drowning them; but it's not fair to kill units just for being on steep terrain, and I can't think of any other good ways to handle that case, so it seems best to simply never make a tile become invalid in that way.)

My main point is this: building location constraints should remove the need for excessive flattening. AoK didn't even let players build on shorelines, so the issue Philip mentioned with water becoming walkable shouldn't happen.

My concern applies to non-excessive flattening too (e.g. a tile tilting from 29 degrees to 31 degrees) since that can still cross the threshold of passability vs non-passability. Given that we seemingly want some non-zero flattening in certain cases, I'd like a robust solution to that, rather than one that's based on carefully balancing constraints. But once we have a solution I don't care how much it's used - if we restrict buildings to fairly flat land, or make farms not flatten terrain, or give all buildings one-metre-deep foundations so we can visually tolerate terrain height variations of one metre and only flatten any variations stronger than that, that's all fine and it's just an art design issue. (Personally I'd agree it's probably best to minimise the use of flattening, since it's kind of an ugly solution to the problem, and there are better solutions for farms at least.)

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