MPMPM - converting Mods to DLC format for Multiplayer use

Status
Not open for further replies.

Gedemon

Modder
Super Moderator
Joined
Oct 4, 2004
Messages
11,499
Location
France
Note: I'm not working on this tool ATM, please use the updated and fixed version made by cicero225, thanks :)



old post below
**************************************

Since civ5 has been released, the only way to mod the game for MP use was either to change the original game files or "hook" the mod on one of the DLC. Both method work, but any mod using SQL needs to be converted to XML, which is almost as fun as deciphering Assign********Plots.lua

Jaii der Herr is still working on his tool to make it compatible with all mods (SQL included) and his approach should make it user-friendly.

But as I also needed something to test my own (SQL based) mods in MP, and as there have been a few request for it, here's the tool I've quickly made once whoward had confirmed it feasibility (thanks !). It's not at all user-friendly, but it should work for all mods (except scenario or mods using a custom setup screen)

It's a tool for modders that want to test their own work in MP or advanced users that want to share a modpack for MP.

Here are the prerequisite:
- knowing how to call a function in a context using firetuner
- knowing how to open and build a project with Modbuddy
- knowing how to re-install Civ5 if something goes wrong
- owning and knowing how to use an extinguisher (preferably carbon dioxide) if something goes very wrong

Step by step instructions:
- Download the project from gitHub
- Build "MultiPlayer ModsPack Maker (v 1)" using Modbuddy
- If not already done, edit the config.ini file in your "..\Documents\my games\Sid Meier's Civilization 5" folder, find "EnableTuner = 0" and change it to "EnableTuner = 1" then save the file
- Launch the Firetuner (that's one of the apps launched from the Civilization SDK, like modbuddy)
- Launch civ5
- Activate all desired mods (including MPMPM), launch a new game from the mods menu
- Once the game is loaded, alt-tab to Firetuner, the active tab should be "Lua Console"
- Below the tab name, there is a dropdown menu, with all lua states
- Select the MPMP_Maker from that list (should be one of the first, the name may be troncated but will start by "\Users\[yourName]\Documents")
- You can enter text in the line the bottom of the firetuner windows, type CreateMP() there and press enter
- Wait until the mod has finished copying data from the DB and the mods folder (it can take a bit of time, especially when copying the text database and big mods)
- Quit the game (not to main menu, completly !)
- Now you should have a "MP_MODSPACK" folder in the game's DLC folder ("..\Steam\steamapps\common\sid meier's civilization v\Assets\DLC") with all the mods data.
- Start civ5 again, launch a new game from the main menu, the modpack should be activated and available for SP (with achievement...) or MP (if every player use the same modpack, or if the modpack does not change anything related to gameplay)
- Check database.log if the game crashes before the main menu, or if there are errors in the Lua.log (there is also a MPMPMaker.log available but with limited error checking)

Limitations :
- Only working with BNW
- No support for scenario or custom setup screen (yet)
- You must manually delete the MP_MODSPACK folder in "..\Steam\steamapps\common\sid meier's civilization v\Assets\DLC" if you want to use the normal game again
- A savegame can't know or show if a DLC modspack was used
- There is no check for same DLC modspack activated in MP
- You must use the same original DLC as when the DLC modpack was created

How to use with another DLL mod:
- Before creating the modpack, move the custom DLL file (ie CvGameCore_Expansion2.dll) out of the folder of the DLL mod you want to use
- Create the modpack with the DLL mod activated
- Move back the DLL file in the DLL mod's folder AND copy it directly in "..\Steam\steamapps\common\sid meier's civilization v\Assets\DLC\MP_MODSPACK" folder


No computers were harmed during the making of this tool :D
But, please, do not use it near a nuclear power plant or the Large Hadron Collider.
 
Sounds great, Gedemon! I'll rope a friend into testing this with me over MP this weekend.
To be clear, I could compile this and set it up on my machine, then simply upload those files for another player to install, right? In other words, do the steps above need to be completed by each player on their own machine, or can I distribute a(n) MP-enabled add-on mod? I'm talking about CSD here, of course.
 
Sounds great, Gedemon! I'll rope a friend into testing this with me over MP this weekend.
To be clear, I could compile this and set it up on my machine, then simply upload those files for another player to install, right? In other words, do the steps above need to be completed by each player on their own machine, or can I distribute a(n) MP-enabled add-on mod? I'm talking about CSD here, of course.

You can zip the MP_MODSPACK folder and distribute the archive, yes, the other users will have to extract it in the DLC folder.

Just note the limitation relative to the original DLC, the player who create the pack has to deactivate all official DLC that the other players don't have BEFORE creating the pack (as it contains a copy of the DB - including DLC data - in XML format).

If you don't follow that, you can have this kind of issue:
say you create the pack with Babylon activated and send it to someone without that DLC, he may be able to select Babylon as a civ to play with (the civ is in the DB), but will get error messages relative to missing content (icons, images, models are not copied) and will crash on load.

Also note that deactivating an official DLC after the pack is activated won't change anything, all the database is initialized from the MP_MODSPACK folder only, ignoring all other DLC / expansion folder.
 
You can zip the MP_MODSPACK folder and distribute the archive, yes, the other users will have to extract it in the DLC folder.

Just note the limitation relative to the original DLC, the player who create the pack has to deactivate all official DLC that the other players don't have BEFORE creating the pack (as it contains a copy of the DB - including DLC data - in XML format).

If you don't follow that, you can have this kind of issue:
say you create the pack with Babylon activated and send it to someone without that DLC, he may be able to select Babylon as a civ to play with (the civ is in the DB), but will get error messages relative to missing content (icons, images, models are not copied) and will crash on load.

Also note that deactivating an official DLC after the pack is activated won't change anything, all the database is initialized from the MP_MODSPACK folder only, ignoring all other DLC / expansion folder.

That makes sense, I'll have to note that in my instructions once I give this a go. I'm surprised this hasn't earned any traction in the community (yet) - this seems, in my opinion, to be a huge step forward. Perhaps you should cross-post this to the multiplayer forum?
G
 
Let's call it a soft launch :D

Seriously, I'm fine with a limited audience as it also means limited support on my side, and I also see this as a temporary solution until Jaii der Herr's MP Mod Manager is completed... Like something to allow modders to test their creations in MP before a real tool is available for a large audience.
 
I've got the lua script to run (takes forever, but that's fine), and the DLC folder appears (with a cursory glance it looks complete), however civ crashes on startup.

