Spring Modding Conventions

Spring Modding Conventions

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Spring Modding Conventions

Post by FLOZi »

So, I was chatting with Gnome last night and we got onto the topic of file naming conventions in mods, and how much easier they make life later on once the mod is quite large. This got me thinking about other conventions that might be a good idea.

So I thought I would start a set of guidelines for mod makers to help make an easy to work with mod, both for themselves and for anyone who has the (dis?)pleasure of trying to add to someones work.

The idea of this thread is for modders to critique these guidelines and add there own. :wink: Many sound obvious, but there are plenty of TA mods that don't adhere to a single one. :P

Section 1: Overall Unit naming conventions

Having a strong convention that you stick to when naming units is perhaps the most important part of an easy to work on mod. A sidename prefix is particularly useful, and unit names should be a sensible acronym, designation or shortened name.

e.g. ARMWindGen, GERTiger, IMPAT-AT

Section 2: Individual file conventions

by folder:

Download:
Now this may be controversial. The standard way of doing this in TA was to have a unitname.tdf which contained all the places that unit was built. My reccomendation is to switch to having factory_unitname.tdf, which contains all the units built by that factory. This was possible in TA, though in TA download .tdfs could only have a limited number of [MENUENTRYX] (N.B. In TA the X didn't matter, in Spring all X must be different). This makes it easier to spot conflicts and results in less files to navigate.

Also as Spring works its menus differently, it may be simplest to use just one MENU, and constantly increment BUTTON, to avoid menu conflicts. (Of course, the menus may very well work differently in the NewGUI... Indeed I hope blanks are allowed again) So if you would like blanks stick to the TA system.

Features:
All corpses of a unit should be in a single df, sticking to a naming convention. e.g. unitname.tdf, unitname_corpses.tdf Each indvidual feature should also stick to a convention, e.g. unitname_corpse1, unitname_corpse2

Debris is the exception to the rule, as they tend to be used for multiple units, all debris features should be in one f.ex. debris.tdf file.

GameData:
Moveinfo.tdf:
Stick to a convention when naming moveclasses. e.g. LightVehicle2 or MediumVehicle3, where the number denotes footprint. Remember that amphibious moveclasses must have 'HOVER' in their name.

Sidedata.tdf:
Use sensible side names and prefixes

Sound.tdf:
Use sensible categories prefixed by side e.g. GERInfantry, IMPTroops

Objects3d:
All main .3do or .s3o should be named the same as the unit, e.g. ARMWindGen.3do. Corpses should stick to the same convention as used in the features, e.g. unitname_corpse1.s3o

Debris again is the exception and should follow its own convention.

Scripts:
Always. ALWAYS include the original .bos. Descripted .cob have no comments and while Scriptor can guess some obvious variable names, e.g. restore_delay, most it cannot. Which leads me on to...

Stick to good programming style in your scripts - i.e. use sensible, concise but understandable variable names, both static and local. Comment any code which isn't immedietly obvious as to what it does. This will make the life of anyone who is debugging the script later on, including yourself, a whole lot easier. (debugging SWTA transports scripts ripped for AATA from descripted .cobs with ~30 stat_vars is not fun!)

With new units, stick to the Spring style weapon scripts i.e. AimWeapon1, not AimPrimary.

Sounds:
Again, naming is key. Prefix by the category from SOUND.tdf or by f.e.x WEAP for a weapon sound. e.g. US_INF_underattack.wav, US_INF_select1.wav, WEAP_105mm.wav

Unitpics:
Pick a file format and stick to it, and stick to convention e.g. unitname.bmp

Units:
Keep filenames and internal UNITNAME the same (In TA this was actually required, I'm not sure about Spring). Don't miss weapon numbers (this will crash without a NOWEAPON weapon, and they are still displayed in FPS view) i.e. do not have a weapon3 if there is no weapon 2

UnitTextures:
Tatex:
For 3do per-face textures, name the files accordingly e.g. GERTiger_turretfront00.bmp, SIDE_metalgrad1_00.bmp. This makes it alot easier to find what unit is missing textures and where abouts this texture might be on the model.

For .s3o use the same name as your model, for both maps. e.g. GERTiger1.dds, GerTiger2.dds

Weapons:
Prefix weapons by the side that uses them, if multiple sides use the same weapon prefix with f. ex. UNI or ALL. Again use a sensible description e.g. GER150mmH G/H/M would represent Gun/Howitzer/Mortar respecively and indicate the HighTrajectory setting that is appropriate.

One thing to consider would be to place all weapons used by a unit in unitname_weapons.tdf, but this is probably not a good idea; traditonally most weapons are used by more than one unit.
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Post by Das Bruce »

Sounds reasonable enough.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

A few things:

1) Download TDFs vs Sidedata
Spring can read build trees in their entirety from Sidedata.tdf within the Gamedata folder. After messing with it a bit, I finally broke my own habit of preferring download TDFs and switched to this method. To set up a build tree this way, just do this:

Code: Select all

[CANBUILD]
{
	[ARMCOM]
	{
		canbuild1=armsolar;
		canbuild2=armwind;
		canbuild3=armestor;
		canbuild4=armmstor;
		canbuild5=armmex;
		canbuild6=armmkr;
		...
	}
	...
}
Obviously it takes a bit of time to do it this way, but it's well worth it, since it's incredibly easy to spot and fix conflicts (Just remember to increment the number!), and it does conserve ever so so much space (sure, only a few KB, but it can't hurt). It's just much much easier to manage your mod's entire build tree this way. Doing it this way also negates the need for a download or guis folder at all (unless you have nuke type weapons, which require GUI files).

2) Objects3d
The texture map names for s3o files are written into the .s3o itself. That means it doesn't matter much what you name them, just that you saved your file right. I do recommend following FLOZi's advice there, though, and naming them the same as your unit.

3) Moveinfo.tdf
Try to use as few classes as you can get by with. This will decrease load times for end users on new maps with your mod. Don't be afraid to use as many as you need; just be aware that for each additional class you add adds a little more time to the path calculation on new maps pre-game.

