Page 1 of 1
How does merging TDFs work?
Posted: 04 Sep 2006, 00:37
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?
Posted: 04 Sep 2006, 01:21
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.
Posted: 04 Sep 2006, 02:13
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?
Posted: 04 Sep 2006, 11:54
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
}
Posted: 04 Sep 2006, 14:17
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.
Posted: 04 Sep 2006, 17:29
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).
Posted: 04 Sep 2006, 17:59
by Caydr
This is also not a mod.
Posted: 04 Sep 2006, 18:04
by NOiZE
you are not a moderator
and this is important for mod development.
Posted: 04 Sep 2006, 20:01
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.
Posted: 08 Sep 2006, 03:58
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.
Posted: 08 Sep 2006, 03:58
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.
Posted: 10 Sep 2006, 18:10
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.
Posted: 10 Sep 2006, 19:15
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.
Posted: 10 Sep 2006, 19:54
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.