CSD has a .dll, which you note requires extra steps (which I followed). I am, however, curious as to your line in the lua file where you state that dll mods must 'merge both projects' – are you saying I need to add your files to CSD, compile, then run that mod? Any additional steps to that process (you note an InGameUIaddin, though I'm not sure why)?

Edit: also, should either the lua or the dll for this be in the VFS? Just want to make sure all settings are correct on the front end. I'm re-running the script and trying again.
 
I am, however, curious as to your line in the lua file where you state that dll mods must 'merge both projects' – are you saying I need to add your files to CSD, compile, then run that mod? Any additional steps to that process (you note an InGameUIaddin, though I'm not sure why)?

Ignore that note, merging would be required only if we want a complete tool capable of installing/removing/configuring the modpack from in game.

Your crash occurs before the main menu or when launching a SP or MP game ?
 
Ignore that note, merging would be required only if we want a complete tool capable of installing/removing/configuring the modpack from in game.

Your crash occurs before the main menu or when launching a SP or MP game ?

The crash occurs while launching Civ. I'll see if I can dig up the log.
G

Edit: here are the crashdumps from my last two attempts.

https://www.dropbox.com/sh/toak2g9por0ca3j/_492837GMm

Double edit: I've tried it with and without the dll, and still no luck. I'll do what I can to help debug.
 
database.log ?
 
Thanks :)

I'll have to filter which files are copied from the mod, for now try to remove the XML files from your mod's subfolder in the Modspack (like Assets\DLC\MP_MODSPACK\Mods\City-State Diplomacy Mod (CSD) for Brave New World (v 21)\CIV5UnitClasses.xml and Assets\DLC\MP_MODSPACK\Mods\City-State Diplomacy Mod (CSD) for Brave New World (v 21)\CIV5Units.xml for example)

I should have thought of that, duplicate names for files, and the game use the last created.
 
Thanks :)

I'll have to filter which files are copied from the mod, for now try to remove the XML files from your mod's subfolder in the Modspack (like Assets\DLC\MP_MODSPACK\Mods\City-State Diplomacy Mod (CSD) for Brave New World (v 21)\CIV5UnitClasses.xml and Assets\DLC\MP_MODSPACK\Mods\City-State Diplomacy Mod (CSD) for Brave New World (v 21)\CIV5Units.xml for example)

I should have thought of that, duplicate names for files, and the game use the last created.

Ah, that makes sense. I've been meaning to change the names of those files in CSD for some time, I just never did - I think this is more of a flaw in CSD than on your end.

Removing those two files allowed it to load - testing it out now.
G
 
Me and Janboruta (and perhaps a few others), are gonna be trying out a multiplayer game with some modded civs (probably on Monday). I'll report back to tell you how it goes.

In the meantime, in there anything I should be aware of?

If you use Lua for gameplay effect, never use random numbers.
Don't use pUnit:pushMission but Game.SelectionListGameNetMessage.

And surely a lot of other potential desync causes...
 
If you use Lua for gameplay effect, never use random numbers.
Don't use pUnit:pushMission but Game.SelectionListGameNetMessage.

And surely a lot of other potential desync causes...

Even Map.Rand is unreliable?

I'm guessing anything referring to the active player will also cause problems...
 
Even Map.Rand is unreliable?

It's only meant for single CPU setups, ie Single Player or the host of MP. Use Game.Rand(iLimit, sReason) for "game safe" random numbers
 
Me, Janboruta and Sukritact have just played a multiplayer game with Napoleonic France and Tuscany included! I was playing Poland as "control", but I have to say, it was an amazing game. Nothing went wrong over the course of the game, which was fantastic. Sadly, we never got round to finishing it, but that's just as well for Sukritact because me and Jan were on the verge of wiping him off the face of the earth. Anyway, thank you very much for this tool - I'm sure it'll soon become very popular, very quickly. :p
 
It's only meant for single CPU setups, ie Single Player or the host of MP. Use Game.Rand(iLimit, sReason) for "game safe" random numbers
great, I didn't know it was exposed to Lua, thanks :D

Me, Janboruta and Sukritact have just played a multiplayer game with Napoleonic France and Tuscany included! I was playing Poland as "control", but I have to say, it was an amazing game. Nothing went wrong over the course of the game, which was fantastic. Sadly, we never got round to finishing it, but that's just as well for Sukritact because me and Jan were on the verge of wiping him off the face of the earth. Anyway, thank you very much for this tool - I'm sure it'll soon become very popular, very quickly. :p
I'm glad it has worked :)
 
So this looks very interesting for making a MP "DLC" mod. As the Owner of Civplayers I have always wanted to make a mod for the game to customize the settings to make the game more balanced for MP. Unfortunately I am not a programmer at all. Is there any of you keen modder types interested in helping the MP community create a mod that balances the game for competitive style MP?

CS
 
Status
Not open for further replies.
Top Bottom