MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002454VCMIAI - Adventure Mappublic2016-08-10 21:392022-04-12 11:04
ReporterSXX 
Assigned ToSXX 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.98g 
Target VersionFixed in Version0.99 
Summary0002454: AI turn extremely slow when wandering
DescriptionThis one is from one of saves @Povelitel passed me.
Going to profile it soon.

Map is called "This is legion 5". Player is Orange.
TagsNo tags attached.
Attached Fileszip file icon AISTUCK.zip [^] (2,315,709 bytes) 2016-08-10 21:39
zip file icon callgrind.zip [^] (380,764 bytes) 2016-08-10 22:40
zip file icon callgrind_25fd4d85e24f60552948ea10ffb47acaddc8ba8c.zip [^] (267,130 bytes) 2016-08-11 08:23
zip file icon callgrind_2.zip [^] (264,928 bytes) 2016-08-11 08:35

- Relationships
related to 0001713closedWarmonger very long turn AI - SectorMap memory leak 
related to 0002431closedSXX Crash during AI turn. (battle in crypt) 

-  Notes
(0006545)
SXX (administrator)
2016-08-10 23:24

While I'm not 100% sure I'll for now mark this one as related to 0001713 since extreme amount of time spent inside SectorMap code.
(0006546)
SXX (administrator)
2016-08-11 00:09
edited on: 2016-08-11 00:09

So while I not yet sure why exactly AI spend so much time to decide where to move, but it's pretty clear that it's getFlaggedObjects inside SectorMap create most of load while checking for embarking options

Not yet decide what is best solution for this one since it's not only the place where this weird code is used.

(0006547)
SXX (administrator)
2016-08-11 01:03

So for whatever reason VCMI::getFlaggedObjects didn't used "visitableObjs", but instead tried to get all the objects on map from scratch every time.

So I fixed this hog already:
https://github.com/vcmi/vcmi/commit/25fd4d85e24f60552948ea10ffb47acaddc8ba8c [^]

Even if now turn is few thousand times faster there no explanation why AI wander is slow slow so more investigation is needed.
(0006548)
AVS (administrator)
2016-08-11 07:29

Post updated callgraph please
(0006552)
SXX (administrator)
2016-08-11 14:01
edited on: 2016-08-11 14:02

So other directly related commit:
https://github.com/vcmi/vcmi/commit/b83dea20080b74b8e571f28c8616bb4efeef02d2 [^]

End up that AI have problem with map since it's have full visibility and there is 5500+ objects on it. For now we just optimized code so it's not as slow, but there is no big changes.

(0006553)
SXX (administrator)
2016-08-12 06:13

Added more optimizations that let AI avoid checking every object when possible.
https://github.com/vcmi/vcmi/commit/7bdcd209e61ec9dfa69f459c7f630ca082e2e20b [^]

While there is still more to improve these changes are good enough for that particular case.

- Issue History
Date Modified Username Field Change
2016-08-10 21:39 SXX New Issue
2016-08-10 21:39 SXX Status new => assigned
2016-08-10 21:39 SXX Assigned To => Warmonger
2016-08-10 21:39 SXX File Added: AISTUCK.zip
2016-08-10 22:40 SXX File Added: callgrind.zip
2016-08-10 23:23 SXX Relationship added related to 0001713
2016-08-10 23:24 SXX Note Added: 0006545
2016-08-11 00:09 SXX Note Added: 0006546
2016-08-11 00:09 SXX Note Edited: 0006546 View Revisions
2016-08-11 00:27 SXX Assigned To Warmonger => SXX
2016-08-11 01:03 SXX Note Added: 0006547
2016-08-11 07:29 AVS Note Added: 0006548
2016-08-11 08:23 SXX File Added: callgrind_25fd4d85e24f60552948ea10ffb47acaddc8ba8c.zip
2016-08-11 08:35 SXX File Added: callgrind_2.zip
2016-08-11 14:01 SXX Note Added: 0006552
2016-08-11 14:02 SXX Note Edited: 0006552 View Revisions
2016-08-12 06:13 SXX Note Added: 0006553
2016-08-12 06:13 SXX Status assigned => resolved
2016-08-12 06:13 SXX Fixed in Version => 0.99
2016-08-12 06:13 SXX Resolution open => fixed
2016-09-12 12:33 SXX Relationship added related to 0002431
2022-04-12 11:04 Povelitel Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean