Page MenuHomeWildfire Games

Fix a typo and adjust footprint and obstruction sizes
ClosedPublic

Authored by temple on Feb 8 2018, 2:21 AM.

Details

Summary

Fixed a typo in rP21144 that swapped the number of units on the long and short sides of a rectangle footprint, and used better names there.
Adapted the template analyzer in source/tools to see if the obstructions of any building was bigger than its footprint, which would cause trouble for spawning (it's messy but I can upload if someone wants it). Elephant stables and the Ptolemy civic center needed changes. Made the Carthage elephant stable inherit like the others.
Went through the circular footprints by hand, which are awkward because the obstructions are still rectangular. They were fine except for small ships from the Briton crannog, so I used a slightly larger footprint so they'd have an easier time spawning without hitting the crannog's obstruction.

Test Plan

Ptolemy civic center before and after the typo:


Circular obstructions: (Wonders are awkward but units have space to ungarrison on the sides.)

Crannog before and after the footprint change:


Ships spawning from docks, units ungarrisoning from ships (out the front which extends beyond the square obstruction), siege spawning from forts, units ungarrisoning from siege, and units spawning from heroes all seemed okay (although I didn't test every single combination).

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.Feb 8 2018, 2:21 AM
Vulcan added a subscriber: Vulcan.Feb 8 2018, 3:53 AM

Successful build - Chance fights ever on the side of the prudent.

Updating workspaces...
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (309 tests).....................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...
Vulcan added a comment.Feb 8 2018, 3:55 AM
Executing section Default...
Executing section Source...
Executing section JS...
Stan added a subscriber: Stan.Feb 8 2018, 7:02 AM

Hey that's pretty cool !
Did your script check for all units and buildings ?
Patch looks good.

elexis awarded a token.Feb 8 2018, 3:40 PM
elexis added a subscriber: elexis.Feb 8 2018, 3:46 PM

Adapted the template analyzer in source/tools to see if the obstructions of any building was bigger than its footprint, which would cause trouble for spawning (it's messy but I can upload if someone wants it).

It's something we should have, shouldn't we? Since this problem isn't going to go away by itself. So at least a ticket + messy patch attached as a file would help in case someone from the future wants to address the issue.
(Thanks for the a/b rename)

(Template changes shouldcould be committed separately I suppose, guess no need for another revision proposal)

source/simulation2/components/CCmpFootprint.cpp
243 ↗(On Diff #5712)

The set of typos is equal to the set of arguments in this statement or were there more? (So you're saying if the coordinate pairs had used x/y names it wouldn't have happened? :P)

temple added a comment.Feb 8 2018, 9:01 PM
In D1287#52615, @Stan wrote:

Did your script check for all units and buildings ?

Just buildings, and I did some units by hand.

In D1287#52621, @elexis wrote:

Adapted the template analyzer in source/tools to see if the obstructions of any building was bigger than its footprint, which would cause trouble for spawning (it's messy but I can upload if someone wants it).

It's something we should have, shouldn't we? Since this problem isn't going to go away by itself. So at least a ticket + messy patch attached as a file would help in case someone from the future wants to address the issue.

It's barely worth uploading, just thought it could save someone a few minutes if they were trying to do the same thing. I've used it for other things which is why there's extra stuff there. (Hmm, the stoa is missing rubble? I'll look into it.) I copied the data into a spreadsheet and calculated differences to actually see which ones had a larger obstruction than footprint.

source/simulation2/components/CCmpFootprint.cpp
206–207 ↗(On Diff #5712)

Here I was using a with x and b with y, but later I used b with x and a with y. That mismatch is the "typo".

If the "door" of the structure is pointed to the right, i.e. along the positive x-axis (in the usual x-y plane), then its depth = m_Size1 is the length in the x-direction (that's why halfSize.X uses m_Size1) and width = m_Size0 is the length in the y-direction. Later we want to convert between the coordinates on the perimeter of the structure and the distance travelled around the perimeter (analogous to cos/sin coordinates for an angle around a circle) starting from the door at (x_max, 0). At the end we convert these x, y structure coordinates to map coordinates by multiplying the u, v vectors by x, y (u points in the direction of the door).

bb added a comment.Feb 14 2018, 10:21 PM

Are you sure the greek theater, maur wonder and stonehenge thing, from screenshots have large enough footprint? (One could use the units_demo map to test things visually ingame)

Agree with elexis that template changes should be splitted, the cpp changes look correct and can be committed.

binaries/data/mods/public/simulation/templates/structures/brit_crannog.xml
8 ↗(On Diff #5712)

no need for .0, same below

binaries/data/mods/public/simulation/templates/structures/cart_elephant_stables.xml
6 ↗(On Diff #5712)

Special class removed, defensive added => ok

This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2018, 7:40 PM
This revision was automatically updated to reflect the committed changes.