4) The Anims folder
Make sure to keep the cursors! If you don't include them in your mod, create a dependency in your modinfo.tdf file to the base Spring package that does contain them. The game will not work without them.

5) infolog.txt
Is a very useful resource. It's located in the root Spring directory, and contains a log of what happened in the game you just played. It's invaluable for finding missing corpses, textures, or other files. Just be aware that it's overwritten with every game you play.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

1. I think it's a matter of personal preference. Certainly either method is acceptable.
2. I should have been more specific, totally correct.
3. Good call!
4. Ah yes... Should probably consider dependancies overall as another section?
5. I had totally forgotten that that existed! :oops:
User avatar
Das Bruce
Posts: 3544
Joined: 23 Nov 2005, 06:16

Post by Das Bruce »

Can we add custom cursors?
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Bruce: Yep, you just have to give them the right names. They can be as many frames as you want too, just don't depend on any other files with cursors in them if you make your own.

FLOZi:
1) Yes, I agree, but I was just simply putting it up again to present it as an option. Like you said, either is acceptable.
4) Probably, replacements too (BTW, don't Replace and Depend on the same file, it causes the lobby to crash)
5) Back in my day I had to haxx0r the exe to create my own version of it :)
User avatar
Tim Blokdijk
Posts: 1242
Joined: 29 May 2005, 11:18

Post by Tim Blokdijk »

Feed the Wiki! :wink:
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Naming conventions make life far, far easier.

I like to put a "_" between -side and -unit/weapon/whatever names, ie GHE_MEDTNK or IG_LASCANNON
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

Gnome wrote:A few things:

1) Download TDFs vs Sidedata
Spring can read build trees in their entirety from Sidedata.tdf within the Gamedata folder. After messing with it a bit, I finally broke my own habit of preferring download TDFs and switched to this method. To set up a build tree this way, just do this:

