Universal Conquest

Universal Conquest

Not enough ratings
The Really Really Really Short (Definitely not final) Modding Guide:
By Big Chungus
The short guide on how to mod the game. We have another larger one in the works. Gives you the basics.
   
Award
Favorite
Favorited
Unfavorite
The long and short of it...
Add any file you want to replace in the /data/ folder such as "data/metagame/factions.cfg" or "data/metagame/leader_traits.cfg" into it's own folder and again then put this folder in the "mods" folder under the Universal_Conquest directory and it will use those files instead of the other ones.

(ie: "mods/NewFactionMod/metagame/factions.cfg")

That's it, it's that simple. You can do this with images, with unit files, with music, etc. We do have modding support, we just don't have a good way of uploading it to the workshop at present apart from the tool - which has display issues, which we're going to have to write a guide for unless people have some understanding of what the other files you need are, which are just text files that contain the description and such.

We're writing a full modding guide it's just we have not had the time to do it, and seeing as I"m the only one that knows how to make them (because I am the main, sole developer) it's been a bit of a pain because I have 50 other things I'm doing at any given moment.

If you want to *try* the tool, then have three files ready:

1) A file with the description of the mod to be put below.
2) A text file containing the changelist.
3) Some sort of folder containing any files in the "data" folder you want to replace.

The steps for uploading to the workshop are:

1) Right click the Universal Conquest game in your steam library.
2) Browse Local Files and go into the directory "Universal_Conquest"
3) Click uc_workshop_tool.exe
4) Follow the prompts.

It should then upload it to the workshop for others to use.
Introduction
First things first, most things in Universal Conquest can be modded. This was the intention to begin with when we first started on this game. If you do not have some sort of text editor, (be it Notepad, Notepad ++, Sublime, Vim, etc), get one. You will need this to edit the .cfg files that maintain the game. Secondly, to edit the game's graphics, you will need some sort of photo editor, be it anything from MSPaint to Photoshop, to GIMP, etc. As for things like "savefiles", those cannot be edited.

As a rule of thumb, if there is some sort of configuration file missing, or some sort of error being thrown, the game will not load. So the easiest way to test this is to boot up the game, and run through until you get to the modified feature. You can run the game from the command line (cmd, Powershell, and later when we add support - bash) to get output. For example, a "LibgdxException" is typically a missing texture or sound file. If it is some sort of casting exception then it will be something you wrote that isn't where it is supposed to be.

Hence I recommend getting familiar with some of the exceptions in Java, which is what the game is written in primarily. If it's throwing an error, it's 99% of the time some change you made. Some stuff is printed out, but we handle those internally. Typically if there's a missing text file it will throw an error. If there's a missing sound file, it may crash when it goes to play the sound. A missing configuration file, it will not load.

Therefore I would strongly recommend when you replace files, you do not rename them. In fact, most of the filenames are hardcoded in "images.cfg" and "sounds.cfg" and "music.cfg". DO NOT EDIT THE ORDER OF ITEMS IN THOSE FILES. If you are editing an image, you keep the dimensions of the original image, especially when it comes to UI. Images for units are fine, you can change the dimensions of those, or for buildings, icons, effects, etc. Just be aware that if you make an image twice as large it will show up twice as large ingame.

Finally, your save-games will not work or will have corrupted image artifacts if you add, remove, or change certain things in the game.

Still with me? Alright, let's begin.
Directory Structure
Firstly, anything in the "data" directory can be modified. When you go into the game directory, you will see several different directories:


  • data - data is the directory that contains all game-play elements - configuration files, textures, sprites, all the good stuff. Anything in this directory can be copied into a mod folder.
  • logs - logfiles, these are obfuscated but the exceptions themselves can give you some information as to how you messed up the game. These delete automatically after one week.
  • jre - Don't touch this.
  • piper - This is the embedded TTS application for the ingame speech. If you want to create your own voices, I suggest you google "Piper TTS" and start researching there.
  • save - save files.
  • temp - this is a folder where we place things in the game temporally, like the generated output from Piper.

The directory you should be most concerned with, and do all your modding in, is "mods".

DO NOT MODIFY THE DATA FOLDER ITSELF

How our modding system works is whenever we look for a file inside the "data" directory, it will check two other locations to determine if there is a replacement file, or alternately - a file that is missing from the base game. It will go through every subfolder in "mods" and another internal folder that Steam uses when you download mods from the workshop.

If it finds a replacement file in one of those modding directories, it will use this file instead of the one in the data folder.

For example, say if you're creating a mod that replaces the game's music. If you copy the folder "universal_conquest/data/music", place it into it's own mod folder, and change the mp3 files to Bono, Panic at the Disco, or whistling noises, and add the three text files, throw it into the "mods" directory, and it works.

For some of you, this is all you need to know.
Music/Sounds
Use .ogg, replace the file in your own seperate folder.

That's it. It's that simple really.

If you want to add additional music:

1) Pick where you want the music played (Galaxy view, ground combat, space combat, etc.)
2) Where your music is going to be played ingame depends of the name of the music file.
-"title.ogg" - Title music.
-"loading" - Loading music.
-"galaxy" - Overmap music.
-"ground" - Ground combat music.
-"space" - Space combat music.
Rename it to something like "galaxy21.ogg".
3) Put in a directory ("mods/YourModFIle/music")
4) In your mod directory, copy/paste "data/music.cfg" and add it to the end of the file.

