

-Cargo ship configuration

-How often cargo ships spawn

-Fleets

-Preset/Semi-Random Cargo Containers



All of the work we will be doing here will take place in the "data" folder. This can be found in /steamapps/common/SpaceEngineers/content/.



----------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Lets start with the SpawnGroups.sbc file. SBC files can be opened with any simple text editor, such as notepad or textedit.

Here is a small piece of SpawnGroups.sbc that controls the configuration of the Commercial Freighter:

Code: <SpawnGroup> <Id> <TypeId>SpawnGroupDefinition</TypeId> <SubtypeId>Trade3</SubtypeId> </Id> <Icon>Textures\GUI\Icons\Fake.dds</Icon> <Frequency>1.0</Frequency> <Prefabs> <Prefab SubtypeId="Trade3"> <Position> <X>0.0</X> <Y>0.0</Y> <Z>0.0</Z> </Position> <BeaconText>Commercial Freighter</BeaconText> <Speed>10.0</Speed> </Prefab> </Prefabs> </SpawnGroup>

Hello there, i am currently developing a cargo ship mod. I've been working with the game files relating to cargo ships for a while now, and i thought it would be nice to share what i've learned with anyone trying to mod the cargo ships or just plain curious. In this guide i will cover:-Cargo ship configuration-How often cargo ships spawn-Fleets-Preset/Semi-Random Cargo ContainersAll of the work we will be doing here will take place in the "data" folder. This can be found in /steamapps/common/SpaceEngineers/content/.----------------------------------------------------------------------------------------------------------------------------------------------------------------------------Lets start with the SpawnGroups.sbc file. SBC files can be opened with any simple text editor, such as notepad or textedit.Here is a small piece of SpawnGroups.sbc that controls the configuration of the Commercial Freighter:

<SpawnGroup>

Tells the game that this is the beginning of a new cargo ship configuration



<Id>

..<TypeId>SpawnGroupDefinition</TypeId>

..<SubtypeId>Trade3</SubtypeId>

</Id>

Tells the game what to refer to the cargo ship/fleet of ships as in code. In stock, its always the same as the prefab file name, but that is not necessary.



<Icon>Textures\GUI\Icons\Fake.dds</Icon>

I have no clue what this does, but i don't think its important. I've looked through the files, Fake.dds is just the icon that shows up when another icon fails to work, or something like that.



<Frequency>1.0</Frequency>

This number controls how often the ship spawns. For reference, large cargo ships (Commercial Freighter, Mining Hauler, Military Transporter) are always 1.0. Medium ships (Business Shipment, Mining Transporter, Military Minelayer) are 2.0, and small ships (Private Sail, Mining Carriage, Military Escort) are 4.0.



<Prefabs>

This begins the prefabs section, which deals with the characteristics of the cargo ship/ships.



<Prefab SubtypeId="Trade3">

This is telling the game what the ship file is called. The ship files can be located in the content/data/prefabs folder. This line also serves as the beginning of a single prefab section, which is critical for fleets.



<Position>

..<X>0.0</X>

..<Y>0.0</Y>

..<Z>0.0</Z>

</Position>

This is telling the game where to spawn the cargo ship relative to the actual point of spawn. This is only important when making fleets, i will talk about this more there.



<BeaconText>Commercial Freighter</BeaconText>

This is the text that is on the beacon of the cargo ship. It overwrites beacon text in the ship file.



</Prefab>

This ends the current prefab.



</Prefabs>

This ends the entire prefab section.



</SpawnGroup>

This ends the cargo ship/ships configuration.



----------------------------------------------------------------------------------------------------------------------------------------------------------------------------



The second thing we will be looking at is the GlobalEvents.sbc file. This file controls how often cargo ships as a whole spawn, as well as meteors and other things. We will be focusing only on the part about cargo ships:

Code: <GlobalEvent> <Id> <TypeId>EventDefinition</TypeId> <SubtypeId>SpawnCargoShip</SubtypeId> </Id> <MinActivationTimeMs>780000</MinActivationTimeMs> <MaxActivationTimeMs>1020000</MaxActivationTimeMs> <FirstActivationTimeMs>300000</FirstActivationTimeMs> </GlobalEvent>



<GlobalEvent>

The beginning of a global event config. The beginning of a global event config.

<Id>

..<TypeId>EventDefinition</TypeId>

