MPMPM - Multiplayer Mod DLC-hack (Updated!)

cicero225

Warlord
Joined
Jan 19, 2014
Messages
294
https://drive.google.com/file/d/0B_QtChYZXeeDUHpuNFJiYVFmdDQ/view?usp=sharingSince the creator of the original thread and code, Gedemon, is no longer active on these forums, and there have been significant updates in the meantime, I am making a new thread with an updated first post. Actually, Gedemon has PM'd me, and I guess I officially have permission now...

(Code last updated: March 31 2016. Steam Workshop Link. Includes a picture guide!)

The intent of this thread is to provide Civ 5 mod users with the ability to play their favorite mods in multiplayer. It is not terribly user-friendly, but it works quite well, and without the strenous limitations that Jaii der Herr's more user-friendly project still has. The idea is that by packing all the mods you want to use into something that looks like a dlc pack, Civ 5 can be tricked into loading the mods on start, and then you can play it with mods in multiplayer through the standard multiplayer interface, but only with others who have the same fake dlc pack.

If you want a much more user friendly tool, check out https://forums.civfanatics.com/threads/mppatch-easy-modded-multiplayer.617806/ , which I think is based part on MPMPM. In my testing it works, though it has some glitches, especially with dll mods and Vox Populi. Still, depending on your needs, it may be perfect.


(Modders who want compatability advice, look here. Troubleshooting advice for those having trouble making their own modpack is at the bottom of this post.)

In order to play with multiplayer mods, you have two options, which I will detail below. You can either play with a premade dlc pack (PC + MAC (!) +Linux (unconfirmed)), or you can make your own (the person making it has to have a PC).


Premade DLC packs.


Everyone who wants to join a multiplayer mod game must do the following, and use the same pack. The pack must be removed again to play regular civ 5. When starting a game with fake dlc pack, use the normal multiplayer menu (NOT the mods menu).

Windows:
1. Copy paste the folder into Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC.

MAC:
You will probably have to use command+shift+period to reveal hidden files.
1. Navigate to Macintosh HD/Users/{Username}/Libraries/Application Support/Steam/SteamApps/common/Sid Meier's Civilization V
2. Right_click -> Civlization V -> Show Package Contents
3. Place dlc folder in Contents/Home/Assets/DLC

Linux:
(Unconfirmed)
This post suggests that it can work on Linux: https://github.com/Gedemon/Civ5-MultiPlayer-ModsPack-Maker/issues/1

Available packs:

Vox Populi. Plenty of options, see: https://forums.civfanatics.com/threads/dlc-modpack-and-43-civ-version-repository.609278/

Lynnes: Community Balance Patch for Multiplayer (Outdated)

Cicero225's Anime Pack

Cicero225's Touhou-only Pack Link is dead.

Haken Browning's Wish for a World-centered Anime Pack (Link is to his post, since he explains it better than I can).

Alrek's Five-star Compilation (Again, link to post) Link in post is wrong, though, should be http://www.filedropper.com/mpmodspack Link is dead.

Emeralis Wish for the World centric modpack.

Athaboros Quality of Life modpack.

Khundians JFD Civs pack Note that the only working link appears to be here: http://forums.civfanatics.com/showpost.php?p=14177692&postcount=721 EDIT: Apparently that link is dead too now...

DoctorRoosterMD's UPDATED JFD Civs pack (Direct Link)


Bacon Bomb's Ultimate Civ Modded MP Experience Link in post is dead, use https://drive.google.com/file/d/0B_QtChYZXeeDcjF6Yk9HdDhQTXM/view?usp=sharing

eharper256's Prime Cuts Pack Link dead for now

Gothic Empire's Light Pack
Working link: http://www.file-upload.net/download-10872615/ramen_empire_immersion_lite.zip.html

Serp's Multiplayer Improved Experience pack

CivAddiction’s Multiplayer Modpack – CP+CSD+C4DF+Serp’s+And More! (BETA)

darkchaos452 Pack (experimental)

ptr1ck's Steampunk pack

Reisen's Touhou + Community Balance Patch (tested). This is a DIRECT LINK

Mostly Untested Neptunia Pack
Superpower: Clash of Civilizations Pack

Those of you who have made working modpacks, I strongly encourage you to post download links to the compiled version, and I will link them here.


Making your own Modpack! (This assumes you have existing experience working with Civ 5's mod tools, and that you're on a PC)

There is a picture guide at http://steamcommunity.com/sharedfiles/filedetails/?id=361391109. However, if you have problems, you should read this much more complete guide.

