1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Current Fix for the Forest Spam Bug

Discussion in 'Civ4 - Unofficial Patches' started by Dresden, Jul 31, 2008.

  1. Dresden

    Dresden Chieftain

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    I've been going through the diffs between the unofficial patch source (0.19) and the original 3.17 source to see which changes I wanted to incorporate into my personal game core and I don't understand the fix for the forest spam bug in CvGame::normalizeAddExtras(). (i.e. The game filling your starting location with forests before it tries to place extra resources.)

    Based upon my reading of SevenSpirits' details for fixing it, the forest-adding code is supposed to be moved from its original placement before the resource-adding loop to a later position either after the resource-adder or further down after the hill adder. Quoting part of the linked post:
    Note the phrases "move the forest-adding code" and "cut and paste." However, in the current unofficial patch source, that section of code seems not to have been moved but instead copied as it exists in both its original position and in one of the recommended spots after the resource function.

    Further muddying the waters, Bhruic talked about a different fix in a reply (#1310) to the above quoted post. After reading his comment and looking at that source, that fix did involve essentially copying the forest loop but it also reinstated the randomizer so that the first pass-through didn't cover every tile. Since the second version of the forest loop matches Bhruic's second loop it seems like this fix was intended. However, in the sources for 0.19, the randomizer clause is still commented out meaning this is different from the Bhruic fix too.

    So which of the following is right?
    1. This patch implemented Bhruic's fix. If so, shouldn't the randomizer clause for the first pass be reinstated?
    2. This patch implemented SevenSpirits' suggestion. If so, shouldn't the first forest-adding loop be removed?
    3. This patch implemented its own fix different from the previous two. If so, could somebody explain it to me?
    4. None of the above. In that case, I'm hopelessly confused... ;)
     
  2. GooglyBoogly

    GooglyBoogly Freakamongus

    Joined:
    Apr 20, 2008
    Messages:
    725
    Location:
    New Zealand
    You aren't the only one.
     
  3. Denniz

    Denniz Where's my breakfast? Moderator Hall of Fame Staff

    Joined:
    Nov 28, 2003
    Messages:
    11,029
    Gender:
    Male
    Location:
    Dallas
    I am confused. Solver's 0.19 matches Better AI 0.35. Are they both wrong?
     
  4. Dresden

    Dresden Chieftain

    Joined:
    Jul 10, 2008
    Messages:
    1,081
    I believe that part of Better AI 0.35 was simply copied from Solver 0.19 since I don't see it specifically mentioned in the posted Changelog; I don't follow that project real closely, however and haven't looked at the source.

    As for the main question of whether it is wrong, the purpose of this topic is to get that question answered. It looks to me like the unofficial patch doesn't actually do anything to fix the problem since the pre-resource forest loop is in-place and unmodified. Thus the BFC can still get completely filled with forests before the resource-adding loop executes and the newly-added second forest loop shouldn't have any effect. SevenSpirits' suggestion was to move the forest loop and Bhruic's fix involved uncommenting the randomizer so only part of the BFC would be forested the first time through; both methods leave at least some of the land tiles free for resource-adding. I don't have nearly the SDK-modding experience Solver has, though, so it's possible that a different fix was implemented that I'm just not seeing. Thus, the questions posed at the start of this topic.
     
  5. jdog5000

    jdog5000 Revolutionary

    Joined:
    Nov 25, 2003
    Messages:
    2,601
    Location:
    California
    Interesting ... I did just copy over Solver's code for Better BTS AI, so unfortunately I can't lend any insight in to what was or was not intended initially. Thanks for bringing this up, I haven't really looked into how these fixes were done before. Just based on the short descriptions you included certainly something needs to change, I like the sound of Bhuric's solution of turning on the randomizer as a middle ground between the current state and just moving the foresting code.

    I was wondering why the over forested starts were still happening ...

    On a loosely related note, my guess is Solver is a bit overloaded right now with RL and perhaps crunch beta testing for Colonization ... perhaps someone could step up and create an unofficial unofficial patch. I, of course, would advocate people use Better BTS AI but understand that somewhat experimental changes may not be for everyone.
     
  6. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Posting so I can find this thread again later.

    Is there a mod out there that fixes this issue yet?
     
  7. ahe247

    ahe247 Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    3
    There's absolutely no difference between the official 3.19 patch and the latest unofficial patch when it comes to this part of the code.

    Is there a problem?
     
  8. Fuyu

    Fuyu Chieftain

    Joined:
    Nov 5, 2009
    Messages:
    1,220
    Location:
    Austria
    The forest placing code really is there twice, but the first time there's this line
    if (getSorenRandNum((iCount + 2), "Setting Feature Type") <= 1)
    which should prevent that 100% forest spam.
     

Share This Page