#2446 closed defect (fixed)
Rounding problem in AI maxHitpoints for hele civs, making some units idle
Reported by: | mimo | Owned by: | mimo |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 19 |
Component: | AI | Keywords: | |
Cc: | Patch: |
Description
in common-api/entity.js the maxHitpoints of hele civs is a "not rounded" float, causing problems with the function isHurt. This lead to builders staying idle near their finished building (the AI thinks the building is not finished while the simulation has it finished). I've not been able to trace why this seems to happen only for the different hele civs ?
Change History (17)
comment:1 by , 10 years ago
Milestone: | Backlog → Alpha 16 |
---|---|
Owner: | set to |
comment:2 by , 10 years ago
r14864 contains a hack to temporarily cure the problem, waiting for a proper fix (see change in the isHurt function).
comment:4 by , 10 years ago
What do you mean exactly ?
- if a fix to simulation ? can you be more explicit on where you would put this Math.round and why this problem is seen with hele civs
- if a temporary hack on the ai side ? i've already implemented one which fulfills the ai needs
comment:6 by , 10 years ago
Well instead of this isHurt: function() { return (this.hitpoints() + 1) < this.maxHitpoints(); },
isHurt: function() { return (Math.round((this.hitpoints())) < this.maxHitpoints(); } to replace the tweak in http://trac.wildfiregames.com/changeset/14864
comment:7 by , 10 years ago
I'm pretty sure this is a problem with technologies being wrongly registered or something. Might be wrong though, it's been a while since I looked at it.
comment:9 by , 10 years ago
stan That would have been a possibility, but I've seen cases where the not rounding issue was bigger than 0.1 so as long as we don't know its origin, I'm not sure it can not be bigger than 0.5 from time to time. And as it is supposed to be only a temporary hack, I didn't want to loose time testing it in all possible situations and take the safe way.
Yes if nobody is currently looking at it, we can push it
comment:10 by , 10 years ago
Milestone: | Alpha 16 → Alpha 17 |
---|
Okay, Alway good to see new hacks :) Pushing it to A17.
comment:11 by , 10 years ago
mimo, is this still valid? Do you have any update on this, could it be fixed for a17?
comment:12 by , 10 years ago
Milestone: | Alpha 17 → Alpha 18 |
---|
I think wraitii wanted to have a look at it, but I guess he had no time.
comment:13 by , 9 years ago
Milestone: | Alpha 18 → Alpha 19 |
---|
comment:14 by , 9 years ago
Milestone: | Alpha 19 → Backlog |
---|
Moving to backlog as nobody is actively working on this and it's not a blocking issue.
comment:15 by , 9 years ago
Owner: | removed |
---|
comment:17 by , 9 years ago
Milestone: | Backlog → Alpha 19 |
---|
I'll give this a look, thanks.
(BTW while I'm at it thanks for the many AI bugfixes)