The Spatials: Galactology

The Spatials: Galactology

Not enough ratings
Mod development (translations 3.11+, gameplay 3.6+)
By Weird and Wry
Learn the whys and hows to create mods for The Spatials: Galactology.
   
Award
Favorite
Favorited
Unfavorite
Introduction
ATTENTION: V3.6 COMPLETELY CHANGES THE MOD SYSTEM
V3.6 migrates the scripting system of the game from s7 Scheme to LuaJIT. For this reason old mods won't work anymore in V3.6 (except for translation mods). This is the last time we will do this, don't worry! Lua is also a much easier language for most programmers so it will be easier to make mods, in addition to enjoying much better performance.

One of the main goals of Galactology development has been to make the game extensible by mod developers. As such I determined early on to try to code as much as possible of the game as if it was a mod, in order to make sure all the APIs were ready for it. In the end this has made virtually all the code of Galactology to be expressed as a collection of mods, which can be found in every game installation under the "core" folder.

There's still a lot of C++ code involved. The core ECS engine is done in C++ for performance, as is the GUI and the map rendering. A few gameplay systems are also done in C++, both as a legacy from The Spatials and for performance reasons.

But virtually all the things that make Galactology a new game, as opposed to The Spatials, are programmed as a mod. This document aims to guide potential modders in how mods work with the core game and how to develop them.

The language of Galactology: Lua (by the way of LuaJIT) plus l2l Lisp

Originally s7 Scheme[ccrma.stanford.edu] was the chosen language for developing mods (and for the core of the game). It served it purpose well, and it is a very powerful language. It's also, for its category (pure dynamic interpreter, everything eval-ed at the last moment), quite fast. But after version 3.5, which as a combination of a very stable release and a lot of new content, it was clear it wasn't fast enough. So with a massive effort all the Scheme code was translated into l2l Lisp[github.com], a Lisp dialect that translates into Lua. And LuaJIT[luajit.org] was integrated into the game, with the help of sol[github.com] for the C++ bindings.

Remember: source code is included!

To make it easier to learn how to make mods, the entire core gameplay code is included with every copy of the game, in source form. You can just edit that code and restart the game to make experiments if you wish.

For a much more commented example of code you can also download and inspect the shower puddles example mod.
Mod structure
The best way to learn how to make a basic mod is to look at one!

In the Workshop you can find an example mods that adds water puddles around the core game showers:

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=714288799

You can also browse the code online in its github repo:

https://github.com/weirdandwry/galactology-mod-puddles

The source code for this mod is very extensively commented. You can check the files in this order to get an idea of the basic structure and how to implement a few new gameplay systems:

https://github.com/weirdandwry/galactology-mod-puddles/blob/master/manifest.lua
https://github.com/weirdandwry/galactology-mod-puddles/blob/master/main.lua
https://github.com/weirdandwry/galactology-mod-puddles/blob/master/puddles.lua

Uploading mods

Galactology includes a development tool to upload mods inside the base game. Go to Options and select the Developer tab.

Click on <Create new mod> to start the process of uploading a new mod.

Click in the spaces after Title and Description to fill out the Steamworks fields of the same name, and in the selector right of Visibility to chose the initial visibility of your mod.

Content folder must point to the root of your mod. This is the folder that contains manifest.lua.

The image must be ideally square, in JPG format and less than 1MB.

After the fields are filled, click create to upload your mod.

It's also possible to use the tool to update the mods you've created. After they have been uploaded they will show up in the left listing. Clicking on them will allow you to edit their details and if you pick again a content folder it will replace your mod contents in Steamworks when you update the mod.

Translations

Starting with version 3.11 we are now offering a crowdsourced translation service to be able to ship translations inside the game. Check this post in the forums for more details:

https://steamhost.cn/steamcommunity_com/app/450700/discussions/0/1700542332324695551/
ECS engine
WIP, this section is not done!

Introduction
Concepts
Entity
Component
System
World
Entity processing model
ecs-query
Busy system
Child system
Mover system
Poses system
Model object conventions
Autodiscovery from graphical assets
Extending core gameplay systems
Jobs
Vitals
Feelings
Combat
General systems
Station systems
Planet systems
Ship bridge systems
Objects (station, planet, ship)
NPCs and enemies
Goals and counters
Tutorials
Research
Ships
Recipes
Resources
Systems and planets
GUI programming
WIP, this section is not done!

Conceptual model
gui-* procs
Callbacks
Observers
Reactive proxy
Info panels
Tools
Stand alone windows
1 Comments
cabmoomoo 5 Aug, 2017 @ 7:43am 
For all those that want it, here's a new guide on the step-by-step of making a goal mod:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=1100574260
And here's a guide on making a translation mod:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=735888003