Code: Select all

[CANBUILD]
{
	[ARMCOM]
	{
		canbuild1=armsolar;
		canbuild2=armwind;
		canbuild3=armestor;
		canbuild4=armmstor;
		canbuild5=armmex;
		canbuild6=armmkr;
		...
	}
	...
}
What an original idea, Gnome! :P

In G/E/M I probably won't abide by these rules... units will just be "unitname" period... like, a GEF Raptor is "raptor.fbi". Seems simple enough. Weapons will be named very simply...

LightLaser
MediumLaser
HeavyLaser
LightPulseLaser
MediumPulseLaser
HeavyPulseLaser
LightUVLaser
MediumUVLaser
HeavyUVLaser
LightUVPulseLaser
MediumUVPulseLaser
HeavyUVPulseLaser
LightIonGun
MediumIonGun
HeavyIonGun
LightPlasmaGun
MediumPlasmaGun
HeavyPlasmaGun
LightNeutronGun
MediumNeutronGun
HeavyNeutronGun
LightMesonGun
MediumMesonGun
HeavyMesonGun
LightMissile
HeavyMissile
MultiHeadMissile
LightBomb
HeavyBomb

And the rest.... ahem... is a deep, dark, scary secret. :twisted:
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

stop pimping and start releasing!
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Caydr wrote: What an original idea, Gnome! :P
I never claimed it was my own, I just posted it here so new people viewing this topic would know it's available as an option *shrug*
maestro
Posts: 352
Joined: 08 Jun 2005, 11:10

Post by maestro »

convention.... hmmm...
more rule to break heheheh.....
Im gonna make all kind of weird name for WD that almost intraceable :twisted: maybe using ^%&$%YHFSA125 for BMP.... :P
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

So... you'll continue doing what you've been doing as usual, gotchya :P
User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo »

Since WD used some OTA units, sometimes the ARM and COR prefixed stuck and some other outdated prefixed stuck as well.

It would be a gargantuan task to change all these names to conform with these standards, I memorized the unit names my self and IMO it's only important to my self and Maestro, I don't support 3rd Party developments of WD very well either.

I will also stick to my test and tried download .tdf's rather than anything else.

in my next mods (if any) I will conform and add such prefixes, but for right now I will stick to the methods I am used to, the risk for postponing it's release is too high since there will undoubtfully be bugs arrising from forgetting to rename a file.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

*huge collasal bump*

Mainly to remind me to update and wikify this.

And to get any of the newer crop of modders to add any suggestions.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

LOCK PLEASE

also, fyi, I used download .tdf files they work for me because I do not have to sort through a giant list. I think using sidedata is MORE jumbled and cumbersome.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Do not lock please. This thread is still very useful, and is not a bunch of flames, and still requires discussion and input.

Not all thread bumping is bad. :roll:
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Post by smoth »

it is TWO YEARS OLD!
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

It is a year and 2 months old. And still entirely relevant. And still merits discussion.

Would you rather i start another topic on exactly the same subject? Would that not be incredibly wasteful?

Yes, it would. As much as this off-topicness is. So;

Stuff to add:
  • Conventions for custom explosions / FX
  • Conventions for dependancies and such
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

This thread should just remain dead, it's full of outdated crap.

New modders should download NanoBlobs, study its documentation, the Wiki, and Maestro's last UpSpring guide, and start cracking.

I have decided that I'm not answering questions from people who have not studied the files in NB anymore, because I'm getting thoroughly annoyed with people who haven't bothered looking at the files, for things like S3O file/texture structure, how to write explosion generators that aren't just a Heatcloud and a Groundflash, etc., etc. It's not that I'm a heartless jerk- really, I'm not. I've tried helping everybody a lot. It's that I'm sick of answering stupid questions that are easily answered by studying NB at least twice a week...
Post Reply

Return to “Game Development”