Jump to content

Building construction + Terrain flattening


Recommended Posts

I've been working on a patch to allow terrain to be flattened. The relevant ticket can be found here: http://trac.wildfiregames.com/ticket/21 My patch isn't perfect yet, but I'm working on ways to improve it.

There was some discussion in Trac about if this is even necessary and if it might cause more problems than it fixes. I thought I would summarise the various solutions that have come up and see if we can figure out the best way to proceed:

1. Allow terrain to be flattened.

Pros:

It looks nice (as long as the surroundings aren't too steep).

It's consistent with some other RTS games.

Cons:

Players can use this to their advantage to block paths permanently. (There could be an added cost for large changes to penalise this.)

Can look strange in steep areas. (We would need a way to restrict where buildings could be placed.)

2. No flattening. Building models have an integrated foundation which extends into the ground.

Pros:

Would work in steep areas.

Cons:

(Maybe?) Extra work to add a foundation to all buildings. Could this be done generically?

3. A combination. Limited flattening plus foundations.

Pros:

Most realistic.

Cons:

Cons from 1 and 2

Added complexity.

I will attach some screenshots to show how things look when I get a chance.

Link to comment
Share on other sites

Yes, I would also favour option #3. Buildings like Fortresses and Defense Towers look better when their foundations extend in to the ground, but others, like the Greek market and CC won't.

IMO, it would be messy if some buildings flatten terrain and others does not.

What makes foundations look bad on the Greek market? If it is because it looks too artificial, could the foundation be made to look more like an organic rock or something?

Link to comment
Share on other sites

I've never been totally convinced about terrain flattening in 0 A.D. because of the cons specified for option 1. Flattening cannot restrict pathfinding or it'll become the weapon of choice for turtlers (not that there's anything wrong with turtling :D ). Loosing the war? - Why not build an indestructible terrain wall and prevent your opponent from taking out the remainder of your army.

I agree there should be a way of building walls (wall towers specifically) partly inside steep terrain to prevent walkable gaps around the edges. Also some allowance for building into coastal water.

Flattening has been discussed many times before, but i wanted to share my opinion even if it contradicts what other folks may think ;)

Link to comment
Share on other sites

Yes, it would be nice to have working terrain flattening (for me because it's more realistic and alters the hightmap ingame what I find interesting). But as I said in the ticket its a very bad thing to fix a visual inconvenience by adding a gameplay issue (especially if more code is needed for that). For me it feels like making the game worse by adding code - a very questionable way to go ;).

Many gameplay features planned for the game at the beginning are not working out yet (at least for me) like formations and stances. That doesn't mean we should abandon them totally but perhaps make them "optional" until they really work out or focus on things driving the game towards beta stage which may include dropping additional things from Part 1 and delay them to Part 2 (like for me advanced naval combat).

In the first place 0A.D. is a game and the first priority of a game should be to work and make fun. Even better if it doesn't annoy the player with it's behavior (otherwise it's less fun I guess ^^). For me it's much easier to accept inconveniences that occur because something is simple but I really hate things that "try to do it awesome" but in fact make it worse (for me in 0A.D. the non-descrete building placement would be such a thing).

I noticed that most community members most of the time prefer the "awesome looking" way without having a good solution at their disposal or (even better) a patch to test it. I don't know if all of the community members are aware of this, but adding all this awesome stuff needs time and delays getting to Beta phase longer. I don't say that 0A.D. is not working. Indeed it works quite fine. But there are some very basic (gameplay) features not working well like the unit AI (at least for me) or pathfinding (which is worked hard on AFAIK). Other features vital to an modern RTS game like "attack-move" are not at all implemented, yet.

So there's already enough work to do and adding "cool stuff" that will raise other complications (and for terrain flattening it's quite clear it will: On steep terrain the edges of the flattened part will get more steep) should be thoroughly thought trough before adding it as the default. Additionally it may effect the pathfinder as well (because it might also change the walkable terrain when applied to steep ground - the case it's meant for ;)) - another piece of code complicated enough already.

As a conclusion I'd say: thomasf: If you think you can make it work without much pain go for it as long as you keep in mind it may not be seen as the best solution in the end and so might not be added (I have to say for myself I don't see an approach working well in most cases that really fixes the issue but perhaps you do).

For the building foundations: I think in any case it would be good to have foundations reaching far into the ground. More natural looking foundations might be nice. This should be added to all new work while step by step adding this to the existing models as the art team sees fit.

For the Hellenic Civil Centre I gave a working solution in the ticket: http://trac.wildfire...t/21#comment:10

With a natural looking foundation it would work and look well IMO.

Edited by FeXoR
Link to comment
Share on other sites

Every feature has the risk of not being in the final game, but i think there's no need to discourage the development. You, Pureon and FeXoR, are a bit afraid of the results, not remembering everything can be restored to the original point. I say let Thomas develop it and research about the possible solutions to the problems you say. There is always the problem of time, but you are forgetting that it will be worked upon one way or another, so let someone start it!

Link to comment
Share on other sites

Every feature has the risk of not being in the final game, but i think there's no need to discourage the development. You, Pureon and FeXoR, are a bit afraid of the results, not remembering everything can be restored to the original point. I say let Thomas develop it and research about the possible solutions to the problems you say. There is always the problem of time, but you are forgetting that it will be worked upon one way or another, so let someone start it!

I agree! I just wanted to tell that I "don't see" a way to make it work well especially in the cases it is meant for. I personally find it very frustrating to put quite some work in something just to see it's not added. If I where aware of the possibility that and a concrete reason why my work would NOT be added I could at least mentally prepare for that disappointment. By telling this I want to avoid the big frustration of the contributor in the end though that might mean I discourage him a bit in the first place.

In many cases I changed my approach (or chose it in the first place because of discussions befor I started the work or even totally abandoned a "feature") because someone else told me about the problems that may arise with an other approach previously preferred by me.

So at least I for myself find comments to things I'm working on very helpful especially if they unveil problems/issues/flaws I didn't see before.

I hope my words where not to rude. I'm quite sure I'm not best at that :sorry:.

(I admire feneur for his ability to say things straight while staying kind (y) )

Edited by FeXoR
Link to comment
Share on other sites

  • 1 month later...

Alright, I believe that this is an issue that must be addressed sooner rather than later. Every RTS I have ever played has had terrain flattening which never seemed to cause any problems. The first time I played 0ad I didn't notice that the models weren't perfect or that the engine was buggy, but the lack of terrain flattening stuck out like a sore thumb.

My suggestion would be that buildings when built can flatten any ground but if the building is built on steeper terrain the cost of construction increases depending on the incline (like a 10 degree incline would have no penalty but building on a 45 degree incline would increase the cost by 50% ).

If no one else is willing to take care of this I can give it a try with my Javascript and limited C++ skills.

Edited by Josh
Link to comment
Share on other sites

I'm thinking we don't want buildings to be constructed on a 45 degree incline at any rate :) The problem with tying it into construction costs is that it enables "cheating" by modfying the terrain, if the price is right. Every competitive advantage that an RTS allows will be used, and personally I would find it very annoying if someone went along and modified a rolling hill into an impassable cliff - essentially modifying the natural strategic properties of the map, or manipulated terrain to fool the territory logic by cutting my territory in two (cutting it off from the CC for instance). What about using it to modify bodies of water? I just think that in an RTS, every terrain detail has a strategic value and allowing that to change during the game needs to be very carefully considered or prevented.

If you want to build on the side of a cliff, don't, but if there are minor fluctuations in the terrain that makes a building look ugly, I think that's a valid argument for terrain flattening. And maybe as someone else suggested, it could be visual only and not influence pathfinding, since the descrepancy would be very small, but I have no idea how we'd make the distinction between terrain for rendering and terrain for pathfinding.

Link to comment
Share on other sites

  • 2 weeks later...

I've been thinking about a solution to this problem.

Say the terrain of your map is defined by a function f(x):

EORUy.png

When building something on the terrain, the engine would apply a leveling function g(x) to f(x):

PoMPF.png

For convenience, we can call f(x) the surface terrain and g(f(x)) the bedrock terrain.

In the spot where you are building, the engine would transform the terrain from the surface terrain into the bedrock terrain of that spot:

AJ2ac.png

Because this transformation is independent of the current terrain, no matter how many times you build something in the surrounding spots, the terrain would only ever transform into the shape of the bedrock terrain.

So the player can 'deform' the terrain once in a given spot, but not more.

Link to comment
Share on other sites

In the spot where you are building, the engine would transform the terrain from the surface terrain into the bedrock terrain of that spot

That's a very interesting idea. Visually this might look very odd in places. I can picture low buildings hiding themselves in hillsides.

Unit pathfinding wouldn't be affected because units would walk around the building like normal. Once the building is destroyed, the terrain would have to automatically transform back to how it was originally, otherwise it would be too easy to create impassible terrain walls.

Link to comment
Share on other sites

That's a very interesting idea. Visually this might look very odd in places. I can picture low buildings hiding themselves in hillsides.

In which cases would buildings hide themselves in hillsides?

Unit pathfinding wouldn't be affected because units would walk around the building like normal. Once the building is destroyed, the terrain would have to automatically transform back to how it was originally, otherwise it would be too easy to create impassible terrain walls.

True, I did not really think of that :) Maybe in practice the 'hillsides' of the 'bedrock' could be slanted enough to be passable. Dunno.

Link to comment
Share on other sites

In which cases would buildings hide themselves in hillsides?

Picture mountains all around the building - the building flattens to the lowest point in the valley creating steep terrain all around it. It's unlikely to happen, but it's what came to mind when thinking about potential flaws :)

Link to comment
Share on other sites

A lot of people seem to agree there are different buildings. Buildings which look great with foundations (walls, towers...) and buildings which don't (markets, CCs...).

Why not, instead of flattening the terrain, smooth it, and place the building a bit tilted on it. Certainly for the market (with those tents), it would look normal when it's tilted (a tent on a non-flat terrain is always tilted). For huts of the celts, this could also be used.

On the other hand, buildings that need to look strong (like the Greek CC), they can't be tilted without looking stupid. So strong building should need to have deep foundations.

Anyway, my 2 cents.

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