1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[3.17] Stock map scripts broken

Discussion in 'Civ4 - Bug Reports' started by syndicatedragon, Aug 14, 2008.

  1. syndicatedragon

    syndicatedragon Warlord

    Joined:
    Nov 14, 2003
    Messages:
    135
    Location:
    St. Louis
    Both Custom_Continents and Team_Battleground (and maybe others) have been broken by the patch.

    In Custom_Continents, set up a 4 team game with 8 civs, and select the "One Per Team" option for the number of continents. The following python exception occurs:
    Code:
    File "Custom_Continents", line 1032, in findStartingPlot
    NameError: global name 'shuffledTeams' is not defined
    
    A similar error occurs in Team_Battleground with the same setup:
    Code:
    File "Team_Battleground", line 718, in findStartingPlot
    File "CvMapGeneratorUtil", line 1245, in findStartingPlot
    File "Team_Battleground", line 648, in isValid
    NameError: global name 'shuffledTeams' is not defined
    
    Obviously the method that those scripts use to count teams is no longer working, or something of that nature. I'm not sure how this could escape any kind of regression testing, though... :rolleyes:

    Can any map script wizards out there suggest a fix?

    Thanks

    (edit) I tested these map scripts with Civ4, Warlords and BtS 3.00 and Bts 3.13. They only fail in BtS 3.17
     
  2. Woody1

    Woody1 Prince

    Joined:
    Feb 19, 2002
    Messages:
    468
    Location:
    Texas
    Confirmed about the python errors. However, the map generation does seem to work. The only strange thing is that it sticks the team members on different continents. I don't know if that's supposed to work that way, but it seems busted.
     
  3. syndicatedragon

    syndicatedragon Warlord

    Joined:
    Nov 14, 2003
    Messages:
    135
    Location:
    St. Louis
    When the map scripts work, team members at least start nearby to each other (though, not always on the same land mass, as far as I could tell).
     
  4. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    Still no fix? Yesterday we used like half and hour to figure out that team battlegrounds simply don't work. Whats the point of TB if you start on separate continents? Someone even got placed in the middle (the crossroads) :(

    edit:
    I've tested a bit more:
    - land bridge in the middle is supposed to be desert and very narrow? It is not, it is 2 tiles in width and holds almost as much space as 4 islands around (on duel),
    - if land type set aint flat (toroidal for example) I get additional land bridges on the outer edges,
    - the player placement seems to work ok on custom singleplayer but on multiplayer it will place players of the same team on different continents most of the time - which is even worse than playing a team game on pangea...
    - this error seems not to be listed in the official bugs list

    Maybe there is a way to directly contact some map authors or someone well versed in map scripting is willing to help. Seems this could be fixed easily by someone who knows their business.

    p.s. how to use python debugger? game doesn't load if I enable that in debug section of the civ.ini...
     
  5. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    oops - I worked on TeamBattleGround for the patch - well, more accurately: they lifted my modifications and included it in the patch. I actually found a different error with it the other day when using 'circle' or 'donut' - no mountains except those added by the starting location algorithm.

    I'll take a look at this issue and see what I can do.
     
  6. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    Wow, this is fast :) Thank you. I will definetely stay tuned.
     
  7. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    Neikius - can you give me some back ground?
    1. What TBG option were you using (TvB, LvR, LvR + land bridge, Round, Donut)?
    2. How many players / teams / team per player?
    3. Did you specify 'teams start together' or 'teams start separated'?
    4. Can I ask you to test any mapscript that I produce?

    Also, note that I think that the description 'teams start together' is a bit misleading. It actually means 'team members start together', thus the teams are separated.
     
  8. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    I can test. Or anything else you might requre :D Tho I didn't set up the debugger yet (but will soon).

    Anyway the scenario: (team battleground)
    - 8 players, 4 teams (2 teams ai, 2 teams human)
    - four corners
    - teams start together


    The result was the same twice or even thrice, cant remember now. But my team got placed the same regardless of map size (tested tiny and duel).

    I as first player got the SW island on the E corner and my teammate got SE island on the W corner - so we were basically close together but not on the same island. This happened multiple times.

    Then later, I started a single-player custom game and it all worked ok. :confused:

    I'll go dig in a bit deeper now since I have some time.

    edit: some screens ... I got approx 15 error popups (all same)

    First screen from - duel, teams 4x2, start separated, four corners, other options default

    Second and third - duel, teams 4x2, start together, four corners, other options default



    edit2: oh and BTW, if you want and IM session just say, not a problem :) I wanna see this fixed and maybe even learn a bit in the process.
     
  9. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    looks like you are only testing '4 corners'. Have you had similar team members starting together problems on TvB, LvR, LvR with Bridge?

    We can talk via IM (yahoo nick is the same as cfc nick) - but I will not be looking at this in detail until tonight or maybe tomorrow night.
     
  10. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    Nah, we just went on to the ffa pangea after that. People loose patience quickly and there is never too much time:)

    About that "undeclared" variable, is is normal that we have same global variable declared twice? I have exactly no experience in python but that should not be a problem... I just don't have enough data to connect all the threads here.

    Well I am just testing now - 2 teams works fine (TvB, LvR with bridge), 3 teams on donut or 2 teams on donut also fine, 2 teams on 4 corners also fine :D Seems we narrowed down the error a bit eh?

    edit: ok the weirdest of it all : error just disappeared ... but I don't have people at the moment to test with people.

    edit2: I have had no luck with getting the debug console, I just dunno what I am doing wrong :S did everything it says in wiki. Bah, will try HAP debugger now. Anyway I am off to debugging :D The exact scenario of 4 corners and 4 teams of 2 can be reproduced, I just dunno why sometimes things that usually dont work start to work - automagically.
    And btw - I got msn messenger, so I add your handle and @yahoo.com at the end? Creeps the hell out of me :/
     
  11. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    I've been able to reproduce the error from here. I just started a multiplayer, hotseat game with four corners. I started a game with 5 human players spread over 2 teams.

    Now, here is a quiz for you ... look at the following and let me know what you think the answers would be ...

    gc.getGame().countCivTeamsAlive()
    gc.getGame().countCivTeamsEverAlive()
    gc.getGame().countCivPlayersAlive()
    gc.getGame().countCivPlayersEverAlive()

    Any sane person would say (given the set-up listed above) 2, 2, 5 and 5. This being the very start of the game and no one is dead yet. However, the actual result is ...

    Spoiler why we hate Civ4 sometimes! :
    2,5,5,5


    There just happened to be a bit of code in the mapscript ...
    Code:
    if gc.getGame().countCivTeamsEverAlive() < 5:
    	team_list = [0, 1, 2, 3]
    	shuffledTeams = []
    	for teamLoop in range(gc.getGame().countCivTeamsAlive()):
    		iChooseTeam = dice.get(len(team_list), "Shuffling Regions - TBG PYTHON")
    		shuffledTeams.append(team_list[iChooseTeam])
    		del team_list[iChooseTeam]
    
    ... that initialized the shuffleTeams variable ... but only when there are 4 or less teams. It was getting the wrong count (5 in my case, 8 in yours) and skipping that part of the code.

    I change it to ...
    Code:
    if gc.getGame().countCivTeamsAlive() < 5:
    
    ... and that should do the trick. Please let me know how you get on.
     

    Attached Files:

  12. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    How funny :D That is just the part I wanted to inspect in-depth, heh. Some kind of programmer's sixth sense? Ah anyway, thanks, seems to be working now.

    I wanna learn map scripting now :) If you have any nice pointers I'd be grateful. For now, just how did you inspect the values of those variables? Printing them? Will check later anyway... got to work a bit now.
     
  13. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    I used a display utility that we wrote for BUG. It is basically a decked out 'print' function with a few other nice things thrown in. As to how I found it - I put prints in at the start of each step and followed the bouncing ball. You can still see these in the py file (BugUtil.debug) but I have commented them out. You have to enable logging (ini file) and then check the python log file for the results.
     
  14. GooglyBoogly

    GooglyBoogly Freakamongus

    Joined:
    Apr 20, 2008
    Messages:
    725
    Location:
    New Zealand
    Would be a good idea to add this fix to the downloads database.
     
  15. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    Going to - just waiting for some testing feedback.
     
  16. Neikius

    Neikius Chieftain

    Joined:
    Sep 20, 2008
    Messages:
    61
    Well, we didn't play since the last time ... usually we do like once or twice per week and usually during the weekdays. So I guess if not earlier it will be sometime this week. At least I hope so becouse I really need another dose soon :)
     
  17. ruff_hi

    ruff_hi Live 4ever! Or die trying

    Joined:
    Oct 24, 2005
    Messages:
    9,049
    Location:
    an Aussie in Boston
    Ok, here is a new version of the mapscript. I've done some work on the teams starting together for ROUND and DONUT. If you select 'start together', then the teams now start together.
     

    Attached Files:

Share This Page