Page MenuHomeWildfire Games

Farmstead cleanup
ClosedPublic

Authored by temple on Jul 9 2017, 2:40 AM.

Details

Summary

I matched obstructions to the edges of the buildings and made footprints +2m from that.
There's more large farmsteads than small ones, so for efficiency's sake I changed the default to be large.

I'm thinking the "height" part of the footprint is obsolete? And I think it only needs to be redefined if you change the footprint shape from circle to square. So I deleted most heights. (The Carthage farmstead had height = 6 instead of 8, but I can't see how that has any logical connection to its art compared to other civ's buildings. I think the selection box for everything except fields uses the artwork (in some way; I don't know the details) rather than the footprint.)

Test Plan

Check that all the footprints, obstructions, foundations, and rubble look okay.
You can use the demo map from D710 to help test. Add the line

	if (template.indexOf("_farmstead") == -1)
		continue;

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

temple created this revision.Jul 9 2017, 2:40 AM
bb added a subscriber: bb.Sep 7 2017, 2:14 PM

Need a rebase, so didn't test the values

binaries/data/mods/public/simulation/templates/structures/maur_farmstead.xml
18 ↗(On Diff #2872)

sad there is no 2*3 foundation or so... => ok here for now

binaries/data/mods/public/simulation/templates/template_structure_economic_farmstead.xml
16 ↗(On Diff #2872)

it seems a waste setting this here when we change it in all -1 templates, perhaps just don't set it

33–35 ↗(On Diff #2872)

same

temple updated this revision to Diff 3674.Sep 15 2017, 10:42 PM

Update per bb.

temple updated this revision to Diff 3675.Sep 15 2017, 10:43 PM
temple marked 3 inline comments as done.
bb accepted this revision.Sep 18 2017, 1:58 PM

Tested the obstructions in atlas, further everything logically related.

This revision is now accepted and ready to land.Sep 18 2017, 1:58 PM
This revision was automatically updated to reflect the committed changes.

Sorry to pop up, but as it breaks something, I looked quiclky and permit myself to ask something,

the "height" part of the footprint is obsolete
it only needs to be redefined if you change the footprint shape from circle to square.

Is it true?

So I deleted most heights.

Assuming that what is above is true,
if they was just random then it's ok, else we lost some information we need to find again (ok svn history could do the job ;-))

bb added a comment.Sep 18 2017, 3:01 PM

Notice that the only building that is changed by the height is cart (others already had the value of 8, which is now merged into the parent template). When comparing the actual height in Atlas there isn't much difference between the cart and other farmsteads so the value 6 was a random artifact.

In D726#35783, @bb wrote:

Notice that the only building that is changed by the height is cart (others already had the value of 8, which is now merged into the parent template). When comparing the actual height in Atlas there isn't much difference between the cart and other farmsteads so the value 6 was a random artifact.

sure, I was asking about that other statement

temple added a comment.EditedSep 18 2017, 4:24 PM

it only needs to be redefined if you change the footprint shape from circle to square.

Is it true?

That was my investigation a couple of months ago. Looking into the details now, from simulation2/system/ParamNode.cpp:

	int at_replace = xmb.GetAttributeID("replace");
...
			else if (attr.Name == at_replace)
			{
				m_Childs.erase(name);
				replacing = true;
			}

So I think it erases everything, meaning we have to add the height to brit_house:

<Footprint replace="">
  <Circle radius="6.0"/>
  <Height>5.0</Height>
</Footprint>

Edit:
It's a choice between Circle and Square, so we can't have both. But this works too, and maybe it's better:

<Footprint>
  <Square disable=""/>
  <Circle radius="6.0"/>
</Footprint>

I don't understand why you speak of Paramnode attribute.
My question was about

the "height" part of the footprint is obsolete

What does it mean and is it actually true?

I don't understand why you speak of Paramnode attribute.

Because you asked two things, if height is obsolete and if it needs to be redefined when changing the shape, and bb talked about the height being obsolete, and you said "sure, I was asking about that other statement", so I assumed you were asking about the other statement, i.e., about it needing to be redefined. :/

In D726#35818, @temple wrote:

Because you asked two things, if height is obsolete and if it needs to be redefined when changing the shape, and bb talked about the height being obsolete, and you said "sure, I was asking about that other statement", so I assumed you were asking about the other statement, i.e., about it needing to be redefined. :/

If you look at https://code.wildfiregames.com/D726#35781, you'll see the two things I was speaking about. Perhaps should I have split that in 3 points instead of 2. Well it seems the discussions interlinked.
Still.

In D726#35818, @temple wrote:

Because you asked two things, if height is obsolete and if it needs to be redefined when changing the shape, and bb talked about the height being obsolete, and you said "sure, I was asking about that other statement", so I assumed you were asking about the other statement, i.e., about it needing to be redefined. :/

If you look at https://code.wildfiregames.com/D726#35781, you'll see the two things I was speaking about. Perhaps should I have split that in 3 points instead of 2. Well it seems the discussions interlinked.
Still.

It's too exhausting trying to communicate with you, fatherbushido. Hope you're doing well.

In D726#35837, @temple wrote:

It's too exhausting trying to communicate with you, fatherbushido. Hope you're doing well.

I asked a naive question, it's not so hard to answer.

My question was about

the "height" part of the footprint is obsolete

What does it mean and is it actually true?

bb added a comment.Sep 19 2017, 3:41 PM

I guess these two comments explain what you are searching for:
CCmpfootprint.cpp:

"<element name='Height' a:help='Vertical extent of the footprint (in metres)'>"

ModelAbstract.cpp:

// create object-space bounds according to the information in the descriptor, and transform them to world-space.
// the box is centered on the X and Z axes, but extends from 0 to its height on the Y axis.

I tracked the code and the only place the height part is used is in ModelAbstract.* So the only thing (what i can find) is that the height defines the selection box of the entity.

Thx @bb
I still don't have my answer ;-)

the "height" part of the footprint is obsolete

What does it mean and is it actually true?

Just for guy of the future which would refer to that.

bb added a comment.Sep 19 2017, 4:59 PM

then i fail to understand the question i guess

Q: what does the "height" mean?
A: the vertical offset for the entity's top from the ground

Q: is it obsolete?
A: Not entirely since the selectionbox (!= player color line around building, but the pixels where the mouse can be, when clicking it would select the building) is influenced y the height. (A higher building gets a bigger box, so when he visually click on the roof of the building it would still select it and stuff, so he doesn't has to click the footprint)

fatherbushido added a comment.EditedSep 19 2017, 5:05 PM

@bb

Oh my question was "what does mean 'obsolete'?". And I agree with you with the second thing (I read the code too) but I would not have permit myself to conclude without knowing exactly what @temple meant.

So for future reader, we can say them: "you are not allowed to do anything and everything with height." ;-)

In D726#35874, @bb wrote:

Q: is it obsolete?
A: Not entirely since the selectionbox (!= player color line around building, but the pixels where the mouse can be, when clicking it would select the building) is influenced y the height. (A higher building gets a bigger box, so when he visually click on the roof of the building it would still select it and stuff, so he doesn't has to click the footprint)

I said obsolete because maybe in previous alphas the selection box was defined by the footprint, but today it's not! Try setting the height = 100, it has no effect on the selection, except for fields and trees:

$ grep "<SelectionShape>" * -R -A2
template_gaia_flora_tree.xml:    <SelectionShape>
template_gaia_flora_tree.xml-      <Footprint/>
template_gaia_flora_tree.xml-    </SelectionShape>
--
template_structure_resource_field.xml:    <SelectionShape>
template_structure_resource_field.xml-      <Footprint/>
template_structure_resource_field.xml-    </SelectionShape>

Footprint is used for spawn points and damage and maybe a few other things, but the height is ignored there. That was my point, that it doesn't matter if we change building heights because they aren't used anywhere.

fatherbushido added a comment.EditedSep 19 2017, 6:28 PM

@temple
Thanks for the answer. So let's agree that changing height for most of the current footprints won't change anything, which is not a reason to not care about those heights (as at least one part of the code can use it).
(In that patch we don't really lose information, I am not even convinced that the previous/number are not a bit random...)
(that was an idea to use them in r10593, before they were unused).