..<SubtypeId>SpawnCargoShip</SubtypeId>

</Id>





<MinActivationTimeMs>780000</MinActivationTimeMs>

This is the minimum time since the previous spawn that is required to pass before another ship can spawn. It is in milliseconds.



<MaxActivationTimeMs>1020000</MaxActivationTimeMs>

This is the maximum time since the previous spawn that is required to pass before another ship is forced to spawn. It is in milliseconds.



<FirstActivationTimeMs>300000</FirstActivationTimeMs>

How much time has to be in a world before the first cargo ship can spawn. When this time is up, a cargo ship will spawn, instead of beginning the MinActivationTime like most people would think it would do. It is in milliseconds.



----------------------------------------------------------------------------------------------------------------------------------------------------------------------------



The third thing we will be looking at is how to make fleets. This requires us to look at the "prefabs" section in SpawnGroups.sbc.

Code: <Prefabs> <Prefab SubtypeId="Trade3"> <Position> <X>0.0</X> <Y>0.0</Y> <Z>0.0</Z> </Position> <BeaconText>Commercial Freighter</BeaconText> <Speed>10.0</Speed> </Prefab> </Prefabs>

Code: <Prefabs> <Prefab SubtypeId="Trade3"> <Position> <X>0.0</X> <Y>0.0</Y> <Z>0.0</Z> </Position> <BeaconText>Commercial Freighter</BeaconText> <Speed>10.0</Speed> </Prefab> <Prefab SubtypeId="Trade2"> <Position> <X>100.0</X> <Y>0.0</Y> <Z>0.0</Z> </Position> <BeaconText>Business Shipment</BeaconText> <Speed>10.0</Speed> </Prefab> </Prefabs>



-----------------------------------------------------------------------------------------------------------------------------------------------------------



The final topic we will be exploring is the cargo containers on ships and how to change their randomly generated items. Basically, in a ships file, the place where the ship is converted into text, and where the inventory of a cargo container is stored. If you want to convert a ship into a cargo ship with semi-randomly generated items in the cargo containers, like stock cargo ships, you need to follow these steps. Well, you don't need to, but this is the simplest method. Not the fastest, simplest.

1. Paste down a copy of your ship in a world.

2. Make sure nothing has "Show on HUD" turned on.

3. Turn on "Show on HUD" for the cargo container you want to edit and make sure its empty (one container at a time with this method).

4. Export your ship to a SBC file

5. Open your ships file in textedit/notepad

6. Use the "Find" command using Ctrl+F (CMD+F on mac)

7. Search for "<ShowOnHUD>true</ShowOnHUD>"

8. This is where the cargo container preferences are kept.

<MyObjectBuilder_CubeBlock xsi:type="MyObjectBuilder_CargoContainer">

and

</MyObjectBuilder_CubeBlock>

are the beginning and end of the cargo container.

9. Look for </Inventory> in between these 2 lines. You should find 2 of them.

10. On the line below the lower </Inventory>, with the same amount of spaces as the lower </Inventory>, paste in the following: "<ContainerType>CustomContainer1</ContainerType>" Note that you don't always have to use CustomContainer1, but this is the name for the custom container we are about to create.

11. Go to /Content/Data/ and open up ContainerTypes.sbc, this is where all the premade cargo containers are. You can set them to always have certain items or semi-random items, the frequency of the items, and the amount of items. You can also control how many of this particular preset container appear on a ship

12. Go to the end, and right above </ContainerTypes> paste in the following

Code: <ContainerType CountMin="2" CountMax="3"> <Id> <TypeId>ContainerTypeDefinition</TypeId> <SubtypeId>CustomContainer1</SubtypeId> </Id> <Items> <Item AmountMin="5" AmountMax="12"> <Frequency>1.0</Frequency> <Id> <TypeId>Component</TypeId> <SubtypeId>GravityGenerator</SubtypeId> </Id> </Item> </Items> </ContainerType>



<ContainerType CountMin="2" CountMax="3">