[Note: if you want to make a multilingual modpack, see http://forums.civfanatics.com/showpost.php?p=14105122&postcount=652 for a few more steps to perform]

Preparation:
1. Ensure you have Firetuner 2 installed and civ 5 logging turned on in the config.ini file in your "..\Documents\my games\Sid Meier's Civilization 5" folder. Also, if "EnableTuner = 0" then change it to "EnableTuner = 1" then save the file.
2. Review the mods you want to include and ensure there are no conflicts. (Check known conflicts farther down in this post)
3. If you have a dll mod (one that contains a CvGameCore_Expansion2.dll), remove the dll from the mod and store it somewhere you'll remember.
4. Download this (or the attachment to this post, it's the same thing) and extract the folder into Documents\My Games\Sid Meier's Civilization 5\MODS.

Main Step. Be willing to either turn off your antivirus briefly, or wait 2 hours with civ 5 locked up.
1. Start Firetuner
2. Start Civ 5
3. (Highly Recommended) Set Civ 5 graphics to Windowed mode. This will provide easy access to Firetuner and will let you more easily do other things on your computer.
4. In the Mods menu, load all desired mods, as well as "MultiPlayer ModsPack Maker (v 1)" (which should be on the list)
5. Start a single player mod game with any settings.
6. Once game is loaded, switch to fire tuner. The active tab should be "Lua Console". Below the tab name, there is a dropdown menu. Select the MPMP_Maker from that list (should be one of the first, the name may be truncated but will start with "\Users\[yourName]\Documents").
7. The real-time protection of antiviruses, such as Microsoft Security Essentials, Windows 8's built-in Windows Defender, or AVG, will hyperventilate on step 8, turning a 20 second process into a 2-hour process. It is best to disable your antivirus now, unless you're feeling paranoid.
8. Type CreateMP() into the command line at the bottom and press enter.
9. If you did not do step 7, then go make lunch, eat lunch, etc. It will take a while, ~2 hours. This is normal. It will seem to be stuck forever on "\Users\USER\Documents\My Games\Sid Meier's Civilization 5\MODS\MultiPlayer ModsPack Maker (v 1)\MPMP_Maker: Copying: Language_en_US". That is also normal.
10. Once civ 5 begins working again, and if there are no errors noted in firetuner, exit out of civ 5 entirely. Remember to turn your antivirus back on!
11. If you have a dll from step 3 of the preparation stage, copy it now into "\Steam\steamapps\common\sid meier's civilization v\Assets\DLC\MP_MODSPACK". Also copy it back into its original location, so the original mod will work.
12. The next time civ 5 starts, both single player and multiplayer should include all mods. All players in a multiplayer game must have the dlc pack for it to work! Distribute the folder "\Steam\steamapps\common\sid meier's civilization v\Assets\DLC\MP_MODSPACK" to all players and have them copy it into the same place! If you wish to play normal civ 5 again, you must remove this folder. Use the normal multiplayer menu to play, not the mods menu!

Additional Operations (Highly Recommended, but a bit involved)

Double check the database.log (in Documents\My Games\Sid Meier's Civilization 5\Logs) for any errors. Unfortunately, there will be many errors even if it's working fine. See here for a database.log for a working dlc pack (none of these errors are meaningful). Be especially worried about "No such table" errors.

Known Mod Conflicts:
Unresolved:
Ask Nicely and Someone May Give Figure Out a Hotfix:

Beyond the Future
Ocean Cities: desyncs whenever the nonhost founds a city
Europe with Capitals has no scenario

Don't Ask, it Can't Fixed Without a Lot of Work:
Events and Decisions: Desyncs every turn after the first decision has been taken. Unfortunately, probably can't be fixed without a major rewrite of the mod itself.

Resolved Issues (requires hotfix/additional modification):
Whoward's Pick 'n Mix dll pack (v54 and later)
See the second part of Problem 3 in troubleshooting below.
Whoward's Pick 'n Mix Mods Summary or Overlay mods (luxuries, barbarians, etc.)
See http://forums.civfanatics.com/showpost.php?p=13766459&postcount=288. Only include the Contextptr lines that are relevant to the mods you are trying to include.
More Luxuries
If the luxuries have missing graphics/you cannot build improvements, then remake the modpack. When loading the mods, first uncheck all mods, make sure to reselect More Luxuries first, then reselect the rest. Make the rest of the modpack as usual.

Communitas map
Workaround: After starting the game, IMMEDIATELY SAVE. Quit, and then reload the saved game. Now everyone should have the host's version of the map.


Confirmed Working:
Vox Populi, provided you do the correct procedure for mods with a custom DLL as above. Note: when trying to make the modpack the game will be unplayable due to a glitch with the corporations window, but the procedure should still work.

Vice Virtuoso's Miku, Nanoha, and non-Wish for the World Madoka civs. Arturia, and Gilgamesh. Railgun, Hidamari, Cthulhu, Recettear, Illyasviel von Einzbern, and every Touhou civ except Aya and Tanuki (have not been tested). Fire Emblem - Beorc Civpack v2. Active Multiplayer AI and New Beliefs. ALL of JFD's civs, plus Ayyubid and Oman.

Great Admiral Aquaculture v1, New Beliefs v1 (Sep 3 2014), Scorchers v2, Resource Buildings v1, Truly Free Great People v1. Civ Names by Policy. Enhanced UI.

Marvel Heroes and religion packs.

Vice Virtuoso's Wish for the World works, provided that you fix Whoward's Pick 'n Mix dll pack as detailed above.

Troubleshooting

Problem 1:
Should be automatically dealt with, with newest version of code

Problem 2: Trying to run CreateMP() gives a "invalid pattern capture" error.
Possible Solution 2a: Go back over the .modinfo file in all the mods you're using within "Documents\My Games\Sid Meier's Civilization 5\MODS". If any of them has SupportsMultiplayer set to 0, change it to 1.
Possible Solution 2b: Unless you are absolutely certain you downloaded the code off of THIS POST after Sep 5, 2014, you may have an outdated version of the MPMP code. Redownload, and then you will probably have to skip down to Problem 11, below.

Problem 3: Trying to run CreateMP() gives "attempt to call field 'DeleteMPMP' (a nil value)". There is a dll mod included in the set of mods.
Possible Solution 3: Ensure that your dll mod has "CvGameCore_Expansion2.dll" temporarily removed. If the error still occurs, open the .modinfo for the dll mod and temporarily remove the following line (YOURS WILL BE DIFFERENT):

Code:
<File md5="{Your md5 will vary}" import="0">CvGameCore_Expansion2.dll</File>

DO NOT LOSE THIS LINE. PASTE IT SOMEWHERE AND SAVE IT.

After compiling, copy this line back into the .modinfo in both ""\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\MP_MODSPACK\" and the original mod in
"Documents\My Games\Sid Meier's Civilization 5\MODS".

Problem 4: Certain core game sound effects are missing.
Possible Solution 4: See Additional Operations above.

Problem 5: Custom mod music is missing/some game text is missing
Possible Solution 5: Ensure that you have downloaded the version of the mod pack maker included in this post (this) and not the old version in the previous thread..

Problem 6: Custom mod unit sound effects are missing.
No Current Solution: Currently, custom unit sound effects is not supported. Ask in the thread and someone may hotfix it.

Problem 7: Custom unit action buttons are missing/not working
No Current Solution: Having multiple mods that have custom unit actions is a known conflict. It is being worked on.

Problem 8: The dlc pack is HUGE.
No Current Solution: Your mods have a lot of custom music. There is nothing that can easily be done about that. You can try deleting all .mp3, .ogg files if you don't care about music, but this is risky.

Problem 9: Cannot start multiplayer game; one of the players reports a "Cannot select civilization error"
Possible Solution 9: Ensure once again that all players (and the player with the error in particular) have identical copies of the modpack.

Problem 10: Multiplayer games keep de-syncing at the end of the turn!
Possible Solution 10: Ensure once again that all players (and the player with the error in particular) have identical copies of the modpack.
No Current Solution: Multiplayer games do not play well together with the Events family of event handlers. Many of these, particularly the one that fires at the end of a turn, cause desyncs. It is possible that one of the mods you use has such a function. If you are skilled enough, you can try to fix it...or you can ask the guy who made the mod.

Problem 11 CreateMP() returns the error "Failed! Couldn't find folder for mod: {whatevermod}"
Should no longer occur. Obviously, post if it does.

Problem 12: When attempting to start a modded game before running the MPMPM maker, the Single Player button is greyed out.
Possible Solution 12: It is likely that one of the mods you have included has SupportsSingleplayer set to 0 (though this is very rare) in the .modinfo file. If this is the case. Set it to 1 and try again.

Problem 13: After starting a game, the City View screen is completely broken. Also, Enhanced UI for Civ 5 is involved (at least one of the players/modpack maker has it)
Possible Solution 13: Unfortunately, the version of MPMPM that is made depends on the version of EUI being used by the modpack maker. The easiest solution is to ensure everyone has the EXACT SAME version of EUI, probably the most-updated one. Alternatively, everyone who has a different version of EUI (or no EUI) can make their own version, but that's obviously kind of a pain. Alternatively, if you ask in the thread, there does exist an involved method for editing an existing modpack to work for a given computer, if you prefer.

Problem 13b: I'm not using EUI, but some other mod that makes big changes to the City View, Game main UI, leader UI, or Unit interface. These are bugged out/crashing/missing new features after I make the mod pack.
Possible Solution 13b: There is a good chance your mod has a custom version of CityView.lua, LeaderHeadRoot.lua, or InGame.lua. In that case, navigate to C:\Program Files (x86)\Steam\steamapps\common\Sid Meier's Civilization V\Assets\DLC\MP_MODSPACK\UI and open each .lua file and scroll to the very end. Look for any lines at the end of the file with:

Code:
ContextPtr:LoadNewContext(...)

Copy/paste ALL these lines somewhere safe, override the MP_MODSPACK version with the custom version from your mod, then copy/paste these lines to the end of your custom version.

In the future I hope to automate this, but that is not currently the case.

Problem 14: After making the modpack, the game complains of missing assets.
Possible Solution 14: There is a known bug in this where mods that have an internal name containing a colon ( : ) do not properly have their folder copied into the MPMPM folder. Navigate to "\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\MP_MODSPACK\" and look for any missing mod folders. Copy anything folders missing from "Documents\My Games\Sid Meier's Civilization 5\MODS". A proper fix is in the works but may take some time.
 

Attachments

  • Multiplayer Mods Workaround (v 1).civ5mod
    1 MB · Views: 5,120
Last edited:
One-stop post for the Wish For The World-centric modpack development, for simplicity's sake.

Update logs/download links: at the Google Doc

Latest v1.0.3.276-compliant version: Plan B v1 (April 17, 2015)
- Madoka Magica - Rebellion v12
- DLL - Various Mod Components v66
- Metal Gear Solid & Rising: MSF v15, Outer Haven v3, World Marshall, Inc. v4, Philosophers' Legacy v3
- Fate/Zero and /Stay Night: Arturia v8, Diarmuid v4, Iskander v6, Gilgamesh v9, Emiya v3
- Funny Valentine v2
- Nanoha v6
- Hatsune Miku v6
- 3rd Street Saints v6
- City of Heroes v9
- Hope's Peak Academy v2
- Recettear v3
- CIA v2
- Touhou (Graan and Huitzil): Remilia v6, Eirin v3, Cirno v9, Utsuho v5, Yuuka v1
- AND A NEW CHALLENGER! (who's actually been buried in the modspack for quite a while)


Planned for Future Addition:
- Touhou: Pretty much everyone that isn't that Touhou Legends-oriented Aya Shameimaru is up for consideration.
- Super High-School Level Content: You people like the Neps, I'll see what I can do about that.
- Modular Soundtracks: File bloat from Huitzil's Touhous alone made up some 75% of the filesize for v1.0.3.144-centric modspacks. I hope to ultimately introduce code-only iterations of soundtrack mods for Vice's civs, but music is a QoL thing that's a long way out still - first things first, the modspack content itself has to be stable and distributable.

me on September 3rd said:
Tonight's observations:
- Disabling AVG's real-time protection works for making CreateMP execute at turbo speed, per steps 7 and 8 (and obviating Step 9). An experimental nightly for Wish v17/DVMC v61 compiled in two minutes instead of my usual 2.5 hours.
- The experimental nightly in question involves making civs with unique action buttons key off Wish's UnitPanel.lua. So far, no success getting the Saints to work.
- Whatever DOES make the Saints work, it will also make MSF and Mamizou work.
 
It's awesome to hear that my mods work in multiplayer for the most part. I wanted to chime in with a few notes:

  • The next Rebellion Civpack update will use Game:IsNetworkMultiPlayer() in UMadoka's trait script to automatically switch between the more MP-friendly GameEvents.PlayerDoTurn and the closer-to-instant-that-I-want Events.ActivePlayerTurnEnd depending on whether or not the game is a MP game. (But now that I think about it, I might could actually use GameEvents.CanSaveUnit and *really* make it pop instantly like it does with DLL VMC. Will need to play around with it.)
  • Saints, MSF Subsistence, and Gilgamesh will be getting versions of their Missions which use DLL VMC's integrated mission support, as I get around to SQLizing/Decisionizing/YNAEMPizing them. They'll dynamically choose between the DLL VMC implementation and the Lua-only implementation depending on whether or not DLL VMC is active. (Probably not a good idea to make it check the mod ID, since technically no mods are active in an MP game, so I'll probably make it check for the existence of the CustomModOptions table.) The Saints should be done by Sunday night; the others will take longer.
  • I'm glad to hear about your discovery of disabling antivirus programs to make the process take less than a minute. That was the issue keeping me from attempting MP compilations of my own.


And a few questions:
  • Does Homura's Time Stop work in a multiplayer environment? From how I've coded things, I would think that if playing simultaneous turns mode, that the movement freeze wouldn't kick in until the next turn.
  • Any bizarre issues when Nanoha digs up a Logia? I had to really dance around things to make that system work.
 
It's awesome to hear that my mods work in multiplayer for the most part. I wanted to chime in with a few notes:

And a few questions:
  • Does Homura's Time Stop work in a multiplayer environment? From how I've coded things, I would think that if playing simultaneous turns mode, that the movement freeze wouldn't kick in until the next turn.
  • Any bizarre issues when Nanoha digs up a Logia? I had to really dance around things to make that system work.
Homura's time stop is the next thing that we need to test, because frankly it just sounds like it'd be broken. However, in our zest for having a working modpack, we picked Sayaka/Kyouko/Yuno without regards for testing needs. :lol: I might try to corral someone into testing Homura alone later.
No one has played Nanoha yet. I wasn't aware the logia thing was so problematic. Hmm...
 
I'll have to con one of my players into doing a non-Ancient start to look into Nanoha, but the Lost Logia system has worked just fine in Single-Player from MPMPM.

Also, will be running up a hotfix of v6 later tonight with an update of Resource Buildings. This is the price you pay when you mix Day 1 Steam Workshop releases into your modspacks, friends.
 
I'll have to con one of my players into doing a non-Ancient start to look into Nanoha, but the Lost Logia system has worked just fine in Single-Player from MPMPM.

Also, will be running up a hotfix of v6 later tonight with an update of Resource Buildings. This is the price you pay when you mix Day 1 Steam Workshop releases into your modspacks, friends.

We just tested Nanoha and Homura. Nanoha simply doesn't have the button when a team is on one. Homura's timestop causes a desync, specifically the game diverges since only Homura civ gets the effect, for everyone else the game continues. That is, nothing moves for Homura, but for the Nanoha civ all the units moved.
 
I'll have to con one of my players into doing a non-Ancient start to look into Nanoha, but the Lost Logia system has worked just fine in Single-Player from MPMPM.

Also, will be running up a hotfix of v6 later tonight with an update of Resource Buildings. This is the price you pay when you mix Day 1 Steam Workshop releases into your modspacks, friends.

Hmm, the button for building ruins is missing from my SP version too, and what's also odd is, while the Lost Logia team shows up the Units Table in my game database, it doesn't show up as being able to build and archaeology site in the Unit_Builds table, even though I see it explicitly in the sql. Hmm.

(Also, desync doesn't happen until the turn after the turn timestop is used, which is how we can see units in different places while being supposedly in the same game. Also, we haven't tried seeing if timestop works on non-allied human players, but I'm guessing it doesn't)

EDIT: Okay, something else is going on with Nanoha. Even in a non-DLC pack, normal mod game with Nanoha as the ONLY mod...I still can't use the lost logia containment team on an antiquity site. Uh...I can try to redownload it later, I suppose. Database.log and lua.log are unrevealing. The game database has a UNIT_LOST_LOGIA_TEAM, but no entry for it in UNIT_BUILDS...Actually, every single thing from NanohaUnit.sql from UnitGameplay2DScripts on is missing.

I think I know why. The sql file is trying to edit the "Promotions" table...but there is no Promotions table. I think it means UnitPromotions.




Will edit line, report back.

EDIT2: Yep, changing it from Promotions to UnitPromotions fixes the unit. Will try to hook someone into trying multiplayer now.

EDIT3: Also, the turn after you use Homura timestop is actually kind of funny.
Homura's perspective:
Spoiler :

Anyone else's perspective:
Spoiler :


Not surprisingly it crashes when the turn ends.

EDIT4: And Nanoha is fixed (except for some puzzling fast desyncs that may be completely unrelated)
 
Problem 2: Trying to run CreateMP() gives a "invalid pattern capture" error.
Possible Solution 2: Go back over the .modinfo file in all the mods you're using within "Documents\My Games\Sid Meier's Civilization 5\MODS". If any of them has SupportsMultiplayer set to 0, change it to 1.

Me and a buddy now have the game working almost just how we want it to in multiplayer. We are still having issues with some mods however. The above solution worked for some stuff, but in all honesty, not very many mods had that setting at '0' in the .modinfo file.

Has anyone gotten MPMPM to work with those 'Colonialist Legacies' civs without producing that error? Specifically Australia and Blackfoot, but any others would be nice.

I mention it because just as I was about to simply accept that 'they just don't work', I saw some mention of it in the original thread and then saw that Gedemon repsonded to a question with a question and then didn't seem to go back to the thread to continue the discussion for whatever reason :(
 
Me and a buddy now have the game working almost just how we want it to in multiplayer. We are still having issues with some mods however. The above solution worked for some stuff, but in all honesty, not very many mods had that setting at '0' in the .modinfo file.

Has anyone gotten MPMPM to work with those 'Colonialist Legacies' civs without producing that error? Specifically Australia and Blackfoot, but any others would be nice.

I mention it because just as I was about to simply accept that 'they just don't work', I saw some mention of it in the original thread and then saw that Gedemon repsonded to a question with a question and then didn't seem to go back to the thread to continue the discussion for whatever reason :(
Can you give the exact error message it gives? Someone in the previous thread already mentioned that the "Setting 1 to 0" thing doesn't always fix it, but it was long enough ago that I didn't try to follow up.
 
Can you give the exact error message it gives? Someone in the previous thread already mentioned that the "Setting 1 to 0" thing doesn't always fix it, but it was long enough ago that I didn't try to follow up.

It's this one:

Runtime Error: C:\Users\[USERNAME]\Documents\My Games\Sid Meier's Civilization 5\MODS\MultiPlayer ModsPack Maker\MPMP_Maker.lua:160: invalid pattern capture

This happens when using various mods, which I put down to an interincompatibility issue, but it even happens with some mods (Colonialist Legacies: Blackfoot and City State Diplomacy - for example) when you (or maybe just me?) try to do with only those mods activated.

What is most irritating about the error message is that although it tells you which mod it got stuck on, it doesn't give any information on which element made it get stuck :(
 
Hi,

i tried to create a own MP-Modpack but i still can´t get it work.
Every try i stuck at the point CreateMP().

I get this error as described here:

Problem 3: Trying to run CreateMP() gives "attempt to call field 'DeleteMPMP' (a nil value)". There is a dll mod included in the set of mods.
Possible Solution 3: Ensure that your dll mod has "CvGameCore_Expansion2.dll" temporarily removed. If the error still occurs, open the .modinfo for the dll mod and temporarily remove the following line (YOURS WILL BE DIFFERENT):

But i have no dll-Mod and in the .modinfo there are also no dll-files to be loaded.

I also tried only to activate MPMPM, and even then i get the same error when i enter CreateMP().

So what i´m doing wrong?
 
Creating a totally blank MP_MODSPACK defeats the purpose of MPMPM, but if you're getting the Nil Value error instead of a "no mods" or "invalid pattern capture" error, and also doing so even when you're not loading any DLL-dependent mods...hmmm...

Hop into (user)/Documents/My Games/Sid Meier's Civilization 5/cache and delete Civ5ModsDatabase.db. There could be cache data from previous activation of a DLL-dependent mod mucking things up. (This also has the side-effect of making CiV reload your subscribed mods next time you open the mod menu, in case there's any problems that can be fixed by iterative tweaking.)
 
It's this one:

Runtime Error: C:\Users\[USERNAME]\Documents\My Games\Sid Meier's Civilization 5\MODS\MultiPlayer ModsPack Maker\MPMP_Maker.lua:160: invalid pattern capture

This happens when using various mods, which I put down to an interincompatibility issue, but it even happens with some mods (Colonialist Legacies: Blackfoot and City State Diplomacy - for example) when you (or maybe just me?) try to do with only those mods activated.

What is most irritating about the error message is that although it tells you which mod it got stuck on, it doesn't give any information on which element made it get stuck :(

I may have to try those mods myself later, but are you sure you're using the version of MPMP linked in the opening post of this thread (the new thread, not the old thread)? I ask because line 160 is:

Code:
sTableStructure = sTableStructure .. sColumn .. "/>\n"

which has nothing that could generate a pattern capture error. You usually see those in, say, string.gsub, which is actually all over the file.

That aside, do these mods contain non-ASCII characters? I.e., Japanes or Chinese characters, or characters with accents like á . That is the answer I suspect, since the base lua string libraries are ascii only. It's probably necessary to switch to it to a utf-8 implementation...
 
I may have to try those mods myself later, but are you sure you're using the version of MPMP linked in the opening post of this thread (the new thread, not the old thread)? I ask because line 160 is:

Code:
sTableStructure = sTableStructure .. sColumn .. "/>\n"

which has nothing that could generate a pattern capture error. You usually see those in, say, string.gsub, which is actually all over the file.

That aside, do these mods contain non-ASCII characters? I.e., Japanes or Chinese characters, or characters with accents like á . That is the answer I suspect, since the base lua string libraries are ascii only. It's probably necessary to switch to it to a utf-8 implementation...

Sorry for double-post, but I wanted to make it more obvious that there was a new post:

I have found the solution. It is actually much simpler than I thought. For me the error occurs on line 179 (which, btw, DirtyFace, you probably have the wrong version of the code). The issue is actually because of folder naming. The code assumes your folder name is one of two formats:

1) Steam format: {mod name} (v {version number})
i.e.
Code:
[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

2) "civfanatics downloaded name" (this is what the comments say, but I don't what this is), which comes out like:
Code:
[bnw]_colonialist_legacies_-_the_blackfoot_confederacy_(v.2)

If you download Blackfoot off of the civfanatics link, he has the folder named "Colonialist Legacies - The Blackfoot Confederacy (v.2)", which matches neither format. Since the first one fails, it tries the second one, which happens to have erroneous statements:
Code:
folder = string.gsub(folder, ")", "")
folder = string.gsub(folder, "(", "_")

You can't actually use ( and ) in the gsub pattern, apparently (I had to look that up), so I corrected it to:
Code:
folder = string.gsub(folder, "%)", "")
				folder = string.gsub(folder, "%(", "_")

The proper form. No one has ever noticed this error because most people get their folder names from steam.

tl; dr: To get your thing to compile right, rename the mod folder containing blackfoot to:
Code:
[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

For any other civ with this problem, pay attention to the last lua message you see just before you get the error. It should say something like:

Code:
[517227.953] \Users\{USERNAME}\Documents\My Games\Sid Meier's Civilization 5\MODS\MultiPlayer ModsPack Maker (v 1)\MPMP_Maker: Copying [BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

Your big hint is the last line there. If your folder name does not match that, then you should rename your folder to match that.

You can also piece the name back together from your modinfo:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="90090edf-4691-4393-b7ed-e7f07e240387" version="1">
  <Properties>
    <Name>[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2)</Name>
The proper folder name is {Name} (v {version # in modinfo}).

I will update the OP to reflect this shortly, and upload fixed code.

The real proper way to do this, coding-wise, would be to search the Mods folder for the folder containing the relevant .modinfo, and use that folder. However, because of the way permissions work in civ 5, this cannot be done from lua - it needs to be done from the dll. Only Gedemon has the source code for the dll, so...

EDIT: OP now has fixed code.
 
Sorry for double-post, but I wanted to make it more obvious that there was a new post:

I have found the solution. It is actually much simpler than I thought. For me the error occurs on line 179 (which, btw, DirtyFace, you probably have the wrong version of the code). The issue is actually because of folder naming. The code assumes your folder name is one of two formats:

1) Steam format: {mod name} (v {version number})
i.e.
Code:
[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

2) "civfanatics downloaded name" (this is what the comments say, but I don't what this is), which comes out like:
Code:
[bnw]_colonialist_legacies_-_the_blackfoot_confederacy_(v.2)

If you download Blackfoot off of the civfanatics link, he has the folder named "Colonialist Legacies - The Blackfoot Confederacy (v.2)", which matches neither format. Since the first one fails, it tries the second one, which happens to have erroneous statements:
Code:
folder = string.gsub(folder, ")", "")
folder = string.gsub(folder, "(", "_")

You can't actually use ( and ) in the gsub pattern, apparently (I had to look that up), so I corrected it to:
Code:
folder = string.gsub(folder, "%)", "")
				folder = string.gsub(folder, "%(", "_")

The proper form. No one has ever noticed this error because most people get their folder names from steam.

tl; dr: To get your thing to compile right, rename the mod folder containing blackfoot to:
Code:
[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

For any other civ with this problem, pay attention to the last lua message you see just before you get the error. It should say something like:

Code:
[517227.953] \Users\{USERNAME}\Documents\My Games\Sid Meier's Civilization 5\MODS\MultiPlayer ModsPack Maker (v 1)\MPMP_Maker: Copying [BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2) (v 1)

Your big hint is the last line there. If your folder name does not match that, then you should rename your folder to match that.

You can also piece the name back together from your modinfo:

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="90090edf-4691-4393-b7ed-e7f07e240387" version="1">
  <Properties>
    <Name>[BNW] Colonialist Legacies - The Blackfoot Confederacy (v.2)</Name>
The proper folder name is {Name} (v {version # in modinfo}).

I will update the OP to reflect this shortly, and upload fixed code.

The real proper way to do this, coding-wise, would be to search the Mods folder for the folder containing the relevant .modinfo, and use that folder. However, because of the way permissions work in civ 5, this cannot be done from lua - it needs to be done from the dll. Only Gedemon has the source code for the dll, so...

EDIT: OP now has fixed code.

Wow, fantastic stuff!

Thanks for looking into that :)
 
This post is intended to include tips for modders who want their mods to be as multiplayer compatible as possible.

1. Make sure your namespace is unique
While not a problem in normal mods, in dlcs civ 5 only expects there to be one copy of any given xml file. If two files have the same name, it will use the most recently loaded one. Thus, DO NOT name any of your xml files something vague like Civ5Units.xml or Civ5Buildings.xml, because it may override something in the base game or another mod. Instead be scrupulous about naming your xml files something distinction. For example, if you're adding a civ called MyCiv, I recommend you name all your xml files xmlfileMyCiv.xml.

This also applies to lua functions. While the civ 5 lua does have separated scopes for functions, it is generally much safer to name your lua function MyCivFunction instead of just Function, because of the risk that some other mod or the game itself uses a function with the same name.

(Of course, if you intend to override a lua function, then that's something else.)

2. Make your lua functions as deterministic as possible
In Civ 5 multiplayer, only dll functions can be executed such that they affect all players at once. Lua functions execute locally. That means, if player 1 has something different happen from player 2, it will cause a desync. In practice, this means:
Random values should be generated in a way that is deterministic for all players (In practice, this means call Game.rand(), which uses the map seed, and not lua's math.random()).
Lua functions should, as much as possible, fire at the same time for all players.
Lua functions should always run for all players, every time.
Lua functions that run at the beginning of the turn generally work; those that run at the end of a turn generally don't.

One common offender in this regard is custom UI "decision" popups. There is currently no straightforward way of making sure that a decision transmitted by one player is transmitted to the others. One major workaround for writing custom lua to transmit information between players is: http://forums.civfanatics.com/showthread.php?t=561997 , which I highly recommend, but does involve good familiarity with lua.

3. Code efficiently!
The slower the code, the more likely different players will run them at slightly different speeds, triggering a desync.
To give one specific example of an optimization that is not usually thought of: A common type of lua script runs at the beginning of a new turn, to execute the trait of some civilization. In a modpack with 20 civs, if every mod runs a script at the beginning of the turn, this can substantially increase turn times and cause desyncs. Simply add lua code so that scripts that do not need to run if your civ isn't actually in the game don't even get included if your civ isn't in the game. This can be done by doing (for example):

Code:
function CthulhuCivStart()
	for _, player in pairs(Players) do
		if player:IsEverAlive() then
			if(player:GetCivilizationType() == GameInfoTypes["CIVILIZATION_RLYEH"]) then		
				GameEvents.PlayerDoTurn.Add(CthulhuReplaceHolySites)
				GameEvents.PlayerDoTurn.Add(CthulhuScienceFromFaith)
			end
		end
	end
end
Events.SequenceGameInitComplete.Add(CthulhuStart)

so that at the beginning of the game, this function checks for if Cthulhu is actually in the game, and only adds CthulhuReplaceHolySites and CthulhuScienceFromFaith if he is.

4. Dependency Awareness
This isn't multiplayer specific, but can address odd/puzzling issues that crop when mods that are dependent on more than one other mod work only some of the time (when loaded from the mods menu) and also causes the MPMPM maker to make a working modpack only some of the time. I'll let whoward explain it for me:

http://forums.civfanatics.com/showth...6#post14191146

This is something to be aware of if you're making a mod that relies on several other mods to work.
 
Lua functions cannot use a random value.

They can, but you have to do it the right way. Do not use the Lua math.random() function -- the number generated will be local to your machine and it will cause numerous problems. The game has a function called Game.Rand() which uses the map's random seed to generate the number, which should provide the same result to all players. Always use that.



I think I've come up with a workaround to the Time Stop hokeyness. If I make the UI button spawn a dummy unit, immediately kill it, then make the actual Time Stop function trigger via a GameEvents.CanSaveUnit call once that unit dies, it should prevent the desyncs. Anything called through GameEvents should prevent desyncs in most cases. (In WFTW, I'll also need to do this for the Pleiades and their monstrosity of a UA.)
 
Hi Haken Browning,

i tried as you described and removed Civ5ModsDatabase.db and later the whole cache-folder. But it´s still the same error as before. I can not execute CreateMP() without getting this error :(
 
They can, but you have to do it the right way. Do not use the Lua math.random() function -- the number generated will be local to your machine and it will cause numerous problems. The game has a function called Game.Rand() which uses the map's random seed to generate the number, which should provide the same result to all players. Always use that.

I think I've come up with a workaround to the Time Stop hokeyness. If I make the UI button spawn a dummy unit, immediately kill it, then make the actual Time Stop function trigger via a GameEvents.CanSaveUnit call once that unit dies, it should prevent the desyncs. Anything called through GameEvents should prevent desyncs in most cases. (In WFTW, I'll also need to do this for the Pleiades and their monstrosity of a UA.)
I stand corrected. I vaguely remembered something like that, but my memory was too sketchy about whether such a function actually existed.

Also that sounds amusingly kludgey, but I can't see why it wouldn't work. I'll be glad to test it when the time comes.
 
Top Bottom