Misplaced Special maps

Discussion in 'Fallout Tactics Modding' started by nadeauhugo, May 31, 2020.

  1. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    510
    Mar 9, 2014
    Have anyone experienced this bug? Could it be appening because of Melindil's Special maps encounter fix? Nothing is certain, but from experience, I can tell you the game engine sometimes (quite often actually) get totally lost in its Special map encounters locations, sometimes even show me like 5 special maps encounter around the same line of travel, even if none have been place in that worldmap area! It also sometimes seems to forget the rightfull place of some Special encounter maps I deliberately placed in a square or another, or replace them with some other special map. The behaviour seem to happen at random, but when it happends, the engine seem completely lost within itself.

    It is pretty stupid as sometimes, a "sea shore" Special map can appear in the middle of the desert. DAH!!....

    If anyone could isolate this behaviour and find a way to solve it, that would be AMAZING..

    Hugo
     
  2. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    510
    Mar 9, 2014
    Image
     

    Attached Files:

  3. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    510
    Mar 9, 2014
    Damn. Hell of a freaking bug I can tell you
     

    Attached Files:

    • Bug.jpg
      Bug.jpg
      File size:
      685.4 KB
      Views:
      18
  4. Melindil

    Melindil First time out of the vault

    81
    Apr 15, 2018
    I'm not sure I can explain the first part (special encounters happening where none were listed), but I can explain the second (wrong encounters appearing).

    The game keeps track of special encounters in an array (or, more accurately, a C++ vector) in the World object. At the start of a campaign, all special encounters are listed there, and locations on the map are indexed based on the position in the array. So, the first encounter in the array is numbered 1 (or 0, can't remember), and is marked on the world map with that corresponding ID.

    However, once a special encounter is triggered, that encounter is actually removed from the array/vector. When this happens, all others with a higher index / ID are shifted down by 1. But the IDs assigned on the world map don't change, so now each map location is pointing to a different, wrong encounter. And whenever the ID in a map location is greater than the maximum index left in the array, the last entry in the array is used.

    My fix should only take effect once the array becomes empty, bypassing code that dereferences the first entry in the array (as this causes a crash with an empty array). To confirm, you might check if the odd every-square-has-an-encounter issue still occurs with this patch disabled. If it does, then it's unrelated to the fix.

    Fixing this will be non-trivial, as I haven't decoded anything in the campaign map structure, and so I can't yet go in and shift all the encounter location IDs down by one when an encounter triggers. Best-case workaround would be to have the earliest anticipated encounters for the player to hit at the end of the encounter list. This way, fewer encounters will be shifted when the player hits one.
     
  5. nadeauhugo

    nadeauhugo Author of FOT mod THE SUM Modder

    510
    Mar 9, 2014
    Thanks, this is very informative of what's might be going down there. I made several tests with and without your fix and I was not able to trigger back the even I described. My strong feeling about this is that some sort of campaign data might get corrupted sometimes, or the savegame itself might get corrupted for some reason, bringning the two strange behaviour together (all the random map suddently appearing on the squad path for no reason, most of them being (obviously) misplaced.

    All my tests with fresh game (no save/load) show no error in special maps location and ID, even after opening 4-5-6 different special maps at random.

    Only notable thing happened is that I experienced a game crash without your fix, but as I have about 50 special maps, it might not be the behaviour you fixed that caused the crash. I experienced a similar crash around 2 times in the last months or so, again without emptying the special maps array.

    It feels like we are looking at possibly two new bugs here other the one you fixed, I don't know for sure, but it might be.