Tutorial for MOD installer

This is why I'm especially happy that AND2 has it's own launcher that can handle other optional things too, like enabling/disabling modules and automatically audio entries of modules into mod audio defines. But this launcher is not universal: It should work with other mods but has certain features hardcoded that will cause confusion at least.
View attachment 579039

So it would be really handy if someone could create a universal launcher that can:
  • launch the mod in which folder it is added
  • enable/disable modules
  • insert audio entries of modules
  • (maybe) select which dll should be active (copy it from a subfolder to Assets folder)
I don't really want to make it a request but maybe someone would like to do it...
What do you mean by "insert audio entries"? Do you mean like copy the files or is there something more to do like XML/Python work? Like describe the process for me step by step.

Because what you describe sounds eminently doable. I might just give it a crack. No promises though. Either way though a full list of desired features would be a good start. So if anyone has any ideas post them up. And than I'll se if I can take the project on when I see them all.

And no, I can't take the time to look at every individual mod's custom launcher in existence. That's the one thing I really don't have the time for. Hence my request that you request features.
 
Last edited:
What do you mean by "insert audio entries"? Do you mean like copy the files or is there something more to do like XML/Python work? Like describe the process for me step by step.
Most XML files work modularly, except for audio related ones (ones in the XML/Audio folder).
So if a module has additional sounds or music, you cannot just add audio xml files into your module's folder, since it won't be loaded with the game. You have to copy those lines into the right place in the mod, either manually or running woc_installer.jar, that was created exactly for this purpose.
I hope I could explain it clearly enough :crazyeye:
 
So it would be really handy if someone could create a universal launcher that can:
  • launch the mod in which folder it is added
  • enable/disable modules
  • insert audio entries of modules
  • (maybe) select which dll should be active (copy it from a subfolder to Assets folder)
I don't really want to make it a request but maybe someone would like to do it...
I could do an "app" that let's you select modules, audio, etc... but the only problem would be that I really have no idea how to make the mod folder into an executable.
I know that there is a command which can be put in the CMD (command prompt) that creates executables but I do not know it.
So if I ever learn how to create executables which can paste the mod in a folder I will try to do this.
 
Make the mod folder into an exe? That's not really possible? I mean, CIV won't load it would it? But having the launcher run the game with the mod loaded is trivial. It's just a matter of passing the right parameters to CIV4.exe. Moving files and folders around is even easier.

Most XML files work modularly, except for audio related ones (ones in the XML/Audio folder).
So if a module has additional sounds or music, you cannot just add audio xml files into your module's folder, since it won't be loaded with the game. You have to copy those lines into the right place in the mod, either manually or running woc_installer.jar, that was created exactly for this purpose.
I hope I could explain it clearly enough :crazyeye:
Does that jar do uninstalations as well? As in if I disable a module is it coded to remove the sounds?

The more I think about this the more it feels like a project that'd be fun to do.
 
(maybe) select which dll should be active (copy it from a subfolder to Assets folder)
I would be all over this one if it wasn't for the fact that I recently merged the two DLLs in WTP into one, removing the need to select a DLL file. I highly recommend this approach because two DLL files turned out to be way more confusing for players than expected. Didn't help that the two DLL files were savegame incompatible.
 
The biggest challenge here would be making the whole thing as dynamic as possible with as little configuration required. Like having the program automatically detect all the DLL files in the module, dynamically list them and know how to swap them in and out safely. Same for modules and stuff.
 
Make the mod folder into an exe? That's not really possible? I mean, CIV won't load it would it? But having the launcher run the game with the mod loaded is trivial. It's just a matter of passing the right parameters to CIV4.exe. Moving files and folders around is even easier.
Hmmm, I have an idea!
There is a Module in Python called OS with which you can delete, move, edit, and create files.
Anyway I will definitely try to do this because it would be pretty cool!
 
The biggest challenge here would be making the whole thing as dynamic as possible with as little configuration required. Like having the program automatically detect all the DLL files in the module, dynamically list them and know how to swap them in and out safely. Same for modules and stuff.
Yeah, that will be a big problem. I have Avast as my Anit virus and whenever I install a DLL it automatically removes it and moves it to a Virus Chest.
 
Python is not a bad idea. I was going to use what I know but in hindsight C# is mostly windows specific. So you give it a go. And if you can't figure out I'll give it a crack next. :)


Also you don't need to install DLLs anywhere. All you need to do is have them in the module folder already (as they would be by default) and use a renaming script that changes their extension to say dll.bak
 
Python is not a bad idea. I was going to use what I know but in hindsight C# is mostly windows specific. So you give it a go. And if you can't figure out I'll give it a crack next. :)


Also you don't need to install DLLs anywhere. All you need to do is have them in the module folder already (as they would be by default) and use a renaming script that changes their extension to say dll.bak
Well, I think Python is great for application development (not games). C# is also great but I do not know a lot of it, though I just started a course about C# development in Unity.
 
Also you don't need to install DLLs anywhere. All you need to do is have them in the module folder already (as they would be by default) and use a renaming script that changes their extension to say dll.bak
Also this is a great idea!
But I do have a question, what is a bak file? I never heard of it before.
 