This begins the cargo container preset. CountMin and CountMax are how many items the container can hold. For example, if CountMin was 4, the cargo container is guaranteed to spawn with at least 4 of your chosen items, but not more. CountMax is the maximum amount it can spawn with. This tells the game what event is happening. AFAIK this cannot be changed.This is the minimum time since the previous spawn that is required to pass before another ship can spawn. It is in milliseconds.This is the maximum time since the previous spawn that is required to pass before another ship is forced to spawn. It is in milliseconds.How much time has to be in a world before the first cargo ship can spawn. When this time is up, a cargo ship will spawn, instead of beginning the MinActivationTime like most people would think it would do. It is in milliseconds.----------------------------------------------------------------------------------------------------------------------------------------------------------------------------The third thing we will be looking at is how to make fleets. This requires us to look at the "prefabs" section in SpawnGroups.sbc.-----------------------------------------------------------------------------------------------------------------------------------------------------------The final topic we will be exploring is the cargo containers on ships and how to change their randomly generated items. Basically, in a ships file, the place where the ship is converted into text, and where the inventory of a cargo container is stored. If you want to convert a ship into a cargo ship with semi-randomly generated items in the cargo containers, like stock cargo ships, you need to follow these steps. Well, you don't need to, but this is the simplest method. Not the fastest, simplest.1. Paste down a copy of your ship in a world.2. Make sure nothing has "Show on HUD" turned on.3. Turn on "Show on HUD" for the cargo container you want to edit and make sure its empty (one container at a time with this method).4. Export your ship to a SBC file5. Open your ships file in textedit/notepad6. Use the "Find" command using Ctrl+F (CMD+F on mac)7. Search for " true "8. This is where the cargo container preferences are kept.andare the beginning and end of the cargo container.9. Look forin between these 2 lines. You should find 2 of them.10. On the line below the lower, with the same amount of spaces as the lower, paste in the following: "" Note that you don't always have to use CustomContainer1, but this is the name for the custom container we are about to create.11. Go to /Content/Data/ and open up ContainerTypes.sbc, this is where all the premade cargo containers are. You can set them to always have certain items or semi-random items, the frequency of the items, and the amount of items. You can also control how many of this particular preset container appear on a ship12. Go to the end, and right abovepaste in the followingThis begins the cargo container preset.andare how many items the container can hold. For example, ifwas 4, the cargo container is guaranteed to spawn with at least 4 of your chosen items, but not more.is the maximum amount it can spawn with.

<Id>

..<TypeId>ContainerTypeDefinition</TypeId>

..<SubtypeId>CustomContainer1</SubtypeId>

</Id>

SubtypeId is whats important here. When editing your ship file to spawn with a preset container, this is the name you will use. In this case, we have named it CustomContainer1, as we set the cargo container on the ship to spawn as CustomContainer1.



<Items>

Begins items section.



<Item AmountMin="5" AmountMax="12">

How many of this item should spawn in a stack. Make sure you don't spawn more than the container can hold.



<Frequency>1.0</Frequency>

Similar to the cargo ship frequency, this controls how often an item will appear in the container

<Id>

..<TypeId>Component</TypeId>

..<SubtypeId>GravityGenerator</SubtypeId>

</Id>

This is the actual item that will spawn. <TypeId></TypeId> Is the "class" of item. <SubtypeId></SubtypeId> is a sub-class. This cargo container is spawning a Gravity Generator Component. Here is a list of Classes and Sub-classes:



Component

InteriorPlate

Reactor

GravityGenerator

Medical

Thrust

Detector

Construction

SmallTube

LargeTube

Motor

MetalGrid

SolarCell

PowerCell

Display

Computer

Explosives

SteelPlate

Girder

BulletproofGlass

RadioCommunication

Scrap



Ingot

Gold

Silver

Platinum

Uranium

Silicon

Magnesium

Cobalt

Nickel

Iron

Stone



PhysicalGunObject

WelderItem

AngleGrinderItem

AutomaticRifleItem

HandDrillItem



AmmoMagazine

NATO_25x184mm

Missile200mm

NATO_5p56x45mm



Ore

Gold

Silver

Platinum

Uranium

Silicon

Magnesium

Cobalt

Nickel

Iron

Stone

Ice



13. Your custom cargo container is done! Filling other things, such as refineries, assemblers, oxygen generators, should be pretty much the same as the cargo containers if you know what to look for. Things like reactors should be filled in-game and saved with the ship to make it simpler.



-----------------------------------------------------------------------------------------------------------------------------------------------------------



Thank you for reading, and i hope you learned something or figured out what you were trying to do. If you want me to make more guides like this explaining the various .sbc files, just ask, and i will. I will do my best to update this as often as possible.