Creating a new ship component for GSB 2

This is a technical guide for modders who wish to add new ship graphics to the game Gratuitous Space Battles 2. You will need access to a 3d Modeling program as well as the ability to edit text files using an editor such as notepad(free with windows) or textpad 32.

Firstly lets see the two basic images that you are going to need to add a component to the game. We call them the sprite and the normal map. The first image is the sprite, and it contains both the color information for the object, and the alpha map (not visible) which is basically transparency information for it. The original artwork for GSB2 involved 3d-modeling a basic shape, and then rendering it from a top down view without any lighting, so it had no shadows or shading. If we were calling this new object 'newcockpit', this image would be called, and saved in 'dds' format. You can get a DDS exporter for photoshop, paintshop pro and most other graphics programs. We save them in AL format, with 8 bits of color plus 8 bits of alpha, mip-maps enabled.

The image on the right is the 'normal' map. This is the same object, but tells us where the angles and curves are and allows the 3D-effect lighting to work correctly. Basically the red colors show direction in one axis and the green colors show the direction in the other. Most 3D modeling programs have a feature, or a plug-in or tutorial on how to render out normal maps for an object. The background that they are rendered against is normally grey. We save these images as dds too, although in RGBA 32 bit format this time, and name them with at the end, such as That way the engine finds them.

This next image is entirely optional, and you can can several if you like. its an additional layer that gets drawn on top of the first sprite. Why bother? because this layer can have a different color (as selected by the player) and might only be a small part of the original image, allowing you to have fixed-color parts and stripes. You can call this what you like, but here we call it Again, its a 16bit unsahdowed greyscale DDS file.

This next image is also optional. its a lightmap, and the lightmap is normally automatically generated from the first layer, and is all black, but with the alpha of that layer. If you want to actually have part (or all) of your object emit light, you need a separate lightmap where the illuminated sections are white, BUT you must also ensure that the lightmap has an alpha channel; which matches the alpha of the first object. In this image we have colored the transparent area red to show you what we mean. This image should be another 16bit DDS saved with, so

That is all the graphics you need for your new object. This should be a bunch of DDS format images that will place anywhere inside the folder for your mod (the game finds them anywhere). In order to make the object usable in the game you are also going to need to create a text file describing how they all work...

Creating the text file

New visual objects in the game are called 'elements', and each one has a text file inside /Gratuitous Space Battles 2/data/elements. In your mod, they will be in the mod folder but inside the same path (/data/elements). The elements text file has a number of sections and entries, here is a breakdown of what it all means...



The name used internally by the game to reference this object. Never seen, must always be unique to the whole game


The name of the object shown when you hover your mouse over it in the ship designer


The initial size of the object compared to an entire ship hull, in terms of it's width


See above...


Set this to VISUAL


a list (comma-delimited) of the races that this component is restricted to, or empty for all.


A number that positions this element in the UI in reference to all other existing elements


This section has one entry for each sprite to be drawn, from bottom to top


This is an index number (start at 0), the name of the first sprite, and FIXED if the color cannot channge or TINTABLE if it can.


see above...


One section for each defined hulk object (debris) associated with this element when destroyed

layer0 =,1,0.0,0.0,1.0,1.0

In this case, take the bottom layer, use the 0 to say FIXED (1 is tintable),then 0,0 is top left, 1,1, is bottom right marking the four corners of this hulk object.

layer1 =,1,0.0,0.0,1.0,1.0

Note that with the hulk, you will need to create that file. In this case we defined two different hulk files, and used the whole area of each one, but you can place multiple hulk layers in a single image and use those 0,0,1,1 to be the UV co-ordinates to pack them into a single texture. (The elements in the game do this).

Once you have all the graphics files and the element file, you can place them inside a folder within \my documents\my games\gratuitous space battles 2\mods, and then use the mod control panel within steam to create a new steam workshop submission containing your new content.

Positech Games