Opened 9 years ago
Closed 9 years ago
#2946 closed enhancement (invalid)
[PATCH] Improve unit behaviour when constructing buildings
Reported by: | Moul | Owned by: | Jason |
---|---|---|---|
Priority: | Must Have | Milestone: | |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: |
Description (last modified by )
- When building a large buildings, it happens that units stay on the foundation, blocking it’s construction. That’s frustrating for fortress which won’t be build near the enemy.
- Units which can’t build, such as cavalry or special units. They should not stay around foundations because there are taking place of other builders. If you asked them to go that building, they should be a bit distant of the foundation.
- Point 2 should probably also apply to actions other than building/repairing, such as hunting/gathering.
Attachments (2)
Change History (15)
comment:1 by , 9 years ago
Component: | Core engine → UI & Simulation |
---|---|
Description: | modified (diff) |
Summary: | Improve construction of buildings → Improve unit behaviour when constructing buildings |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Description: | modified (diff) |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:4 by , 9 years ago
Description: | modified (diff) |
---|
comment:5 by , 9 years ago
Description: | modified (diff) |
---|---|
Keywords: | review patch added |
Summary: | Improve unit behaviour when constructing buildings → [PATCH] Improve unit behaviour when constructing buildings |
comment:6 by , 9 years ago
Not a full review (haven't checked the code in action), but is there any specific reason for using 10? This might cause issues with bigger buildings (like wonders, so using a property of the actual building would help). It also seems inconsistent with unit behaviour in all other cases (but that is an issue of this ticket and not your code).
I also don't remember the first bullet point from happening, which is an issue that should be fixed. A possible cause of this would be that the whole foundation is encircled by builders which prevents units from leaving it.
comment:7 by , 9 years ago
I didn't use 10 for a specific reason; it's very easy to change of course and thought it was a decent value for now. Could you elaborate on why it would cause issues with larger buildings, and how I might make this more consistent with other behavior?
Also, the first bullet point is confusing to me - I've never experienced this problem. Could you clarify what you believe the problem to be and how I might go about addressing it?
comment:8 by , 9 years ago
If a building has an obstruction size of more than 20 meters and the units stop 10 meters away from the foundation they might still be in the foundation and block construction.
Other actions (Build, Gather, Heal, etc) (see everything that tells UnitAI to switch to some "Order." state (only in UnitAI)) should use some similar logic, but that might cause different issues depending on the type of order given, so I'm not really sure if this ticket is something worth changing.
I haven't encountered the first bullet point at all (unless it was caused by the foundation being encircled by builders). This ticket was created by a player so verifying that the issues listed are still there is part of what should be done.
comment:9 by , 9 years ago
Description: | modified (diff) |
---|---|
Keywords: | review patch removed |
Summary: | [PATCH] Improve unit behaviour when constructing buildings → Improve unit behaviour when constructing buildings |
I see - I was under the impression that the target of the action was the edge of the foundation, not the center. That makes more sense.
I changed this for gathering as well, but you're right, it should be extended to more actions.
I'll do some edits (extending this behavior to other actions, taking things such as building size into account), look into the first bullet, test, and resubmit for another patch review. Thanks a lot leper.
comment:10 by , 9 years ago
Keywords: | review patch added |
---|---|
Summary: | Improve unit behaviour when constructing buildings → [PATCH] Improve unit behaviour when constructing buildings |
Here's an updated patch.
I've noticed that if you select, for example, a cavalry unit and a female worker and tell them to go build a house, the cavalry will stop just before reaching the foundation (desired effect) but if you tell them to do the same order again (just by clicking the foundation again) the cavalry will go all the way to the foundation. Click again - he'll back up. Etc. Not sure why that happens, but if someone could give it a look over, that'd be great.
by , 9 years ago
Attachment: | NonworkerDistance_PATCHv2.patch added |
---|
Incorporates size of target into calculations.
comment:11 by , 9 years ago
You calculate distance
but don't use it on line 5026.
You do not check if cmpObstruction
is null before using it.
Why are you using 10 * obstruction_size
? So the bigger the entity the farther away units will stop?
I'm still not sure if this ticket is the right way to solve the issue, why not just have hotkeys to only select the right units? But I'll ask some others for some input on that.
comment:12 by , 9 years ago
Keywords: | review removed |
---|---|
Milestone: | Alpha 18 → Alpha 19 |
comment:13 by , 9 years ago
Description: | modified (diff) |
---|---|
Keywords: | building patch removed |
Milestone: | Alpha 19 |
Resolution: | → invalid |
Status: | assigned → closed |
There has been no progress on this ticket, and the new pathfinder made things different.
The code for leaving foundations should work now (I rewrote that code), if bugs remain please open another ticket.
The bullet points 2 and 3 are actually a duplicate of #2159.
I'd like to give this a shot. I'll poke around the code myself but I'd appreciate it if someone could point me in the right direction, as this is my first time getting involved with 0 AD. Thanks.