MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002060VCMIAI - Adventure Mappublic2015-02-09 17:452015-10-15 03:00
ReporterSXX 
Assigned ToIvan 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.97b 
Target VersionFixed in Version0.98 
Summary0002060: After loading game FuzzyHelper::estimateBankDanger not work properly
DescriptionAs result it's will always return zero danger for banks and AI will no longer able set goals properly: all heroes that not powerful enough to win will be sent to banks and die.

This one is somewhat tricky problem that me and @AVS spend multiple hours to investigate. It's happen because after loading the game "CBankInstanceConstructor::levels" no longer contain sub JSON vector called "guards". Without "guards" info "CBankInfo::getPossibleGuards" no longer able to return proper power of certain bank.

Though "chance", "combat_value" and "reward" are loaded properly. Full structure may be found here:
/config/objects/creatureBanks.json
Additional InformationAlso we checked several things here:

  - On saving it's looks like "levels" are serialized properly.
  - In save file binary it's also looks like all information in place.
  - Even on loading of save it's looks like that "guards" vector it's looks like that serializer attempt to read it, but this isn't 100% checked.

So most likely something bad happen within deserialization process.

If you want to get more useful data set breakpoint here:
/lib/mapObjects/CommonConstructors.cpp:431
std::unique_ptr<IObjectInfo> CBankInstanceConstructor::getObjectInfo(ObjectTemplate tmpl) 
const
{
    return std::unique_ptr<IObjectInfo>(new CBankInfo(levels));
}
TagsNo tags attached.
Attached Files? file icon AI_SXX_Naga_bank.h3m [^] (1,890 bytes) 2015-02-09 17:45
zip file icon bug_ai_banks_danger.zip [^] (400,818 bytes) 2015-02-09 17:51

- Relationships
related to 0001918resolvedWarmonger AI Overconfident About Creature Banks 

-  Notes
(0005433)
SXX (administrator)
2015-02-09 17:52

Also attached special test map I used for easier testing.
(0005434)
SXX (administrator)
2015-02-09 18:03

Also it's possible that it's should be duplicate of 0001918, but may be separate problem too.
(0005435)
SXX (administrator)
2015-02-09 18:41

And here is one more other addition so it's won't be forgotten. Before I find out that problem with banks caused by actual game bug I'm get an idea that it's would be great to add some "memory" for the VCAI.

So VCMI originally threat banks danger based on config files because it's can't know actual level of the object. Though once hero visited bank and die here AI should "remember" what exactly level of bank it is and as result threat it's danger more carefully.

Also had idea to make sure that next hero that visit bank should be at least a bit more powerful that previous hero that died here.
(0005655)
SXX (administrator)
2015-03-18 08:07
edited on: 2015-03-18 08:09

Bump this one as it's currently biggest problem with VCAI.
If anyone may want to help with it this may be extremely useful.

(0005665)
Warmonger (administrator)
2015-03-29 11:02

Not sure why it's assigned to me. Probably Ivan is the guy responsible both for JSon parser and object rewrite.
(0005669)
SXX (administrator)
2015-03-29 14:51

I think it's just assigned automatically. :-)
(0005676)
Ivan (developer)
2015-03-30 22:01

Now this is an interesting bug. I still have no idea why this happened but seems to be fixed now.

Short version - serialized *changed* key of std::map insert of loading new key into a buffer (variable on stack)

As result - data from this key was overwritten by subsequent loading.

Weird. But should be fixed.
https://github.com/vcmi/vcmi/commit/376b2436f842a3d977e96b094d0916f8ee19d144 [^]

- Issue History
Date Modified Username Field Change
2015-02-09 17:45 SXX New Issue
2015-02-09 17:45 SXX Status new => assigned
2015-02-09 17:45 SXX Assigned To => Warmonger
2015-02-09 17:45 SXX File Added: AI_SXX_Naga_bank.h3m
2015-02-09 17:51 SXX File Added: bug_ai_banks_danger.zip
2015-02-09 17:52 SXX Note Added: 0005433
2015-02-09 18:03 SXX Note Added: 0005434
2015-02-09 18:41 SXX Note Added: 0005435
2015-02-10 10:10 AVS Relationship added related to 0001918
2015-03-18 08:07 SXX Note Added: 0005655
2015-03-18 08:09 SXX Note Edited: 0005655 View Revisions
2015-03-29 11:00 Warmonger Assigned To Warmonger =>
2015-03-29 11:02 Warmonger Note Added: 0005665
2015-03-29 11:02 Warmonger Status assigned => new
2015-03-29 14:51 SXX Note Added: 0005669
2015-03-30 21:24 Ivan Assigned To => Ivan
2015-03-30 21:24 Ivan Status new => assigned
2015-03-30 22:01 Ivan Note Added: 0005676
2015-03-30 22:01 Ivan Status assigned => resolved
2015-03-30 22:01 Ivan Fixed in Version => 0.98
2015-03-30 22:01 Ivan Resolution open => fixed
2015-10-15 03:00 SXX Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2018 MantisBT Team
Hosting provided by DigitalOcean