Opened 5 years ago
Closed 3 years ago
#5589 closed defect (fixed)
PETRA.getLandAccess gamePosToMapPos p is undefined common-api/map-module.js
Reported by: | Freagarach | Owned by: | Silier |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 24 |
Component: | AI | Keywords: | |
Cc: | Krinkle | Patch: | Phab:D3244 |
Description
SVN 22882. At turn 1092 an error occurred:
ERROR: JavaScript error: simulation/ai/common-api/map-module.js line 44 TypeError: p is undefined
http://irclogs.wildfiregames.com/2019-09/2019-09-10-QuakeNet-%230ad-dev.log
Attachments (2)
Change History (11)
by , 5 years ago
Attachment: | commands-modif.txt added |
---|
comment:2 by , 5 years ago
The replay produces the same error on r22893:
ERROR: JavaScript error: simulation/ai/common-api/map-module.js line 44 TypeError: p is undefined m.Map.prototype.gamePosToMapPos@simulation/ai/common-api/map-module.js:44:10 m.Accessibility.prototype.getAccessValue@simulation/ai/common-api/terrain-analysis.js:145:16 PETRA.getLandAccess@simulation/ai/petra/entityExtend.js:72:1 PETRA.AttackPlan.prototype.updatePreparation@simulation/ai/petra/attackPlan.js:551:15 PETRA.AttackManager.prototype.update@simulation/ai/petra/attackManager.js:264:21 PETRA.HQ.prototype.update@simulation/ai/petra/headquarters.js:2766:3 PETRA.PetraBot.prototype.OnUpdate@simulation/ai/petra/_petrabot.js:118:3 m.BaseAI.prototype.HandleMessage@simulation/ai/common-api/baseAI.js:64:2
Map was neareastern_badlands.js
.
comment:3 by , 5 years ago
Summary: | AI common-api pathfinder bug. → PETRA.getLandAccess gamePosToMapPos p is undefined common-api/map-module.js |
---|
Tested using:
Index: binaries/data/mods/public/simulation/ai/petra/entityExtend.js =================================================================== --- binaries/data/mods/public/simulation/ai/petra/entityExtend.js (revision 22892) +++ binaries/data/mods/public/simulation/ai/petra/entityExtend.js (working copy) @@ -69,6 +69,13 @@ PETRA.getLandAccess = function(gameState, ent) { if (ent.hasClass("Unit")) + if (!ent.position()) + { + warn(uneval(ent.id())) + warn(uneval(ent.templateName())) + } + + if (ent.hasClass("Unit")) return gameState.ai.accessibility.getAccessValue(ent.position()); let access = ent.getMetadata(PlayerID, "access");
It is entity 878
and that entity has no position, it is a units/brit_infantry_spearman_b
. So that unit promoted or died that turn.
Then it sounds like either the bot should disregard the unit at that point or actively remove the unit from its knowledge. Perhaps upon destruction / rename, though I guess it doesnt get those messages? I have no experience.
comment:4 by , 5 years ago
Cc: | added |
---|
comment:5 by , 3 years ago
Debian package 0.0.23.1-5
Map "Greek Acropolis (2)"
Happened at the very end, twice.
Attachment with metadata.json, commands.txt, and screenshot
comment:6 by , 3 years ago
Priority: | Should Have → Must Have |
---|
comment:7 by , 3 years ago
Actually position is undefined if entity is out of world, so might be garrisoned
comment:8 by , 3 years ago
Milestone: | Backlog → Alpha 24 |
---|---|
Patch: | → Phab:D3244 |
Replay.