That's it.
Reuploading/Changing Your Mod
Just run the guide and select the mod_descr.txt file that's generated in the mod folder when you first upload it. If it doesn't exist, then it didn't upload properly or it's your first time uploading it.
Modding images:
Generally as a rule of thumb, don't change the size of them and use PNG.
For some things, such as units, you can use different .png file sizes, but as a rule of thumb don't change things like the UI image sizes and so forth, all that is hard coded. You can use other file formats, but as a rule of thumb it's generally a bad idea. Right now you can't add new graphics to things like the UI or things like different styles of asteroids or systems and so forth. But there's a lot you can do. Again, put the replacement image in it's own folder under /mods/ to get it to run.
Configuration Files Modding Basics:
The Basics:

Firstly, most of the .cfg files have three formats:

1) Simply a list of filenames.
2) Something with a .cfg extension that looks like this:

FACTIONS
data/units/faction1
data/units/faction2
data/units/faction3
...
END

3) .cfg files (such as units.cfg) that look like this:

UNIT
23
Assault Tank
Basic interstellar tank
32
23
42
1000
10
...
FALSE
FALSE
FALSE

Don't edit these directly. Simply make a copy in a folder in the ./mods directory and it will overwrite anything in there, as the game checks mod directories before the base "data" directory and anything in one of those it will replace.

For case # 1 - Simply a list of filenames.
Don't edit or replace these. These are hardcoded and how we keep track of files. Just ignore them. Units also that have "Hardcoded" in the comments "//" don't modify either.

For case # 2 - Cfg extensions in the "data/metagame" folder.

Basically there's two sorts of things. The tag indicates a list of things like filenames and so forth. They're pretty self explanitory, for example if you want to add a new faction, simply go to "data/metagames/factions" and add a line here like so:

FACTIONS
data/units/faction1
data/units/faction2
data/units/faction3
...
data/units/faction24
data/units/faction25
END

That's it. it's that easy. Just make sure you make a replacement file in your "/mods" and don't modify the ones in the "/data" directory because that's going to get overwritten in the next update.

For case three

Tags such as UNIT typically have some sort of pre-defined layout on how they're used. For example, at the top of every units.cfg file, we have a huge key, but basically how it works is that if the game sees a "UNIT" or some other form of tag, it will load values from that sequentially. Again the order in which each value is layed out for this are in each and every single file it's used in. (if not, DM me and I'll add them next update).

But basically how this works, is that for something like adding a unit, each of these numbers means something to the game.

UNIT
23 - The actual unit number used internally.
Assault Tank - Name of the unit
Basic interstellar tank - Description of the unit used in mouseovers
32 - The first weapon type as described in the top of the file.
23 - The second weapon type as described.
42 - The third
1000 - Range
10 - Unit behaviour type
...
FALSE - Should detect stealth units
FALSE
FALSE

Again, the key for this is in the top of every "units.cfg" file.

As a rule of thumb, don't add spaces before or after the values. It might not load properly. You will know if you did something wrong because the game will throw pink textures or explode on startup, which you can read the exceptions by running the game from the command prompt. If you don't know how to do that, I don't know what to tell you.

As another rule of thumb, to actually use the unit, you need to add it to the "data/metagames/tech.cfg" file for each technology to unlock it. Stuff such as "Starfighters" are unlocked because the player starts with these technologies already.

Generally, if two units in different "units.cfg" files have the same ID's then they will both unlock with that technology, and it's generally a bad idea to do this for different units - IE: Untested. Generally what I've been doing is adding identical units.cfg files with the same units and numbers to the game. If you encounter a problem with this, DM me.
FAQ:
Q: Can you add x/y/z modding feature?
Maybe. DM me.

Q: My game is now exploding from a mod I downloaded off the workshop, or I wrote my own mod and now it doesn't work! Can you help me?
No. Switch to Vanilla and unsubscribe from every mod, then run, resubscribe, and then subscribe to another one, run, and so forth until you figure out which mod is blowing up. If I see common complaints about this and it's not fixed I will remove the offending mod from the workshop.

Q: Someone uploaded a fix to my mod, or compatability with another mod/update, they should not be allowed to do that! It's my mod, not his!
Good. Because quite frankly if your mod is broken then you should have fixed it. I can't sympathize with you, I've seen way too much abuse of this in other games.

Q: If I change the music/sounds, can I use .mp3 or .wav?
Don't. It will crash eventually. Just use ogg. I know that .ogg is a pain to convert to but just trust me on this.

Q: Can you help me with the modding of x/y/z
Probablly not. For legal reasons I can't help you with your space marine total conversion mod either. I am more than willing to give you advice on how to do something if you just ask in Discord or through email. Check the support email on the Store page.

Q: I can't figure out how to change certain things like the ingame date displayed, or I want to implement psychic storms that demons pop out of, or I want to add a new kind of faction that spawns in xyz manner
Either you aren't going to be able to, or you'll have to figure out a workaround. I'm more than willing to answer questions or implement features such as changing the ingame date scale if asked. But stuff that requires major changes on my end, such as adding a new class of factions, definitely that's a no.

Q: Is there any chance that you can implement my mod in the base game?
Defintiely, though we're going to have to sign legal paperwork. Message me. I'm not going to pay you for it, so don't ask. If I do, we would either:

A) Reach out to you.
B) Hire you.

Q: I want to make a mod based on heavily copyrighted science fiction franchise or RIAA music
If I get a C&D I will have to take it down. You're at your own risk there.

We're going to write a more extensive modding guide in the future, but for now this should get you started.

Cheers,
The Developer.
1 Comments
Canute VII 18 Sep, 2024 @ 12:56am 
Ahem, don't you have to somehow enable the steam workshop for the game? I mean normally there should be a "workshop" tab along "guides", "discussions", "screenshots" etc. Just wondering...