Also this is a great idea!
But I do have a question, what is a bak file? I never heard of it before.
It's a file that you changed them name so that it's called something.bak as opposed to say something.dll. File extensions are just suggestions after all.

Well, I think Python is great for application development (not games). C# is also great but I do not know a lot of it, though I just started a course about C# development in Unity.
Python is too loose for my taste. I prefer strongly typed languages with a very strict system. Like my favorite, C++.
 
Python is too loose for my taste. I prefer strongly typed languages with a very strict system. Like my favorite, C++.
I 100% agree. Interpreted languages (like python) can be great for quick development and file movements while compiled languages like C++ are better in regards to writing bugfree code. For civ4 modding, a lot of testing have already been done in the C++ code when it is compiled, which python will not notice until runtime. An example of this is a typo in a function name. Well written code has a lot of compile time checks.

This doesn't mean C++ is always the best option. Scripting languages are usually a better choice for scripts dealing with files because they tend to have an API, which is much faster to work with. Sometimes a normally bad language can be the best choice. Applescript's application interaction is a good example of this.
Code:
tell application "Safari" to open new tab with url "https://forums.civfanatics.com"
(untested, but at least sort of right. I'm no Applescript guru)
Well, I think Python is great for application development (not games). C# is also great but I do not know a lot of it, though I just started a course about C# development in Unity.
I don't like C# because of the struct vs class issues. I feel like I lose control of arguments using references or value, like the same code can use either depending on if the variable is declared a struct or class. C++ is much more easier to understand in this context because it's about looking for & and * in the argument declaration of the function. C# can be looking up the function declaration, see that it uses a custom variable type and then you need to look elsewhere (possibly even in a different DLL) to figure out if it is a struct or class, hence figuring out if changes to the variable in your function will change the data in the variable of the caller. Even worse, if you realize it's a struct and you wanted it to be a class, then it's less trivial to get around this than it would be in C++. Best thing I can come up with for C# is that it works well with unity. There are also some other nice features like yield return, but overall I'm not a fan of it.

This is getting off topic. My point is that if you want to make a mod startup script using python, then it's not a bad choice. That said, I can come up with plenty of cases where python is not the right choice.
 
I 100% agree. Interpreted languages (like python) can be great for quick development and file movements while compiled languages like C++ are better in regards to writing bugfree code. For civ4 modding, a lot of testing have already been done in the C++ code when it is compiled, which python will not notice until runtime. An example of this is a typo in a function name. Well written code has a lot of compile time checks.
It's nothing to do with the method of execution. You can have a strongly typed interpreted language or a weakly typed and loosely designed compiled language. There is nothing that strictly prevents an interpreter from caching things like variable types like it does their values and using that for on the move errors.

Basically the general thing I like about C++ and dislike about stuff like Python is that functions, variables classes etc are all defined in type and nature well in advance and you can't muck about with them. Well you can but it's not part of the usual or sane workflow and definitively not something you do by accident. In python I don't even know what a function uses for parameters beyond names and can't bloody well guarantee it will get numbers and not letters passed to it.

This doesn't mean C++ is always the best option. Scripting languages are usually a better choice for scripts dealing with files because they tend to have an API, which is much faster to work with. Sometimes a normally bad language can be the best choice. Applescript's application interaction is a good example of this.
Quite. You can do anything with any language. Don't mean you should. :)
Don't mean you won't really really want to. :) But that's the programmers curse.

Code:
I don't like C# because of the struct vs class issues. I feel like I lose control of arguments using references or value, like the same code can use either depending on if the variable is declared a struct or class. C++ is much more easier to understand in this context because it's about looking for & and * in the argument declaration of the function. C# can be looking up the function declaration, see that it uses a custom variable type and then you need to look elsewhere (possibly even in a different DLL) to figure out if it is a struct or class, hence figuring out if changes to the variable in your function will change the data in the variable of the caller. Even worse, if you realize it's a struct and you wanted it to be a class, then it's less trivial to get around this than it would be in C++. Best thing I can come up with for C# is that it works well with unity. There are also some other nice features like yield return, but overall I'm not a fan of it.[/quote]
I've been programming with C# for decades and have not once ever had to use or run into code that actually uses structs. So like whilst I get what you are talking about in theory I feel a bit confused as to how you ever ran into it to begin with. Than again I've newer used structs in C++ beyond really ancient code either. It's all classes now.

[quote]This is getting off topic. My point is that if you want to make a mod startup script using python, then it's not a bad choice. That said, I can come up with plenty of cases where python is not the right choice.[/QUOTE]
To be perfectly honest given that this project is essentially all UI and filesystem manipulation the correct answer is what ever language you know best that also comes with a freely available cross platform capable library for those two. That's why I bowed out personally.
 
About dll handling:
You can code it in a way that has very strict restrictions on the modders, like: create a folder called dll in the Assets folder OR all dlls have to be named as CvGameCoreDLL.dll.1, CvGameCoreDLL.dll.2, etc. So it is right to expect the modders to "understand the basics" - unlike regular players.
 
