MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001229VCMIModspublic2013-03-04 17:362014-05-30 17:43
ReporterWarmonger 
Assigned ToIvan 
PriorityhighSeveritycrashReproducibilityrandom
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version0.92 
Target Version0.93Fixed in Version0.93 
Summary0001229: Random artifacts are not indexed properly
DescriptionArtifacts added as last ones (probably after artifact 256) are not indexed properly on adventure map. Sometimes they do work, but sometimes they show different index upon picking, sometimes game crashes when they are picked.

Additionally, sometimes different artifacts appear twice on "Testy Arts 4" map, even though they should not as they are drawn without replacement (0000119). Game also crashes when these are picked.
Steps To ReproduceInstall Withcking Arts and this mod
https://www.dropbox.com/s/7z3ps1jjb3lojp8/H4arts.rar?m [^]

There should be about 259 artifacts in total. Try to pick Crusader's Mace http://www.heroesofmightandmagic.com/heroes4/images/artifacts/minor_weapons.gif [^] or Logbook of The Master Sailor http://www.heroesofmightandmagic.com/heroes4/images/artifacts/minor_texts.gif [^] to get crash (random).
Additional InformationTwo mentioned artifacts arethe very last in the list of
VCMI\Mods\H4 arts - hero\mod.json

Which is probably also last processed (alphabetically) file with artifacts.
TagsNo tags attached.
Attached Filesjpg file icon 2013-05-31_HelmBoots092c.jpg [^] (28,825 bytes) 2013-05-31 06:28

- Relationships

-  Notes
(0003430)
Warmonger (administrator)
2013-03-04 17:40

I didn't find anything that would explain this bug in ArtifactID, adventure object subID or def list indexed by int.

It is possible, however, that this bug holds also for other types of objects, such as creatures.
(0003431)
Ivan (developer)
2013-03-04 18:15
edited on: 2013-03-04 18:19

I'm not sure that this is related to 256 - list in mod.json does not have anything to do with load order: artifacts in one mod are always loaded alphabetically and load order of mods is (somewhat) random - hashmap in filesystem.

Check log file to see real load order ("loaded artifact XXX" messages)

For example one of arts you mentioned have index < 200 and I still have the crash.

This one looks more like desync (likely during map initialization).

UPD: got exactly same crash even after disabling dosen of arts from one of mods. Not 256 problem.

(0003432)
Warmonger (administrator)
2013-03-04 18:37

Strange, as I noticed issues just today and only with recently added artifacts.

Something could also be wrong with the mod itself, but I added lots of arts already with no problems :?
(0003434)
AlexVinS (developer)
2013-03-04 21:00
edited on: 2013-03-04 21:02

