Simple Mod Tutorial


Until I Finish Mod Development is the place to go.

This Tutorial Aims to get a person from knowing nothing about Spring to the point where they can create and edit mods.

Right now I am working from memory so you may want to correct me when I'm wrong, I will try to cross link from my summaries to the appropriate articles available in other places.

I will not go too deep into making 3do's because they are old and dumb... but I'll try to make note of the differences here.

I don't know anything about scripting right now, so that section is likely to be sparse when I write it, I hope that someone will expand on it.

Contents

Book 1: The First Unit

Step 1:Planning

Who cares about planning, you know what you're doing... just come up with an idea for a mod... I made a chess set... if you don't have a real idea and just want to make a model show up in the game... then yeah... this is the place to start... I'd do that if I were you.

Another good thing to do at this point is to creat a "working directory", and inside it create a directory with the name that your mod will have... after many headaches I decided it's best to put this in the root directory of your system so it's really easy to find when you are switching around back and forth between folders and keep having to find your files over and over again.


Step 2:Getting Da Tools

You will need a bunch of stuff... here's the list (I assume you are using windows)

Want:

  • Spring - The main program, you will likely need this to test if you've screwed up
  • A Tiny Map (2x2) - to test your mod fast (suggest Simple Chess Map)

Need:

  • Program listings can be found here: Map, Mod, And Unit Development Programs
  • 3D Modeling Program - See above link
  • Notepad - to edit all the miriad of text files
  • A Graphical Editing Program - needs to handle RGBA TGAs (aka tga's with alpha channels), I suggest Photoshop if you have it, or The GIMP... needed for all of the texture making for UVmapping stuff... See above link
  • Upspring 1.3 - To convert your models to the approprite s3o format (if you want to fight with 3do builder, then go ahead... a good trick is to get your model into upspring first and adjust all the hierachy, then save it as an 3do... but why bother?). See above link
  • Scriptor - to make and compile your units "animation script"... or steal someone else's and make it work for your unit. See above link
  • Compression Utility - (I suggest 7zip - even if you are using zip compression and not 7zip, it's still good to have)

Step 3:Making a 3D Model

Go into your 3D modelling program and make a 3D model, combine all the objects and UV map the model, then separate it out into any parts that need to move independently of each other. Then Export the UV map as an Image File and Export the whole thing as a 3ds file. Put the original wings file, the UVMap image and the 3ds file into your working directory so you can find them later.

Wings 3D UV Mapping tutorial has been started here - Units:CreateModel

Step 4:Fixing Your Images

This Article includes a UVMapping Guide

Open up your UVMap in Photoshop (or whatever) go to the layer/chooser thingy and go to the Channels Tab, add a new layer (it should default to alpha) and fill it with 99% black so you can see your texture in upspring. If you want to can paint the UVmap and put white (1% black) on the alpha channel where you want your team colours to show up (you can use something between 1% and 99% to get a blend of your team colour along with the texture... for example 50% will give you your texture with 50% of the team colour mixed in...)

I don't know how to do glow maps... XXreminder for someone to create a Glowmapping tutorial... you don't acctually need one for the model to show up.

Save these images both in the working directory.

Save a copy of these images in tga format into <working directory>/<mod name>/unittextures

Step 5:Upspring

Importing Your 3ds

Open Upspring 1.3, go to file>load model and navigate to and open your 3DS model you exported, you should see the model in upspring as a 3d mesh. Go to the model tab and set the radius and height values to something other then zero... this defines where the health bar will show up, and more importantly, how big the collision sphere will be.

You will also need to use all of the other tools on those tabs to resize and rotate and move your model to the right place... wings makes models that are 90 degrees off and about 30 times smaller than most spring models... make sure you click the "apply transform" button after any changes that you actually want to show up in the game.

Also, you will want to make the hierachy work using the cut, paste, and add empty buttons. You will need an object called "base" that all the other objects are connected to... the "origin object"... sometimes you get lucky and wings exports it properly... usually not.

Importing Your UV and Glowmaps

Go to the textures tab and make your UV/texture/team-colour map as "texture1" and your UV/glow/reflectivity map as "texture2"... it should show up correctly in the preview pane.

Exporting Your s3o

Choose File>Save Model As then in the drop down select "s3o" and type an appropriate name. This model should be saved to your working directory, and a copy of it made to <working directory>/<mod name>/objects3d/

Step 6:A couple Text Files

UnitName.fbi

For Reference visit Units:FBI, but again, the easiest way to do this is to extract an existing mod and find the fbi for a unit that behaves similarly to the one you are trying to make and rename and modify it.

Some More Specific Information Not Clear in the "Units:FBI" article:

Name+" "+Description=Spring Display Name

So if you have the following settings:

Name=Tiger;
Description=Fast Attack C.A.T.;

The Tooltip will show "Tiger Fast Attack C.A.T."

BuildPic Defaults to UnitName.bmp

So if you leave out "BuildPic=filename.bmp;" Spring will look in /unitpics/ for a file called "UnitName.bmp" to use as your buildpic.

ObjectName

If you want to use an s3o object, you will need to specify with "ObjectName=UnitName.S3O;" otherwise it will look for "UnitName.3do". Also, you don't have to use "UnitName" as the filename and, in fact, multiple Unit's fbi files can reference the same 3D models. It is easier, however, for people to figure out what you are doing in your mod if you follow the standards.

Save this file as plain text in <working directory>/<mod name>/units/

modinfo.tdf

modinfo.tdf is a text file that defines a number of things that are used when loading a mod, most of the information is self explanitory but basically what you are doing is defining what is going to show up in whatever mod-selection interface you use as well as what other files need to be loaded into memory in order for your mod to work.

Making a New Mod with your unit/units

The following is an example of what will be in your modinfo.tdf file if you are starting from scratch and making your own mod. This is also good when you are just testing one unit to see if it works.


[MOD] {

 // The name is shown in the selection interface
 Name=My Mod; 

 // These can be shown by the selection interface 
 Description=My Mod That I Made; 
 URL=http://www.theplacepeoplecangetthelatestversionofyourmod.com; 

 // What kind of mod this is 
 //  0 - Hidden (support mod that can't be selected, such as OTA_textures) 
 //  1 - Normal, only one can be selected at a time 
 //  2 - Addon, any number of these can be selected. Could be used 
 //      for single units for example. 
 //  others - perhaps mutators and addon races that can be 
 //           enabled in addition to xta for example? 
 ModType=1; 
 // Number of other archives this one depends on    
 NumDependencies=4; 
	Depend0=taenheter.sdz;
	Depend1=springcontent.sdz;
	Depend2=otacontent.sdz;
	Depend3=tatextures.sdz;
        

 // Number of other archives this one replaces
}

Adding Your Unit to an Existing Mod

The following is an example of what will be in your modinfo.tdf file if you are adding new units to an existing mod (in this case xta_se_v066.sdz), this is good for adding units to the build tree of an existing mod or adding a whole new team.


// Description of the mod control file recognized by spring:

[MOD] {

// The name is shown in the selection interface
Name=XTASEv0.66 with+My Units; 

// These can be shown by the selection interface
//
Description=xta_se_v066 with the cool tank I made; 
URL=http://www.fileuniverse.com/exactlocationblahblahblah; 

// What kind of mod this is 
//  0 - Hidden (support mod that can't be selected, such as OTA_textures) 
//  1 - Normal, only one can be selected at a time 
//  2 - Addon, any number of these can be selected. Could be used 
//      for single units for example. 
//  others - perhaps mutators and addon races that can be 
//           enabled in addition to xta for example? 
ModType=1; 

// Number of other archives this one depends on    
NumDependencies=5; 
	Depend0=taenheter.sdz;
	Depend1=springcontent.sdz;
	Depend2=otacontent.sdz;
	Depend3=tatextures.sdz;
	Depend4=xta_se_v066.sdz;
        

// Number of other archives this one replaces
} 

If you are not depending on OTA files, you will have to supply your own cursors.

There are some extra bits in these examples, but I work on the "better safe than sorry" principle... which is to wait for someone who knows what they are doing to fix my articles.

You will want to save this file as plain text in <working directory>/<mod name>/

Armor.txt

I'm not exactly sure how this works, but the file needs to exist, so either steal one from another mod and modify it... or just make a file that looks like this.


// [UNITNAME]- Good Against Lazer/Bad Against Nukes
[UNITNAME]
{
}


You will want to save this file as plain text in <working directory>/<mod name>/

SIDEDATA.TDF

Start by stealing the sidedata.tdf file from your dependency mod if you have one, then edit it to include your units/side.

Basically this file is in the form:

[SIDE0]
	{
	name=Good Guys;
	nameprefix=GG;
	commander=UnitName1;
	}
[CANBUILD]
	{
	[UnitName1]
		{
		canbuild1=UnitName2;
		canbuild2=UnitName3;
		canbuild3=UnitName4;
		canbuild4=UnitName5;
		canbuild5=UnitName6;
		}
	}    


...with additional "[SIDEX]" entries for each side/team/commander-choice available in the mod-selector you choose, additional "[UnitName]" sections for each factory of construction unit, and additional "canbuildx=UnitName" entries to all factory/con-units that can build each unit.

You will save this file as plain text in <working directory>/<mod name>/gamedata/

MOVEDATA.TDF

This file determines the footprint of your units, the angle of slopes they can climb and in how deep water they can drive. It contains several entries, all in the following format:


[CLASS#] (Replace # with numbers, so you get entries CLASS0, CLASS1 etc.) { name=KBOT; (This is the name. FBI files refer to this name.) footprintx=1; (This is how big the X dimension is of the footprint in Spring units probably?) footprintz=1; (This is how big the Y dimension is of the footprint in Spring units probably?) maxwaterdepth=5; (This is in how deep water the unit/unit class can walk.) maxslope=36; (The maximum angle of slopes this unit can climb.) crushstrength=10; (This determines if the unit/unit class can crush certain features) }

SOUND.TDF

This file refers to all the sounds your units make, so Spring knows which sound file is linked to what action. It contains entries in the following format. [NAME] (The name of the unit class) { There are lots of different entries, I will list only the basic ones here for now. select1=sound; (This entry determines what sound a unit makes if you click on it. ok1=sound; (This entry determines what sound a unit makes if it does an action. cant1=sound; (" " " " " " " " if it can't do an action.) underattack=sound; (" " " " " " " " if it is attacked) count5-count0=sound; (These 6 entries determine how the self-destruct countdown times sounds like. canceldestruct=sound; (A unit makes this sound if you cancel the self-destruct procedure) }

Step 7:Adding a Build Pic

Add a 96x96 BMP to your <working directory>/<mod name>/unitpics/ folder named either "UnitName.bmp" or whatever you specified in the "BuildPic=" line of your fbi.

Step 8:Adding a Side Pic

Add a 16x16 BMP to your <working directory>/<mod name>/sidepics/ folder named "teamname.bmp" or whatever you specified in the "name=" line of your SIDEDATA.TDF for each side/team you have added.

Step 9:Scriptor

Stealing a Script

Open someone else's script in scriptor that works the way you want your script to work, look at the top where it's talking about "piece names"... then change those piece names to be the piece names of your unit and do a find/replace to make all the places where those pieces show up to be your pieces too. Compile it so its name is the same as the "UnitName=" value in your "UnitName.fbi".

XXreminder to someone to link to a proper scripting tutorial

Put the bos and cob files for your unit script in <working directory>/<mod name>/scripts

Step 10:Compiling Your Mod

You may want to check your mod directory and make sure it follows the structure defined here.

navigate to your <working directory>/<mod name> and select everything and choose "add to archive <mod name>.7z".

make a copy of this file called <mod name>v0.7z in your working directory so you don't screw anything up later, then make a copy of it called <mod name>.sd7 in the mods directory of spring.

An alternative, added in more recent versions is the ".SDD" folder, to use this, copy the entire <mod name> folder in the mods directory of spring and rename it as "<mod name>.SDD". The advantage to the ".SDD" method is that you can tweak settings and add files without recompressing your mod all the time. When it comes time to distribute your mod use ".sd7".

EXAMPLES: If your mod is called JoesMod you will have a file called "JoesMod.sd7" or a folder called "JoesMod.SDD" in your spring mods directory.

Step 11:Testing Your Mod

Open Up your lobby client, pick your mod from the drop-down list of the games in host battle or singleplayer mode if your lobby supports it(if it doesn't show up you screwed up your modinfo.txt), choose your tiny map from the map list and press start. If it doesn't break and your unit shows up, you have created all the neccessary files... yay!

Gotchas:

  • If it doesn't work, check you didn't zip the folder itself, but the contents, ie if you open mymod.sd7 with 7zip, you should see folders such as "unittextures" rather than a folder "mymod" containing unittextures.

Retrieved from "http://spring.clan-sy.com/wiki/Simple_Mod_Tutorial"

This page has been accessed 3,899 times. This page was last modified 18:16, 31 October 2008.


 
 


Page editing toolbox

Browse
Main Page
Community portal
Current events
Recent changes
Random page
Help
Donations
Edit
View source
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Log in
Special pages
New pages
File list
Statistics
Bug reports
More...

Site layout created by Roflcopter.