Modding Basics

From Cosmoteer Wiki
< ModdingModding/Modding Basics
Jump to navigation Jump to search

This article details some of the basic knowledge and principles required to create mods.

Important Directories

There are 3 important file directories to be aware of when modding:

  1. Base Game Directory
  2. Steam Workshop Mods Directory
  3. User Mods Directory.

Base Game

The Base Game Directory is where all of Cosmoteer's files reside. It's exact path depends on where you chose to install the game via Steam, but most users will find it at the following location:

C:\Program Files (x86)\Steam\steamapps\common\Cosmoteer
CalloutIconTip.png
Tip
To easily find the location, right-click Cosmoteer in your Steam library list, hover over Manage, and click Browse local files.

Inside this directory are the following important folders:

  • Data: Contains all the .rules files that the game comes with. The purpose and structure of these files will be covered later on.
  • Standard Mods: Contains the built-in mods that come with the game.
CalloutIconTip.png
Tip
The Standard Mods folder can be quickly opened from the game's title screen. Click MODSWidgets menu down.pngShow FolderBuilt-In Mods

Steam Workshop Mods

Thanks to Steam Workshop integration, mods can be easily browsed, downloaded, and uploaded on Steam itself at the Cosmoteer Workshop.
The Workshop is especially useful when developing mods, as you can download mods implementing similar ideas for inspiration and to learn how they work.
Also important to note is that mods can be downloaded and referenced without actually being enabled, and thus affecting your gameplay.

Workshop mods have their own directory that exists outside the game files, which most users will find at the following location:

C:\Program Files (x86)\Steam\steamapps\workshop\content\799600
CalloutIconNote.pngInfo
799600 is Cosmoteer's technical AppID on Steam.
CalloutIconTip.pngTip
This location can be quickly opened from in-game. From the MODS menu on the title screen, right-click any downloaded workshop mod, and select Show Folder.
The parent of a mod folder that just opened is the Steam Workshop mods directory.

Just as the game itself has an AppID, all Workshop mods have a unique WorkshopID. For example, the Crippler Missiles mod by Dj0z has a WorkshopID of 3167877731. This means all files for this mod are located in the following directory:

\Steam\steamapps\workshop\content\799600\3167877731

User Mods

The User Mods directory is where the game places any mods that you create yourself, or those that you download from outside the Steam Workshop. It can usually be found at the following location:

C:\Users\<username>\Saved Games\Cosmoteer\<SteamID>\Mods

Note that there are two special path names:

  • <username>: The name of the user account you use to sign in to your computer.
  • <SteamID>: Your unique Steam User ID. You can see this in the URL of your Steam profile.
CalloutIconTip.png
Tip
You can easily find and open this directory from the title screen. Go to MODSWidgets menu down.pngShow FolderUser Mods.

Creating Your Own Mod

Example Mod Reference

While creating your own mods can seem daunting at first, it is easier than you would think. All the game's files are easily readable, and the game actually includes a built-in «Example Mod» that you can reference.
This is an excellent place to start learning as it teaches you how mods are structured, and what needs to go where.
You can find it within the base game directory under the Standard Mods folder, though the easiest way to locate it is through the in-game MODS menu by right-clicking Example Mod and selecting Show Folder.

The 'core' of the mod is the mod.rules file, which is highly annotated and thus a great reference tool.

CalloutIconTip.png
Tip
If you only see a file called mod, and NOT mod.rules, then it means you do not have filename extensions visible.

Whilst not required, it is highly recommended since it makes it easier to see what file type each file is.

If using Windows, consult this guide to find the relevant instructions for your Windows version

Starting Your Mod

To begin creating your mod, first go to the User Mods Directory (see the above section for help to locate it). Now create a new folder, name it whatever you wish, and open it. This is where your mod's files will go.

Inside the folder, either create your own mod.rules file, or copy over the one provided within the example mod.

Do the following to create a new .rules file. Note that you will need to have filename extensions visible, else the resulting file will not be recognized by Cosmoteer.

  1. Create a new text document. Right-click within the folder > New > Text Document.
  2. Rename the file to mod, and replace .txt with .rules. The whole file name should now be mod.rules. Click Yes when Windows asks to confirm that you want to change the filename extension.
  3. Open your new mod.rules file in your favorite code editor. Notepad++ or Visual Studio Code are highly recommended, though technically Notepad - albeit inadvisable to use - would work.

Testing Your Mod

When you have finished developing, return to the in-game MODS menu, and you should see your new mod listed there.

CalloutIconTip.png
Tip
Changes to the Name and Description fields of your mod's mod.rules will not be visible until you close and reopen the MODS menu.

Any other changes made to your mod will require you to reload the game. You can also do this via Restart Application hotkey (Shift + ~ (Tilde) + Escape by default).

See also: Avoiding mod crashes

.rules Files

So far we have dealt with only one .rules file - namely mod.rules - but there are many more that go into making a mod. As you browse through the Example Mod's folders, you'll notice many of them have a .rules file of their own inside with varying names.
You'll find many, many more within the Data folder in the Base Game Directory, as the base game is built using .rules files in the same way mods are.

These files are the «building blocks» of mods, used to determine properties and the Actions the mod should take, and to dictate where the various files within the mod should be used. For example, the Example Mod includes a new part called «Super Armor». It's the super_armor.rules file that defines the basic properties of this part, and where the files should be used (i.e. armor_33.png being used for displaying a damaged version of the part). All content within a mod, such as parts, sounds, graphics, will either directly have a .rules file, or be mentioned within one.

Also important to note is that .rules files can be referred to in other .rules files, and even inherit from them.

Further Reading

Load Order

CalloutIconWarning.pngStub
This section is currently empty.

Feel free to start it!