Deep Space Settlement is a 4X real-time strategy game focused on empire building and grand-scale space battle.
This article shows how DSS can be modded by adding a food resource and a population concept into the game.
Posted by StephanieRct on Feb 7th, 2013
I often say DSS is highly moddable. But just how moddable is that exactly? Let's see how it works.
The game data is run by Xml files that define almost everything in the game. From resources to ship components, galaxy generators, AIs, weapons, all of it. All that in a readable, thus modifiable, Xml format. So let's see what can actually be done. Here's a xml snippet describing a resource called "Food".
Things are pretty much self-explanatory. Id is an internal name for reference in other parts of the data file. Volume and mass are built-in attributes and "Ration" is a custom attribute. This custom attribute is itself described beforehand as:
All of these attributes are only for display purposes. They don't give any meaning to the game. The meaning of "Ration" will come later in how it will be used.
This resource must be produced somehow in the game. The process of creating a "Food" is at its turn described as:
This means it takes 30 seconds to create 1 unit of "Food" from nothing. These plants grow pretty fast!
Now, not surprisingly, food is produced in farm. Farms are components that can be built on a station hub.
The precompiled attribute refer to a 3d object file, our artist will discus it further down. Things inside the Job element are resources the component can produce. Cost is what the component needs to be built. And there's a couple of extra attributes.
Ok, so now we have a food resource and a farm to produce it. That's great but what purpose does food serve in the game? So far it has none, so we need to give it one. What I want it to do is sustain a population in a colony station. Every cycle of 5 minutes the population must consume food, or
more exactly rations. If there's not enough rations, the population will suffer and eventually die. The game does nothing of that sort yet, population and colony station will be added in the xml file. The colony station is basically another &lgComponent> so that is fine. Population is more tricky, it's an
extra logic not implemented in the game itself. That is why the game can be extended with dll files.
Dlls are extra bits of code that comes in several kind of flavors depending on their usage. Galaxy generators, AIs, traders, action buttons (e.g. move and attack commands) are all handled in separated dlls. Components can be extended as well with a dll. Thus, "pop.dll" was created with the specific logic for handling the colony population. The code essentially waits 5 minutes, then goes through the host station's resource storage for any resources that has a "Ration" attribute and consumes what it needs to sustain the current population count. It also adds the new population from births, deaths from starvation, compute moral and other population related stuff.
Here's a small subset of the API available to the dlls, it gives a good idea of what can be done with a unit (PUnit) and it's resource storage (PResourceStorage).
All entities: units, stations, fleets, players, sectors, etc have similar interfaces. What can be done with these dlls is pretty much endless.
The API will be available to players on day 1, along with some samples.
For anybody who is into 3D, adding custom 3d models is very simple well. We are currently using a modified ASE exporter for 3ds max + a tool to convert .ase to .cmp, which is what DSS reads. Both will be made available at day 1 as well. Once exported, an asset - the turret station hub in this case - is then described in .xml like this:
<CompSlot id="Hub0" category="Turret" pre="Point001" /> refers to a hardpoint, where turrets can be placed. These are placed using point helpers in Max:
And finally in the game:
We are looking forward to see what you will do to this game. :D