Opened 18 years ago

Closed 10 years ago

Last modified 10 years ago

#21 closed enhancement (fixed)

[PATCH] Building construction

Reported by: Stuart Walpole Owned by:
Priority: Should Have Milestone:
Component: Core engine Keywords: patch
Cc: thomas.fussell@… Patch:

Description (last modified by Stan)

  • Building rises out of ground as construction proceeds (#1174)
  • Scaffolding not necessary but maybe as a bonus if time allows? (#1581)

Attachments (2)

21.2.patch (7.6 KB ) - added by thomas 12 years ago.
21.patch (7.6 KB ) - added by thomas 12 years ago.
My attempt at a fix

Download all attachments as: .zip

Change History (25)

comment:1 by (none), 14 years ago

Milestone: Advanced Playability Demo

Milestone Advanced Playability Demo deleted

comment:2 by Andrew, 14 years ago

Milestone: Backlog

comment:3 by historic_bruno, 12 years ago

Description: modified (diff)
Summary: Entity Event - ConstructionBuilding construction
Type: taskenhancement

comment:4 by thomas, 12 years ago

Cc: thomas.fussell@… added
Keywords: review added
Milestone: BacklogAlpha 12
Summary: Building construction[PATCH]Building construction

This is my first patch and I thought it would be a useful issue to start on.

To summarise the changes:
-Added a section to Foundation.js component to flatten the surrounding area when construction is started.
-Added method to complement ICmpTerrain::GetGroundLevel(), ICmpTerrain::SetGroundLevelRegion(). This method sets all height values to the same value for a given (possibly rotated) rectangular region.
-Added setter to CTerrain to set value of heightmap at a specific point.

The main issue now is smoothing into surrounding tiles and updating the footprint decal once the height changes. I'll be working on that.

Last edited 12 years ago by thomas (previous) (diff)

comment:5 by Kieran P, 12 years ago

Keywords: patch added
Summary: [PATCH]Building construction[PATCH] Building construction

by thomas, 12 years ago

Attachment: 21.2.patch added

by thomas, 12 years ago

Attachment: 21.patch added

My attempt at a fix

comment:6 by historic_bruno, 12 years ago

Are there any constraints on this, like the maximum height difference that is allowed? That might be more of a building restriction concern, but it's worth thinking about now if we're going to have terrain flattening.

One problem I anticipate is that building on a hill might create permanent impassable terrain tiles (due to slope) or dramatically alter the surrounding terrain. This would also potentially affect territories since they are terrain dependent. A related issue: the player might use this to their advantage by repeatedly placing foundations and deleting them before they finish. So I think we need to be very careful with how this is implemented.

in reply to:  6 comment:7 by MishFTW, 12 years ago

See ticket #1634

Replying to historic_bruno:

Are there any constraints on this, like the maximum height difference that is allowed? That might be more of a building restriction concern, but it's worth thinking about now if we're going to have terrain flattening.

One problem I anticipate is that building on a hill might create permanent impassable terrain tiles (due to slope) or dramatically alter the surrounding terrain. This would also potentially affect territories since they are terrain dependent. A related issue: the player might use this to their advantage by repeatedly placing foundations and deleting them before they finish. So I think we need to be very careful with how this is implemented.

comment:8 by thomas, 12 years ago

Those are some good points. I don't know what the correct answer is. We can look at other games for some suggestions. In Empire Earth, the elevation can't change that much so it isn't an issue. In reality, if someone is building a building on an incline, he can either excavate or build a basement foundation (like that which is done for walls in 0 A.D.). We could try building a "foundation" or prevent a player from building a building if the height difference is too great.

comment:9 by historic_bruno, 12 years ago

Yeah I think if the terrain flattening is purely a cosmetic concern, often it could be addressed by altering the models themselves, which removes any gameplay concerns. There may be a few structures where this wouldn't work or would look bad, like some of the civil centers. For the remaining cases we could place some tight constraints on the terrain flattening (e.g. at most 1-2m difference between min and max height) and perhaps even add to the construction costs to make it less exploitable.

comment:10 by FeXoR, 12 years ago

I'm not sure if the approach of terrain flattening is solving more issues than it creates especially since it "only" solves a visual issue and generates a gameplay issue. That's a bad trade IMO.

Sorry, thomas, but I feel I need to say this.

I think, and AFAIK is was pointed out by others before, all buildings should reach far into the ground to avoid flying buildings.

It's a bit of a shame that for the nice Hellenic Civil Centre that will not be enough but filling the gaps in the ground with lower parts of another color should fix it, too, and if the terrain is about flat they will not be seen so in that case it would look like it is now.

Last edited 12 years ago by FeXoR (previous) (diff)

comment:11 by Kieran P, 11 years ago

Milestone: Alpha 12Backlog

Backlogged until a decision is reached. Best thing to do is open a thread in the "Development & Technical Discussion" forum and see what others think (reference this ticket, post screenshots of before and after your patch, list the benefits and the negatives, etc). Once we have a clear decision, we can move ahead with this one way or another.

comment:12 by FeXoR, 11 years ago

I think feneur would be best suited to do this ;)

But if nothing happens for a while concerning this I will do it.

Last edited 11 years ago by FeXoR (previous) (diff)

comment:14 by historic_bruno, 11 years ago

Description: modified (diff)

comment:15 by ben, 11 years ago

In 13143:

Adds building previews that rise during construction, fixes #1174, refs #21.
Adds scaffold support for foundations, includes two examples for 3x3 and 4x4, fixes #1581.
Extends CmpVisualActor and CUnit to support random variant seeds.
Fixes bug in actor hotloading.
Fixes serialization failure caused by destroying entities in OnDestroy handlers.

comment:16 by historic_bruno, 11 years ago

Description: modified (diff)

comment:17 by Jonathan Waller, 11 years ago

Description: modified (diff)

comment:18 by zoot, 11 years ago

Description: modified (diff)

comment:19 by Markus, 11 years ago

Keywords: design added; review removed

comment:20 by historic_bruno, 11 years ago

Owner: set to Philip Taylor

Philip is now working on a prototype of terrain flattening that is visual only, so it won't affect pathfinding: http://youtu.be/8iLXEhVRj94

Apparently it will be controlled by an entity flag, with a setting in Atlas to control whether a placed building uses flattening or not (more flexibility for the map designer).

comment:21 by historic_bruno, 10 years ago

Owner: Philip Taylor removed

There is http://git.wildfiregames.com/gitweb/?p=0ad.git;a=shortlog;h=refs/heads/projects/philip/terrain-flattening now, but it doesn't seem to be in active development, so I'm removing Philip as owner.

comment:22 by Stan, 10 years ago

Description: modified (diff)
Resolution: fixed
Status: newclosed

Fixing it as #2264 covers the last part.

comment:23 by Itms, 10 years ago

Keywords: design removed
Milestone: Backlog
Note: See TracTickets for help on using tickets.