Creating a map script in Civ IV was pretty straightforward: Find out where the files are located, add yours there, zip it when it works, upload..
In Civ V the process is more complex if you want to upload the map script to the mod browser.
Here are steps:
1 - Fill the skeleton:
1.1)Create a solution in ModBuddy.
1.2)Add a new lua file to the solution, which will be your script. I suggest putting it where modbuddy proposes by default.
This file can be located anywhere. However, if you want to test it, you will want to make changes to it and test at the same time, so a copy of this file will have to be located in your Maps folder. Putting it there however will probably conflict with the version that your mod will have installed, adn you won't know which version the game is using. Back to this issue later.
1.3)Code. I'm not going to give details on this. The best way is to look at other existing scripts, like Fractal, Continents, etc. and see what they do, and start from that. Hopefully at some point Firaxis might release a mapscript modders guide, Sirian made a great documentation in IV, so maybe he'll do that again in V. I think the process is very similar to Civ IV, as I saw some "beautification", like 'adding lake' traces in the map generation, that I never coded in my script.
1.4) If you want your script to support multiplayer, add
, in the GetMapsCriptInfo section. Also make sure you don't use fancy random number generation routines, as only the map seed and the script name are sent when generating multiplayer games.
2 - Test:
You should use the WorldBuilder for testing. It shows all the custom options of the script. However, I didn't find how to use the sizes, you can only move the sliders changing width and height. So if you want to have custom map sizes, you'll have to move the sliders everytime.
2.1)Put your script where it can be used by the game. You can do this by simply 'Building' the project.
Unfortunately, after more testing, this proves NOT to work. You have to also ENABLE the mod. The best way is therefore to scrap ModBuddy altogether for testing and to just put your map into the Maps folder and edit it form there. My advice is therefore: DO NOT use ModBuddy EXCEPT for releasing the mod.
2.2)Run your script.
A lua console window will pop up and disappear when the script finishes. This is a real pain since the error message that will inevitably happen will vanish as soon as it is shown. Sometimes the window will close before the error traceback is even printed. Maybe the output of this console is logged somewhere, but I couldn't locate where.
2.3)Debug.
I haven't found anything more efficient than using a wait() loop in which I print debug info, then do nothing for a long while hoping the window will therefore remain opened long enough for me to see my traces.
However, you can't edit your file and save, you must build. The effect of Build is that it will save your file, zip your file and put it in a folder you have no use of right now, and most importantly copy the saved file to the folder that Civ and the worldbuilder use.
This is quite easy if you like the ModBuddy editor, but if you use an external editor, then you're better off writing directly the file in the Maps or Mods folder, but you'll have to copy that file back into your project later.
Overall, if you like visual studio editor, you can happily use it, just remember to use Build and not save, even though Build's only use is a save as. If you like another editor, the IDE will just make your life harder for not using it.
3 - Test again
Test again, but in-game, just to be sure.
Note you can only test players placement in game.
4 - Distribute
When you're happy with your script, you should look in the Packages directory of ModBuddy, where your civ5mod is located. You can then upload it by going to Online tools in ModBuddy, logging (everytime, won't save your login from last session) and uploading your file.
I strongly suggest uploading it as a private mod first, then removign whatever versions you might have in your local directories, and downloading it to test. It's probably just paranoia, but still. Then make it public (need to click the View Details in the online tools window) after you're sure it actually works after being downloaded. The IDE is supposed to make sure this is unnecessary, but if you put a file somewhere unexpected, it might work on your system for that reason, so a bit of cleanup for testing might be useful.
Comments:
The output and error messages in WorldBuilder are a pain. The window closes after an error happens, which may be fine when you're just generating a map to start from, but frankly when I make up a map I always start from scratch or an existing map, never from a map script so I miss the point of closing the window. A checkbox to close it always, along with an option to change that setting, would do a great deal to help mapscripters in my opinion.
Having to use ModBuddy when you have your own favorite editor is a real pain. Were it not for the md5 sum, I'd happily scratch the thing and use 7zip to create the package myself.
Also, at the end of the process, you should have several copies of the lua script scattered around your hard drive: One in the project directory, one in the mods directory, one hidden in the package. I think it's a waste of hard drive space, but then these are really small files, so not a big concern. I'd be much more concerned for bigger mods, particularly those with art assets, where such duplication seems very bad.
I don't know if the project can use its output as an input, I doubt it, but it would avoid the multiplication of files.
Wishes:
Two things would be particularly helpful to help mapscripting:
-Having an option to keep the lua console open in WorldBuilder when script generation finishes.
-Documentation of the lua functions available and the overall process (succession of method calls in particular).
In Civ V the process is more complex if you want to upload the map script to the mod browser.
Here are steps:
1 - Fill the skeleton:
1.1)Create a solution in ModBuddy.
1.2)Add a new lua file to the solution, which will be your script. I suggest putting it where modbuddy proposes by default.
This file can be located anywhere. However, if you want to test it, you will want to make changes to it and test at the same time, so a copy of this file will have to be located in your Maps folder. Putting it there however will probably conflict with the version that your mod will have installed, adn you won't know which version the game is using. Back to this issue later.
1.3)Code. I'm not going to give details on this. The best way is to look at other existing scripts, like Fractal, Continents, etc. and see what they do, and start from that. Hopefully at some point Firaxis might release a mapscript modders guide, Sirian made a great documentation in IV, so maybe he'll do that again in V. I think the process is very similar to Civ IV, as I saw some "beautification", like 'adding lake' traces in the map generation, that I never coded in my script.
1.4) If you want your script to support multiplayer, add
Code:
SupportsMultiplayer = true
2 - Test:
You should use the WorldBuilder for testing. It shows all the custom options of the script. However, I didn't find how to use the sizes, you can only move the sliders changing width and height. So if you want to have custom map sizes, you'll have to move the sliders everytime.
2.1)Put your script where it can be used by the game. You can do this by simply 'Building' the project.
Unfortunately, after more testing, this proves NOT to work. You have to also ENABLE the mod. The best way is therefore to scrap ModBuddy altogether for testing and to just put your map into the Maps folder and edit it form there. My advice is therefore: DO NOT use ModBuddy EXCEPT for releasing the mod.
2.2)Run your script.
A lua console window will pop up and disappear when the script finishes. This is a real pain since the error message that will inevitably happen will vanish as soon as it is shown. Sometimes the window will close before the error traceback is even printed. Maybe the output of this console is logged somewhere, but I couldn't locate where.
2.3)Debug.
I haven't found anything more efficient than using a wait() loop in which I print debug info, then do nothing for a long while hoping the window will therefore remain opened long enough for me to see my traces.
However, you can't edit your file and save, you must build. The effect of Build is that it will save your file, zip your file and put it in a folder you have no use of right now, and most importantly copy the saved file to the folder that Civ and the worldbuilder use.
This is quite easy if you like the ModBuddy editor, but if you use an external editor, then you're better off writing directly the file in the Maps or Mods folder, but you'll have to copy that file back into your project later.
Overall, if you like visual studio editor, you can happily use it, just remember to use Build and not save, even though Build's only use is a save as. If you like another editor, the IDE will just make your life harder for not using it.
3 - Test again
Test again, but in-game, just to be sure.
Note you can only test players placement in game.
4 - Distribute
When you're happy with your script, you should look in the Packages directory of ModBuddy, where your civ5mod is located. You can then upload it by going to Online tools in ModBuddy, logging (everytime, won't save your login from last session) and uploading your file.
I strongly suggest uploading it as a private mod first, then removign whatever versions you might have in your local directories, and downloading it to test. It's probably just paranoia, but still. Then make it public (need to click the View Details in the online tools window) after you're sure it actually works after being downloaded. The IDE is supposed to make sure this is unnecessary, but if you put a file somewhere unexpected, it might work on your system for that reason, so a bit of cleanup for testing might be useful.
Comments:
The output and error messages in WorldBuilder are a pain. The window closes after an error happens, which may be fine when you're just generating a map to start from, but frankly when I make up a map I always start from scratch or an existing map, never from a map script so I miss the point of closing the window. A checkbox to close it always, along with an option to change that setting, would do a great deal to help mapscripters in my opinion.
Having to use ModBuddy when you have your own favorite editor is a real pain. Were it not for the md5 sum, I'd happily scratch the thing and use 7zip to create the package myself.
Also, at the end of the process, you should have several copies of the lua script scattered around your hard drive: One in the project directory, one in the mods directory, one hidden in the package. I think it's a waste of hard drive space, but then these are really small files, so not a big concern. I'd be much more concerned for bigger mods, particularly those with art assets, where such duplication seems very bad.
I don't know if the project can use its output as an input, I doubt it, but it would avoid the multiplication of files.
Wishes:
Two things would be particularly helpful to help mapscripting:
-Having an option to keep the lua console open in WorldBuilder when script generation finishes.
-Documentation of the lua functions available and the overall process (succession of method calls in particular).