In witchkings mod "imglarge.json" is not emplty but its empty in H4 mod. May be an issue or it`s unused?

(0003441)
Ivan (developer)
2013-03-12 16:14

Mysteriously solved? No longer reproducible for me. At least not with rev. 3289, these 3 mods + testy 4 map
(0003442)
Warmonger (administrator)
2013-03-12 19:41
edited on: 2013-03-12 19:45

Bug still persists.
One thing I noticed: it does not seem to happen in FIRST game you run after opening application, but does in next ones when you return to main menu.

(0003470)
Warmonger (administrator)
2013-03-29 11:42

This part of code is suspicious:

        case Obj::ARTIFACT:
        case Obj::RANDOM_ART:
        case Obj::RANDOM_TREASURE_ART:
        case Obj::RANDOM_MINOR_ART:
        case Obj::RANDOM_MAJOR_ART:
        case Obj::RANDOM_RELIC_ART:
        case Obj::SPELL_SCROLL:
            {
                int artID = -1;
                int spellID = -1;
                CGArtifact * art = new CGArtifact();
                nobj = art;

                readMessageAndGuards(art->message, art);

                if(defInfo->id == Obj::SPELL_SCROLL)
                {
                    spellID = reader.readUInt32();
                    artID = 1;
                }
                else if(defInfo->id == Obj::ARTIFACT)
                {
                    //specific artifact
                    artID = defInfo->subid;
                }

                art->storedArtifact = createArtifact(artID, spellID);
                break;

If artifact is not set or is not a scroll, new artifact with ID = -1 is created. The code is not correct even if it should never trigger (which I assume). Will investigate this part.
(0003471)
Warmonger (administrator)
2013-03-29 13:38
edited on: 2013-03-29 13:46

Debugging shows that real artifact stored in objects is different than what def shows. For example, both subtype of object and artifact ID are 55 (Vampire's Cowl), but adventure map def is Logbook of The Master Sailor (new art).

Game crashes when hero tries to equip artifatc in different slot than it should.
There must be some desync on game end / map reload, but I can't find anything.

(0003474)
Ivan (developer)
2013-03-29 18:59
edited on: 2013-03-29 19:11

Desync is in CArtHandler::getArtSync. That's well-chosen name :)

Don't know where it comes from exactly but it definitely here - parameter rand is same on both client and server but returned values are not.

Probably due to internal state (erasePicked flag) but can't say for sure - I'm not familiar with that code.

EDIT: found it

(0003476)
Ivan (developer)
2013-03-29 19:17

Should be fixed, rev 3298
(0003613)
Zamolxis (viewer)
2013-05-31 06:30
edited on: 2013-05-31 06:30

@Ivan/Warmonger: is this the same with what I still see in 0.92c, namely all WoG artifacts showing wrong image when I pick them up? (see screenshot)

Very easy to reproduce by loading the VCMI_Tests_2012 map and check artifacts around Sir Mullich.

(0003615)
Ivan (developer)
2013-05-31 11:26
edited on: 2013-05-31 12:50

In future - it is better to either set this to "feedback" or open new report. I often have resolved/closed filtered out to see only unresolved reports.

On topic - unrelated but will check this out. I think I know where this one is coming from.

UPD: fixed.


- Issue History
Date Modified Username Field Change
2013-03-04 17:36 Warmonger New Issue
2013-03-04 17:40 Warmonger Note Added: 0003430
2013-03-04 18:15 Ivan Note Added: 0003431
2013-03-04 18:19 Ivan Note Edited: 0003431 View Revisions
2013-03-04 18:37 Warmonger Note Added: 0003432
2013-03-04 21:00 AlexVinS Note Added: 0003434
2013-03-04 21:02 AlexVinS Note Edited: 0003434 View Revisions
2013-03-12 16:14 Ivan Note Added: 0003441
2013-03-12 19:41 Warmonger Note Added: 0003442
2013-03-12 19:45 Warmonger Note Edited: 0003442 View Revisions
2013-03-29 11:42 Warmonger Note Added: 0003470
2013-03-29 13:38 Warmonger Note Added: 0003471
2013-03-29 13:40 Warmonger Note Edited: 0003471 View Revisions
2013-03-29 13:46 Warmonger Note Edited: 0003471 View Revisions
2013-03-29 16:35 Warmonger Summary Artifacts over 256 are not indexed properly => Random artifacts are not indexed properly
2013-03-29 18:59 Ivan Note Added: 0003474
2013-03-29 19:11 Ivan Note Edited: 0003474 View Revisions
2013-03-29 19:11 Ivan Assigned To => Ivan
2013-03-29 19:11 Ivan Status new => assigned
2013-03-29 19:17 Ivan Note Added: 0003476
2013-03-29 19:17 Ivan Status assigned => resolved
2013-03-29 19:17 Ivan Fixed in Version => 0.93
2013-03-29 19:17 Ivan Resolution open => fixed
2013-05-31 06:28 Zamolxis File Added: 2013-05-31_HelmBoots092c.jpg
2013-05-31 06:30 Zamolxis Note Added: 0003613
2013-05-31 06:30 Zamolxis Note Edited: 0003613 View Revisions
2013-05-31 11:26 Ivan Note Added: 0003615
2013-05-31 12:50 Ivan Note Edited: 0003615 View Revisions
2014-05-30 17:43 beegee Status resolved => closed

Site | Forums | Wiki | Slack | GitHub


Copyright © 2000 - 2024 MantisBT Team
Hosting provided by DigitalOcean