I think Python is great at just about everything except Game development because it has so many modules which can be installed just by typing pip install "module"
in the command prompt/cmd.
Also python has a lot of modules for other applications so you can create stuff for them (like for Discord you can create bots with Python), for example: Discord.py, Reddit.py, Github.py and a lot of others. At https://pypi.org/ you can see how many modules there truly are, there is a python module for just about everything.
Anyway I made the screen for the mod installer with tkinter which only took 14 lines of code including the imports!
Spoiler Screen so far :

upload_2020-12-22_20-0-35.png
 
I think Python is great at just about everything except Game development because it has so many modules which can be installed just by typing pip install "module"
in the command prompt/cmd.
That's literally true for the vast majority of all modern languages. In C++ all you do is paste the header file in the right place and add "Include <filename>" into your program somewhere. Out of curiosity just how much experience programming do you have? Because a lot of the things you point out are basically standard with any editor these days.

there is a python module for just about everything.
In just about any other language that's widely used as well. Where ever there is a problem you'll find a madman programmer to solve it in his language of choice. Even the things one really shouldn't. Especially the things you really shouldn't. That's where the fun is. It's also the lovecraftian pit of doom programming horror stories come from. But again, fun.


This all being said I ain't saying python isn't a fantastic language. It absolutely bloody is. It's easily one of the top tier programming languages out there. It's just not to my personal taste. From the type system being far too liberal to the fact you use whitespace for formatting it's all just too much for me.


PS. Python can be used to make games. Check out Ren'Py. Some of my favorite games are made using that bloody thing. :)

About dll handling:
You can code it in a way that has very strict restrictions on the modders, like: create a folder called dll in the Assets folder OR all dlls have to be named as CvGameCoreDLL.dll.1, CvGameCoreDLL.dll.2, etc. So it is right to expect the modders to "understand the basics" - unlike regular players.
That's too restrictive and needlessly so given that it'd actually take more work to do it that way. I mean, the game can only run off one single .dll and it has to be called CvGameCoreDLL.dll. So that's your known constant. The rest is simply listing all the .dll files in the folder (the equivalent of running cmd/dir) and allowing you to click on one from the list which it than renames to "CvGameCoreDLL.dll". The C# code for this is shorter than the text I just wrote. And I can't imagine python is worse.
 
That's too restrictive and needlessly so given that it'd actually take more work to do it that way. I mean, the game can only run off one single .dll and it has to be called CvGameCoreDLL.dll. So that's your known constant. The rest is simply listing all the .dll files in the folder (the equivalent of running cmd/dir) and allowing you to click on one from the list which it than renames to "CvGameCoreDLL.dll". The C# code for this is shorter than the text I just wrote. And I can't imagine python is worse.
I think I meant the same just couldn't express myself properly. :undecide:
 
That's literally true for the vast majority of all modern languages. In C++ all you do is paste the header file in the right place and add "Include <filename>" into your program somewhere. Out of curiosity just how much experience programming do you have? Because a lot of the things you point out are basically standard with any editor these days.


In just about any other language that's widely used as well. Where ever there is a problem you'll find a madman programmer to solve it in his language of choice. Even the things one really shouldn't. Especially the things you really shouldn't. That's where the fun is. It's also the lovecraftian pit of doom programming horror stories come from. But again, fun.


This all being said I ain't saying python isn't a fantastic language. It absolutely bloody is. It's easily one of the top tier programming languages out there. It's just not to my personal taste. From the type system being far too liberal to the fact you use whitespace for formatting it's all just too much for me.


PS. Python can be used to make games. Check out Ren'Py. Some of my favorite games are made using that bloody thing. :).
Yeah I know Python can make games, I just said it is very bad compared to C++, C#, C, and a lot of the programming languages at making games. I even made a game using the PyGame module.
Well, I started Python about a year ago, then stopped, then I started making Civ 4 mods, and about 3 - 4 months ago I started speed running everything Python related and I sure am glad I did.
Now I stopped Python for a bit and started Visual Basic Net aka VB NET in Visual Studio 2015 because it is very easy to make games with it. I also just started C# because I want to get better at Unity (an app used to create games using C# ).
So basically because of Civ modding I actually know a lot about programming (in python and VB NET and in the future also others).
I also understand how you feel about Python and C++. Once you get used to something like C++ it is probably hard to get used to something like Python, kind of like how I got used to Civ 4 and now it is very hard for me to get used to Civ 6.
But anyway I'm trying to learn as many programming languages as possible, I already checked Python of the list and C# is next!

P.S. With C++ I do not think there is a command witch you can use in the command prompt to install a module, that is a very good part of Python, you just open the cmd and type pip install whatever you need.
Also Christmas break just started and I will have 3 weeks to learn programming as much as I want:)!
Oh yeah and I forgot to mention I also now quite a bit of Java, I totally forgot about Java!
 
Last edited:
You don't have to tell me what unity is. My current day job is making slot machine games using it. Bloody good framework, irregardless of what the haters say.

Also, love the attitude. You can tell a good programmer in the making by the enthusiasm and the fact he plays with it in his free time. That's how I started long, long ago. :)
 
Back
Top Bottom