How does merging TDFs work?

How does merging TDFs work?

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

Post Reply
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

How does merging TDFs work?

Post by Pxtl »

I'm working on some tools, and I ran into a problem - if a player wanted to insert unit X into mod Y by using a mutator, and his new unit X included (a) a new buildlist, or (b) a new explosion, would he either code his new explosion, add it to the package, and then make the modinfo reference the original package?

I'm not being clear here really. Let's say that somebody wanted to add the MAD to AA. The MAD, logically, requires a new explosion, we'll call BlowUpEverything. So, his modinfo file woudl be something like

Code: Select all

[MOD]
{
Name=TestName for AASpring211;
Description=none;
NumDependencies=1;
Depend0=AASpring211;

URL=http://pxtl.livejournal.com;
ModType=1;

	
}
and his new Explosions.TDF would be

Code: Select all

[BlowUpEverything]
{
	usedefaultexplosions=1;	
	[groundflash]
	{
		flashSize = 20000;
		flashAlpha = 2.4;
		circleGrowth = 125;
		circleAlpha = 4;
		ttl = 35;
		color = 1,0.7,0.7;

	}
}
(don't take the values seriously, just made them up on the spot)

Would he have to include all the original explosions.TDF data from AA, since his explosions.TDF overrode the originals? Or would the AA explosions.TDF be preserved, and his new BlowUpEverything be added?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

It scans for all tdfs in gamedata/explosions. But there is no override system in place, so you can't have one TDF overriding a particular explosion. All explosion types need unique names.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

jcnossen wrote:It scans for all tdfs in gamedata/explosions. But there is no override system in place, so you can't have one TDF overriding a particular explosion. All explosion types need unique names.
What happens in the event of a name collision? It takes the newer (mutator-defined) one?
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Post by jcnossen »

it combines everything, and the last file (depending on how the files are ordered, which you can't set), overrides the properties of the first.

[test]
{
a=3
b=2
}

+

[test]
{
b=3
c=4
}

=

[test]
{
a=3
b=3
c=4
}
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

jcnossen wrote:it combines everything, and the last file (depending on how the files are ordered, which you can't set), overrides the properties of the first.

[test]
{
a=3
b=2
}

+

[test]
{
b=3
c=4
}

=

[test]
{
a=3
b=3
c=4
}
OOOooooooh, I'd assumed it was merging on a per-group basis, not a per-tag basis. That's impressive. Neato. Allright, fantastic.

Good to know.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

Hmm - does this also apply to units? That is, can I override single tags in an .fbi file with something like:

armpw.fbi

Code: Select all

[UNITINFO]
{
	Name=Metalless Peewee;
	BuildCostEnergy=1897;
	BuildCostMetal=1;
}
it would modify the existing peewee unit without me having to go through and copy all the other tags? Since that's how my system currently works (copying the whole file and making the relevant changes).
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

This is also not a mod.
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

you are not a moderator

and this is important for mod development.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Pxtl wrote:Hmm - does this also apply to units? That is, can I override single tags in an .fbi file with something like:

armpw.fbi

Code: Select all

[UNITINFO]
{
	Name=Metalless Peewee;
	BuildCostEnergy=1897;
	BuildCostMetal=1;
}
it would modify the existing peewee unit without me having to go through and copy all the other tags? Since that's how my system currently works (copying the whole file and making the relevant changes).
If in doubt, try.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

jcnossen wrote:it combines everything, and the last file (depending on how the files are ordered, which you can't set), overrides the properties of the first.

[test]
{
a=3
b=2
}

+

[test]
{
b=3
c=4
}

=

[test]
{
a=3
b=3
c=4
}
Been doing some more digging. When I try this functionality with FBI files, I get errors. I know I need at least the UnitName and the Name, or FBI files won't work and the engine complains... testing further is tedious. Do FBI files have the inheritence behaviour, or only TDF files?

Also (and more importantly), how does overriding TDF file entries work for the stuff in SIDEDATA.TDF? With explosions, it took the union of both sets, choosing the newer in collisions.... does it do the same with sidedata? In that case, how does one remove a faction, or remove units from a buildlist?

TIA.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

jcnossen wrote:it combines everything, and the last file (depending on how the files are ordered, which you can't set), overrides the properties of the first.

[test]
{
a=3
b=2
}

+

[test]
{
b=3
c=4
}

=

[test]
{
a=3
b=3
c=4
}
Been doing some more digging. When I try this functionality with FBI files, I get errors. I know I need at least the UnitName and the Name, or FBI files won't work and the engine complains... testing further is tedious. Do FBI files have the inheritence behaviour, or only TDF files?

Also (and more importantly), how does overriding TDF file entries work for the stuff in SIDEDATA.TDF? With explosions, it took the union of both sets, choosing the newer in collisions.... does it do the same with sidedata? In that case, how does one remove a faction, or remove units from a buildlist?

TIA.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl »

bump. I'm still looking for information on the merging behaviour for the other TDFs (Sound.TDF, MoveInfo.TDF, and Messages.TDF) and Armor.txt files. Testing merging functionality is exceedingly tedious, so if anybody actually knows how it works (or where to look in source) I'd appreciate it.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

It reads the file, sets the appropriate values, then reads the next file and sets those values. The same parser is used for all tdfs so they all behave the same.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

For all tdf data there is only the basic per-file overriding mechanism (ie. mod file overrides it's dependencies, real file overrides VFS file).

The explosion generator however, uses the same parser to load all files, so tags from one file can override the other.

The unit loader assigns IDs based on filename, so this doesn't work with units.

Messages.tdf is per-file only. If the filename is "hardcoded", you can be sure it's per-file only, ie. this basically applies to everything in gamedata except the explosions.

I don't know about the other things you mention, but assume it's only per file overriding unless someone can tell you otherwise.
Post Reply

Return to “Game Development”