The Spatials: Galactology

The Spatials: Galactology

Not enough ratings
Step By Step: Making a Mod For 3.6+
By cabmoomoo
Modding can be fun and interesting, while still helping out your fellow community members. This guide aims to, well, guide you in how exactly one makes a simple mod by breaking down all the individual components and explaining each in as simple and understandable a manner as possible.
   
Award
Favorite
Favorited
Unfavorite
Minor Update
When making this guide and mod, I accidentally used the ID buildplanet4 which is currently in use by the base game. I have updated my mod to fix that, but will not update the example images in this guide. It is a minor thing, and you should be using something unique anyway, so just keep that in mind.
What You Need
To start with, you will require software to edit the code. Don't worry, this is easier done than said. The simplest program, and the one I have used and will be using throughout this guide is Notepad++[notepad-plus-plus.org], a free to use program that is used to edit C++ and many, many, other file types effectively. What program used doesn't really matter as long as it maintains the structure of the file.
Starting Out
Once you have all of your tools in line, you are ready to begin. To start locate a few folders and files:
  1. Your game's core directory. This should be located in your Steam/SteamApps/common folder, though this may differ based on install preferences. It can also be found by right-clicking the game in your library, going to Properties, Local Files, Browse Local Files.
  2. Your game's mod folder. This will be located right next to your directory and will be vital when it comes time to test the mod out.
  3. Steam's workshop folder. Located this by going to Steam/SteamApps/workshop/content/450700. Here is where Steam stores workshop mods, and 450700 is what Galactology is labeled as. This may vary.
  4. Where you want to build the mod. You can build the mod anywhere you want, just be prepared to move it around for testing and uploading. It is possible to build the mod in the game's mod folder for easy testing of changes big and small, however in the past I've had troubles when it comes to uploading the mod. For that stage, it is recommended to either move the mod to a good location, or just build it in a viable location (any place that wouldn't normally require any special permission to modify, such as the desktop, but make sure to keep it in its own folder!).

With all of this found, you're ready to begin. This can be done one of two ways, either by making each files by scratch, or by "stealing" it from a mod that already been completed. If you want to do the latter of the two, you are welcome to make use of my example grant mod, which is the type of mod I shall be demonstrating throughout this anyway. Otherwise, you will want to make three txt files:
  • A file named main
  • A file named manifest
  • And a file named whatever you want to be the name of your mod, smooshed into one word (so New Mod would become NewMod). If repurposing my mod, change the name of newgoal.lua to your mods name.
Once created, change their extention to .lua (this can be accomplished on Windows by renaming them in file explorer, and replaceing .txt with .lua). Despite what warnings may be given, it is safe to do. In the next section, example pictures and descriptions of every line used will be provided, so you can manuipulate each any way you need, or just add them if building from scratch.
Manifest and Main
Now, you should have a decent .lua file editing program and three .lua files: manifest, main, and your mod name. To begin, let us break down the indvidual component of the manifest.lua file, as it is the simpliest.
As the comment text at the top correctly states, all mods must have this file and in this simple structure. Ignore the "Return", as it is simply what breaks the structure down into its parts. Changing that will destroy the Earth. The rest is pretty self-explainatory: "name" shows you where the name of the mod is (what is seen in the mod selection screen, nothing more), "description" is where the description of the mod (again, in-game only), and then API-Version, as described to you, is not to be messed with, as changing that might just make you explode violently.

The next file one will need to change will be the main.lua file. In here there are only two things that need to be changed, and a good bit of information for those that wish to dig a bit deeper into how modding works for The Spatials: Galactology, but most of which will not be required for this tutorial. Something to note, the text that starts with two dashes (and is green in the picture) is not required text, mearly notes made by the mod creator/game dev, and does not have to be included or left in your final mod.
Lucky for us, this file isn't as populated as it looks at first, as half of it is instructions/tips/whatever placed there by the devs. For our purposes, the only usefull part of this that we need to know is the second line:
-- Every other file must be referenced in some way by your code.
This is why the main.lua file exists. To tell the game "These are all the files with stuff you need to pay attention to. Go look at them and do what they tell you to do." The first line that will require any attention is
include_lua(mod, "newgoal.lua")
This is what the main.lua file tells the game what file need to load. In theory (I've never used it myself, but this is how it should work), if you required multiple files to seperate all your mod's code, you would have multiple lines here. For now, however, we just need the one line. Here, you would replace the "newgoal.lua" (leave the quote, just change whats in them) with the file that is the shortened name of your mod. In this case, "newgoal.lua" refers to the New Goal mod I made and the newgoal.lua file that comes with it. The next line requiring editing is
mod.newgoal_setup(rules)
This is something that is going to be difficult to change before we edit our last file, so keep this file open and this part in mind, as it will be covered in the next section. So far so good, right?
Your Mods Primary File
The final file we added that will require editing will be the file with your mod's name in it. For the purposes of this tutorial, and my sanity, I will be refering to this file from now on as newgoal.lua, as that is the name of the file that came wiht my mod. Lets get started.
Right. To get started, things are made easier for us as the first 12 lines are either dev notes or no touchy touchy lines, which for our sakes' are best left ignored for the time being. The first line we need to pay attention to is by far the most complicated of the file, as it involves going between two different files and ruins the whole mod if it doesn't work right. Oh boy.
mod.newgoal_setup = function (rules)
Now this line is fairly simple, mod.newgoal_setup needs to be a unique line, meaning that no part of the base game or any other mod can have the same line, or there will exploding planets within your vicinity. I would recomend replacing "newgoal" in that line with the crunched down name of your mod, as it is unlikely any other mod will have the exact same name. The "function = (rules)" part is something that tells the game what it needs to do with the following code, however what exactly that means for you and me, will require a bit of exploration on my part before I can describe it to you, so best to ingore it now for the purposes of this.
Next up is a whole buch of simple stuff, so have a table with all their meanings:
Line
Use
id = "buildplanet4"
Replace "buildplanet4" (always keep the quotes unless told otherwise) with a unique id for your goal. This could be literally anything that something else won't use, as the player will never see this.
icon = "ui_icon_15px_aterrizaje.png"
Replace whats in the quotes with a picture of some form. The best list of icons used in the game I've found is to find an icon for a goal in the game now, find the goal in the The Spacials Galactology/core/goals/main.lua file and steal it from there, I am going to attempt to find a way to add your own icons and will put it somewhere other than here later, but right now, this is beyond my knowledge.
title = _L("goal_buildplanet4_title", "Build 2 recruitment centers on some planets")
"goal_buildplanet4_title" is another unique id, make it whatever (I just changed it to be the goal id with _title at the end). The second set of quotes is the title the player sees, make that whatever you want as well.
description = _L("goal_buildplanet4_desc", "Build 2 recruitment centers on the surface of 2 planets")
First quotes is a unique id, same as last time, second set is the description the player sees.
This next several lines are a bit more complicated. In the picture, line 20 is a line that is required to tell the game what is required by the goal to be completed. This line can be changed to add multiple requirerments to complete the goal, however this will not be covered in this section. For an idea on how to do that, I would recommend looking at the goals built into the game.
The next line is what you're going to want to change to your preference.
bridge_hash("build-object-model-name") + bridge_hash("recruitment-center-1")
In this line "bridge_hash" referse to something occuring in the game, be it a direct action on the part of the player or otherwise. The amount of this term present in the code is dertermined based off of what action it is that needs to be accomplished. For instance, this goal requires the player to build an object, and that is dertermined by the first "bridge_hash", while what needs to be built ("recruitment-center-1") is determined by the second "bridge_hash. This is not the case for all goals, as the "Clean 100 dirty tiles" goal that comes with the game requires only one "bridge_hash" to say that the job is cleaning, and thats it. To find exactly what you are looking for, you will have to explore a bit either in the core/goals/main.lua file, or within other parts of the game to find what you are looking for.
As for the orange numbers (at least orange in the picture), those are the amount that something needs to get done. The first number always stays 0. Always. I have yet to find a point in the space-time continuum where this is not 0. The second number is the one you change for yourself as that is the amount of times that thing needs to happen to complete the goal. In this case, I put it as 2 because there was already a goal for doing it 1 time. The final line is probably the most simple one of them all:
reward = 60
You could probably guess what this one means, but the number is the amount of moneyz the player can claim after completing the goal. Change that as you will, be it to a reasonable number that is fair and balanced for the game, or to 999,999,999,999 if you want to have a cheat mod (don't include the commas in the number).

And there you have it, all of the files you made have been completed, and if you played a game with this mod, it would probably work just fine. So what are the other sections for?
The Final Steps to Ultimate Power Completing the Mod
To finalize your mod, you'll need to do a couple of things. The first of which is the easiest to do: find what picture you want to be the in-game thumbnail for your mod when selecting it at game creation, drag it into your game folder, and rename it to "preview.png". I do not know if other image types are accepted, althought the probably are. And there you go. You now have what is (hopefully, if you've been following this guide correctly and/or I didn't mess up) a fully fuctional Goal Adding Mod for The Spacials: Galactology! Next, you need to get it to a place where others can use it happily: the Steam Workshop.

Before moving on, if you haven't already, it is highly recommended that you verify your mod actually works. To do this, move the mod's folder into The Spacials Galactology/mods wherever your game is installed, boot up the game, make a new save with the mod enabled, and do whatever you can to obtain this goal. If your goal does not work, or simply isn't in the list, look back over this guide to verify you did everything you were supposed to, and then contact me (ideally in the comment box) or the devs for additional assistance.

The Spacials: Galactology comes with a pretty simple upload interface within the game itself that some may have noticed before and others probably not. To start with, let us verify that your mod is in a place that is usable. The easiest solution to this I have found is to take the mod's folder and, if it is not already there, throw it onto your Desktop. This ensures that your mod is accessible by the upload interface when the time comes.
With that done, lets get to the upload interface. To get there it is as simple as booting up the game, going to settings, and to the developer tab. And there it is in all its simplistic glory:
To start with, on the left I have two options because I have uploaded a mod. If I were to select that mod, it would give me similar options, but instead would replace whatever I have on the workshop with whatever is in the folder I give it. Until you need to update a mod, or have a mod to update, the only option that matters for you is the "Create new mod" one. Here, everything you can do is pretty self-explainatory, so the only stuff I'll bother you with is the Visibility, I would recommend Private until you get the workshop page exactly how you want it, Tag, only used if your mod is a translation mod (which a goal is not), Current Folder, which is where the mod currently is (use the one on your Desktop or other easily write-able place on your computer), and Image, which will be the first thumbnail for your mod on Steam (you do not have to add one now, you can do that later). Once all that information is filled in, just click (or tap if you are some new-age wizard with a touchscreen monitor) Create, and give it a few minutes (really just depends on your internet speed). Once done with that, head on over to the Steam workshop. If your mod is not visible there (like it wouldn't be if you put it to private) then you'll have to hover over Browse, and then select Subscribed items from the drop down. There, at the top of the screen there should be an option for what is shown. Select "By (insert your Steam username here)" instead of "(your username)'s Favorites". And now you should see a list of the mods you have uploaded. If your mod is not there, either you did something wrong, or need to contact either the devs or I. Otherwise, you can go into it, mess around with the page in whatever way you deem fit, set it to public if its not already, and pat yourself on the back, 'cause you just made a mod for The Spacials: Galactology! Woo! (Insert fireworks and fanfare noices here)
Additional Noteworthy Notes That You Should Take Note Of
As some of you may have already noticed while looking around to find some parts for your mods, like I said you could, the base game coding, say even for goals, look less like this:
And a little bit more like this:
Don't worry, both work similarly, the only real difference is that my code is broken up a little bit more and uses some slightly different methods of reference (for instance my code ends with a nice blue "end", while the game code just sets things up with a lot of (( )) to tell the game where bits start and where they end). Either one would work, you do you, just be aware of the differences if you intend on snooping around the game code. If you need some assitance with crossing over either for yourself or just between the game's code and your own, feel free to ask, I'd be more than willing to offer aid in any way that I can, as its mostly my fault if you have to deal with this sorta thing, as I only caught the difference half-way through making this guide, and I'm too lazy to go back and rewrite most of it, unless enough people become confused.
7 Comments
joshthedark 13 Jun, 2020 @ 10:33am 
yeah my fault for not saying the full number from the start, i do agree on your point, but wanted to make an alternative to the creative mod, which had all science researched and a really high cash goal, which made branch of scientist useless.
cabmoomoo  [author] 13 Jun, 2020 @ 10:21am 
Okay, I did not test quite that high. To be fair, I mainly intended this as a guide to make goals that are balanced as well as just free money goals, and I doubt you will ever need more than a 999 billion in a single game.
joshthedark 13 Jun, 2020 @ 10:11am 
did that prior (as MoneyMod6). your example was 999,999,999,999 for a possible max.
cabmoomoo  [author] 13 Jun, 2020 @ 9:31am 
Just did some messing around with my New Test Goal mod, and made a goal with 1,000,000,000 cash reward just fine. I did notice that with that mod in its current uploaded state, I made the mistake of having it try and overwrite a goal already in the game. Make sure your are giving your new goal an ID that is unique (buildplanet4 already exists). I'll be correcting my mod shortly.
joshthedark 13 Jun, 2020 @ 7:55am 
forgot to say in your example max amount. made a test cash cheat mod to test how high, and the reward cash wouldn't register. at least on my end.
cabmoomoo  [author] 13 Jun, 2020 @ 6:39am 
I didn't think there was any max on the reward. I'm not sure what you mean by "minus one nine", but I think I had made goals with rewards in the billions without issues.
joshthedark 13 Jun, 2020 @ 5:14am 
the max reward per goal, is minus one nine to work without issue, any more and it will not give it.