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

Regenerate Map in Multiplayer

Discussion in 'Civ4 - Creation & Customization' started by CrazyCanuck87, Aug 6, 2011.

  1. CrazyCanuck87

    CrazyCanuck87 Chieftain

    Joined:
    Oct 29, 2007
    Messages:
    42
    I play MP with a couple of friends quite frequently, usually on a LAN. In the interest of playing a game that everyone is going to enjoy, we often restart quite a few times to make sure that everyone has reasonable starting land. In MP, the Regenerate Map option in the menu is disabled, which makes sense, since you wouldn't want someone to be able to regenerate the map in online games whenever they didn't like their land. However, for local games with three friends who can agree whether or not to regenerate, it would save a lot of time to have a Regenerate Map button, rather than quitting to the main menu, creating a new game, and setting everything up again...

    I've done a small amount of Civ4 modding, but I don't know where to start to add the Regenerate Map button to Multiplayer games. Any ideas?
     
  2. Baldyr

    Baldyr "Hit It"

    Joined:
    Dec 5, 2009
    Messages:
    5,530
    Location:
    Sweden
    I wouldn't have any idea, but it dawned on me that there is a CyMap.rebuild() method in the Python API:
    According to the documentation it is "used to initialize the map during WorldBuilder load". Now, even if invoking this method in a game actually worked, you'd still have to be able to access the Python Console. I bet its disabled also in MP games. :p

    I guess you could have a mod where a custom hotkey calls this method, but there would probably be immediate Out Of Sync issues! So all other players would still have to re-join the game.

    This is just me speculating, so...
     
  3. CrazyCanuck87

    CrazyCanuck87 Chieftain

    Joined:
    Oct 29, 2007
    Messages:
    42
    I found an easy way to add the button, but I foresee some potential problems, as Baldyr suggested. All I did was edit line 2012 of CvDLLButtonPopup.cpp to remove !(GC.getGameINLINE().isGameMultiPlayer()). Unfortunately, I'm alone right now, so I can't test it fully, but I started a LAN game by myself, and Regenerate Map was available as an option. It regenerated the map successfully, but I'm worried that there might be problems when playing with other people.

    Will their maps be updated too? Will there be synchronisation problems? I will of course test this as soon as possible, but if anyone with more DLL modding experience than me can warn me of potential problems, ideally with ideas for solutions, that would be great!


    UPDATE: I tested with another player, and it was more or less as expected: my map regenerated, but the other player's map did not, and the game went out of sync. She was able to quit and rejoin, on the new map, which is faster than both of us quitting and creating a new game, so it's better than what we had for the problem we were trying to solve, but still not ideal.

    Does anyone know of a way to send the new map over when it is regenerated, perhaps by calling some of the functions used when the game first launches?
     
  4. marshaul

    marshaul Chieftain

    Joined:
    May 18, 2014
    Messages:
    8
    Excellent!

    The lack of even having an *option* to enable this feature in multiplayer was, IMO, a huge (and rather insulting) oversight.

    I suspect it would prove fruitless to attempt to "fix" the OOS issue, simply because the game itself provides no mechanism to deal with "ordinary" OOS except for the offending player(s) quitting and re-joining.

    Still, this is a huge, huge, huge improvement over the vanilla build. Starting a new multiplayer game is so absurdly tedious w/out this feature I'm amazed anybody plays it at all.

    I tried to similarly enable the worldbuilder in multiplayer by eliminating the same condition from the canDoControl function definition, and while the button appeared, it seemed to provide no functionality. Perhaps the worldbuilder itself performs a similar check? I will poke around later...
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Enabling WB in MP is suicidal.
    None of the functions in WB is MP compatible.
    Nice necromancy skills though.
     
  6. marshaul

    marshaul Chieftain

    Joined:
    May 18, 2014
    Messages:
    8
    Neither is regenerate map, but OOS is hardly a "suicidal" result.
     
  7. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    So what is the point of resurrecting a dead and buried thread just to teach others how to screw your MP game?
     
  8. The Snug

    The Snug The Civ Heretic

    Joined:
    Dec 5, 2003
    Messages:
    954
    Location:
    Seattle
    No thread is ever dead. Why are you complaining about it?
     
  9. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    If it is meaningful, by all means talk about it.
    What is the purpose of a thread that teach you how to screw your game?
     
  10. marshaul

    marshaul Chieftain

    Joined:
    May 18, 2014
    Messages:
    8
    I find it hard to regard anything which empowers the user (player) as "screwing".

    I play multiplayer games with folks who insist on having a "good" starting spot. (The mere existence of this thread indicates I am not alone.)

    In single player, this is easily resolved by using "regenerate map", and occasionally making a tweak using the worldbuilder.

    I see no fundamental reason why multiplayer should be any different. Thanks in part to our Canadian friend, it's actually very easy to get halfway there. I was merely reporting my failure to get all the way there.
     
  11. eldrakon

    eldrakon Chieftain

    Joined:
    Jun 14, 2016
    Messages:
    1
    After playing CIV4 BTS for a lot of years, i tried to search if there is a recent solution to this problem. But the closest thing i found to a solution is on this thread, the one provided by CrazyCanuck87. I cant make it work though.
    Has anyone found another way in the meantime?
     
  12. plasmacannon

    plasmacannon Chieftain

    Joined:
    May 5, 2010
    Messages:
    1,605
    Gender:
    Male
    Location:
    Orlando, Florida
    Good question. This would be an awesome feature to include in mods.
    I am playing a 6 continent game with a friend vs. 16 AIs.
    It is time consuming to switch 16 open slots to AI every time we have to reset it.
    I wish there was a checkbox to keep them as AI, defaulting to Open (as normal) if left unchecked.
     
  13. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,330
    Location:
    israel
    You can set the slots in the gameinfo folder in thw world info file.
     

Share This Page