Questions on mod filesystem layout

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Questions on mod filesystem layout

Post by Beowulf »

Hi,

I was wondering what the minimum set of files necessary for a mod's directory is. I tried to make a directory structure following the example in the wiki but vegastrike complains about lots of missing files when I try to load the mod. At the moment I'm using a complete data4.x tree for the mod but I think it would be a lot better in terms of maintainability to only supply those files in the mod directory that are actually different from the files in the vegastrike data4.x tree.
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

For a data folder layout, you need:
communications/ folder
vegastrike.config
setup.config
universe/ directory
weapons.xml
master_parts_list.csv
units.csv (in the units directory)
modules/ directory
bases/ directory
animations/
ai/
sprites/
bases/
meshes/
units/
directories.
Yes it's a lot of stuff...

I would not recommend making a mod from scratch, so start with VS stuff as a base, and swapping out textures and units and things as you go.

There was some preliminary support for a mods directory, but it was broken in that it *only* searched for files from that directory and nowhere else.
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

There was some preliminary support for a mods directory, but it was broken in that it *only* searched for files from that directory and nowhere else.
That's what I was trying to do, would have made things a little easier if the main vegastrike directory would get searched for the needed files if they aren't found in the mod's dir...
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

So I've looked into this a bit.

The way it actually works is that it searches for all subfolders in the "mods" directory of data4.x.
For all the folders there, it will include it in the list of directories to search.
Then, it will add the main data4.x directory at the end of the list.

However, do not use the "-m" option--it is indeed the "-m" which is broken and not the mods directory, or so it seems.

I don't know which files work with this searching system and which do not see there, but it should work at least.

But you should be able to do it only with the individual files that are different and not for all files... This includes python modules with "import".
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

I'm still having trouble with this. I created the following mod filesystem structure with my modified files:

Code: Select all

./ai/.keep
./animations/.keep
./bases/.keep
./communications/.keep
./factions.xml
./master_part_list.csv
./meshes/.keep
./mission/unit_test.mission
./modules/.keep
./setup.config
./sprites/.keep
./units/.keep
./units/alliance/fighter/xwing/xwing.bfxm
./units/alliance/fighter/xwing/xwing_diffuse.png
./units/alliance/fighter/xwing/xwing_glow.png
./units/alliance/fighter/xwing/xwing_shield.bfxm
./units/alliance/fighter/xwing/xwing_spec.png
./units/imperial/fighter/missile_boat/missile_boat.bfxm
./units/imperial/fighter/missile_boat/missile_boat_diffuse.png
./units/imperial/fighter/missile_boat/missile_boat_glow.png
./units/imperial/fighter/missile_boat/missile_boat_shield.bfxm
./units/imperial/fighter/missile_boat/missile_boat_spec.png
./units/imperial/fighter/tie_avenger/tie_avenger-hud.png
./units/imperial/fighter/tie_avenger/tie_avenger.bfxm
./units/imperial/fighter/tie_avenger/tie_avenger_diffuse.png
./units/imperial/fighter/tie_avenger/tie_avenger_glow.png
./units/imperial/fighter/tie_avenger/tie_avenger_shield.bfxm
./units/imperial/fighter/tie_bomber/tie_bomber.bfxm
./units/imperial/fighter/tie_bomber/tie_bomber_diffuse.png
./units/imperial/fighter/tie_bomber/tie_bomber_glow.png
./units/imperial/fighter/tie_bomber/tie_bomber_panel_diffuse.png
./units/imperial/fighter/tie_bomber/tie_bomber_panel_glow.png
./units/imperial/fighter/tie_bomber/tie_bomber_panel_spec.png
./units/imperial/fighter/tie_bomber/tie_bomber_spec.png
./units/imperial/fighter/tie_fighter/tie_fighter.bfxm
./units/imperial/fighter/tie_fighter/tie_fighter_diffuse_lod0.png
./units/imperial/fighter/tie_fighter/tie_fighter_diffuse_lod2.png
./units/imperial/fighter/tie_fighter/tie_fighter_glow_lod0.png
./units/imperial/fighter/tie_fighter/tie_fighter_glow_lod2.png
./units/imperial/fighter/tie_fighter/tie_fighter_panel_diffuse.png
./units/imperial/fighter/tie_fighter/tie_fighter_panel_glow.png
./units/imperial/fighter/tie_fighter/tie_fighter_panel_spec.png
./units/imperial/fighter/tie_fighter/tie_fighter_spec_lod0.png
./units/imperial/fighter/tie_fighter/tie_fighter_spec_lod2.png
./units/units.csv
./units/units_description.csv
./universe/.keep
./vegastrike.config
./weapon_list.xml
I put it into data4.x/mods/vegawars and started vegastrike from the data4.x directory. Vegastrike complained that it couldn't find the mission I had specified in ~/.vegastrike/vegastrike.config, so I copied mods/vegawars/mission/unit_test.mission to the mission directory. Then I started vegastrike again and was flying an invisble, unarmed starship that does 1 m/s instead of the TIE Bomber I expected. Vegastrike put out the following on the console:
http://www.hawo.stw.uni-erlangen.de/~si ... 070924.log
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I'm seeing a bunch of.
pox 5000102030.000000 5000013030.000000 500003030.000000
CREATING A LOCAL SHIP : TIEBomber.milspec
Unit file TIEBomber.milspec not found
pox 5000102033.000000 5000013033.000000 500003033.000000
CREATING A LOCAL SHIP : MissileBoat.milspec
Unit file MissileBoat.milspec not found
pox 5000102093.000000 5000013033.000000 500003033.000000
CREATING A LOCAL SHIP : TIEAvenger.milspec
Unit file TIEAvenger.milspec not found
pox 5000102153.000000 5000013033.000000 500003033.000000
It's very possible, considering that units.csv is only one very big file, that it is choosing one of them (in this case the data4.x version) and only using that.

Also, make sure your units have ".milspec" in their names like it is looking for. Could you also post your units.csv if you can't get it working?

I would keep trying things... like moving your units.csv into vegastrike's units directory so that it's possible to tell whether this is the real problem here.

I would be interested in precisely which things do and do not work from the mods directory. I'll look at the code later on to see why this might be happening.
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

Yes, I think it's using the wrong units.csv. I set up a second data4.x directory that has symlinks to all the modified files in the other data4.x's mods/vegastrike and that works nicely. I'll take a look at which files get preferred over which later today, have to learn for exams now ;-)
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

Ok, here are the results of my tests:
mods/vegawars/mission/... is ignored
mods/vegawars/units/... is ignored
if I make symlinks to the ignored files/directories from the main vegastrike data dir everything works nicely.
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

It's good to see that everything else works perfectly.

To be more specific, which types of files are ignored?
What I mean is if you put all your unit meshes and textures in your mods units folder, but place your units.csv in the parent folder, does that work?

Also, when you say "missions", is it a mission that is duplicated in both folders, or is it actually complaining with a "PANIC EXIT - mission file something.mission not found"

Anyway I'll look into the units.csv thing... I'm concerned about making a bug for the release, but I think it should be safe use only the units.csv in the first mod directory it finds rather than the one in data4.x. I could make it smarter but there are more important bugs to be fixed atm.
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

ace123 wrote:It's good to see that everything else works perfectly.

To be more specific, which types of files are ignored?
What I mean is if you put all your unit meshes and textures in your mods units folder, but place your units.csv in the parent folder, does that work?
no, doesn't work.
Also, when you say "missions", is it a mission that is duplicated in both folders, or is it actually complaining with a "PANIC EXIT - mission file something.mission not found"
That's precisely the error I get. The mission file exists only in one of the two folders.
Anyway I'll look into the units.csv thing... I'm concerned about making a bug for the release, but I think it should be safe use only the units.csv in the first mod directory it finds rather than the one in data4.x. I could make it smarter but there are more important bugs to be fixed atm.
The units.csv in the mod's directory doesn't get used. I haven't done enough testing yet but I assume that nothing in the mod's directory is being used if you don't specify -M and in that case vegastrike uses the files in the mod's directory exclusively.
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

The "-m" option is broken.

So as to specifying your own units.csv... you can in fact make your own and they will merge.
(Even if they merge, you don't have to reference any standard VS units... they don't do anything unless created by a python script or something)

The default name for a mod's units.csv file is "modunits.csv" to avoid the naming conflict problem.
But you can change it with this variable: ("data","UnitCSV","modunits.csv").
Which is the "UnitCSV" variable in the "data" section of the config.

Mission files should work... However it seems to only load a vegastrike.config from the main directory...
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

this should be fixed soon, cause it makes building mods compatible with latest svn-realease alot easier ...
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Moe, what exactly needs to be fixed?
The overall VSFileSystem code, as horrendous as it is, is definitely not going to be changed before release without having disasterous effects... However it should be possible with some struggling to add a few extra search paths to it.

But if there are some changes I could make that would make it much easier to add mod files without restructuring the code I will do it.

The problem is no one has tried to figure this out yet until now... This information will go into the wiki once we know how possible it is to structure the directory this way.
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

i dont know whats the problem to change the fileloading of the game that the modfolder gets working as it is supposed to be

python-style pseudocode example:

global modFolder

modName == getModName() #returns name of the mod or "" if -m: option wasnt used

if modName =! "" modFolder = join("mods/",modName)

def loadGameFile(file)
try:
loadfile(join(modFolder,file)) # loadfile is a more complex function that returns proper data by fileextension or whatever else suits well ...
except:
loadfile(file)

could be more sophisticated ... but that would load evry file from the modfolder and if not there form vs directory ... that woud be independent from the directorystructure the game is using and serve perfect for tc's

i know to merge files would be great feature but much more difficult and for more complex mods u rewrite/alter the most stuff in a single file anyway ...

maybe i have no idear but curretly copying the whole content of the vs directory into mods/mymod/ and using -m:mymod doesnt work ... but should if i understand the -m: option right ...
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I just fixed the remaining bugs (units.csv, vegastrike.config and -m option).

The way to make it work right is to make a single subfolder in "mods". As of my latest commit a minute ago you must now use the "-m" option.

Now there seems to be one exception... units.csv must be instead called "modunits.csv".
In addition, in your copy of vegastrike.config, you must look for a UnitCSV line and change it from "units.csv" to "units.csv modunits.csv" (i.e. space-separated list).

You might be able to get it to work without the parent folder's units.csv... in which case you can get by just calling it units.csv...

Overall you will probably have best results if you make sure not to call things by the same name (or at least it will be easier to debug)... Shouldn't be a problem for say the starwars mod.

But everything does in fact work... and I was able to make a clean directory with only "vegastrike.config" with the modification above and "weapon_list.xml"

In order to test the unit, I had to copy the "mission/explore_universe.mission" and "New_Game" and change their starting ships.
Finally, I made a new units.csv, called it modunits.csv and put the header lines (with "Key,...") and added my new unit... and I made that folder in "units".

Everything worked properly... The python scripts still worked... It still loaded all the AI units from Vega Strike... and I was able to fly my new unit.

Hopefully you can get everything working now!
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

okay from the beginning (dont know whats wrong):

copied an untouced vegastrike.config for testing to VS/mods/mymod/vegastrike.config

started the game with parameter "-m mymod"


game loads some textures and plays music than it crashes...

stout.txt
Windows version 5 1
Vega Strike
See http://www.gnu.org/copyleft/gpl.html for license details.

Using .vegastrike as the home directory
Found MODDIR = D:\VS/mods
DATADIR - No datadir specified in config file, using ; D:\VS
SIMULATION_ATOM: 0.05
['D:\\VS\\bin\\python25.zip', '.\\DLLs', '.\\lib', '.\\lib\\plat-win', '.\\lib\\lib-tk', 'D:\\VS\\bin']
['D:\\VS\\modules\\builtin', 'D:\\VS\\modules', 'D:\\VS\\bases']
Setting Screen to w 1024 h 768 and pitch of 4096 and 32 bpp 4 bytes per pix mode
0 joysticks were found.

The names of the joysticks are:
FactionXML:LoadXML factions.xml
Panic exit - mission file mymod not found
what freakin mission file is needed? does evry mod need a mission file even if it doesnt change anthing thiswise (just sound and texture replacements for example)?
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

I think you can't have a space after -m

so it would be the mod
spacebar (' ')
with mission file mymod
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

*slaps his own head*

:roll: thanks for fighting my stupidity ... "-Mmymod" ... it works!

but wouldnt be "-m:mymod" better style for a parameter with a parameter?
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

our command line parsing leaves...something to be desired (a hammer, for knocking some sense into our heads perhaps?)
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

i changed the image of a copy of splash_aera.ani in my modfolder but still the original one from vs/animations/splash_aera.ani/ gets loaded, why?

i also tryed to avoid a possible name-problem buy changing the name to splash_test.ani/splash_test.ani, splash_test.ani/splash_test.jpg and also the image path in the splash_test.ani/splash_test.ani file to splash_test.jpg.
result was a black sceeen while loading!
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

I would be interested in the first 20 lines of stdout.txt and stderr.txt

I would like to know all the types of files that work and all of them that do not, rather than fix these one at a time... (earlier you mentioned that units.csv didn't work... can you try making the new modunits.csv as specifed in your vegastrike.config?

If you specified the wrong directory in "-m" it simply won't use it... it won't warn you or anything. That's why I was interested in the stdout/stderr.

Also, you must have the two files, "vegastrike.config" and (possibly) "weapon_list.xml" in the mods directory.
Moe479
Merchant
Merchant
Posts: 57
Joined: Wed Jan 24, 2007 7:13 am

Post by Moe479 »

stdout:

Code: Select all

Windows version 5 1
Vega Strike  
See http://www.gnu.org/copyleft/gpl.html for license details.

Using .vegastrike as the home directory
Found MODDIR = D:\VS/mods
WARNING : coudn't find a mod named 'mymod' in homedir/mods
CONFIGFILE - Found a config file in mods directory, using : D:\VS/mods/mymod/vegastrike.config
Using Mod Directory D:\VS/mods
DATADIR - No datadir specified in config file, using ; D:\VS
SIMULATION_ATOM: 0.05
['D:\\VS\\bin\\python25.zip', '.\\DLLs', '.\\lib', '.\\lib\\plat-win', '.\\lib\\lib-tk', 'D:\\VS\\bin']
['D:\\VS\\modules\\builtin', 'D:\\VS\\modules', 'D:\\VS\\bases']
Setting Screen to w 1024 h 768 and pitch of 4096 and 32 bpp 4 bytes per pix mode
0 joysticks were found.
.
.
.
!!! a warning that i cant understand cause vesgastrike.config is loaded from mymod after that!


files:
mymod/weapon_list.xml (copy of weapon_list.xml)
mymod/units/modunits.csv (copy of units.csv)
mymod/vegastrike.config (changed lines only):

Code: Select all

<var name="UnitCSV" value="units.csv modunits.csv"/>
.
.
.
<var name="splash_screen" value="splash_test.ani"/>
mymod/animations/splash_test.ani/splash_test.jpg (copy of splash_aera.jpg)
mymod/animations/splash_test.ani/splash_test.ani:

Code: Select all

.3 .3
1 1000
splash_test.jpg
it seems my one and only 'new' splash didnt get loaded (black screen while loading)
legine
Bounty Hunter
Bounty Hunter
Posts: 139
Joined: Mon Sep 27, 2004 8:40 am
Location: Germany
Contact:

Post by legine »

While trying to integrate piarmada into vs. I started to move to the mods environment. And stumbled into a very disturbing issue.

I set up the mods folder and copied the vegastrike.config and weapon.xml files to the mod folder. (the folders are empty since i don't have any replacement atm.)

When starting normally. VS detects the mod and runs normally.
If I use the -m option, vs crashes with an error not finding communications.cpp and my mouse is crashing with it. I need to restart X in order to fix the issue.
hellcatv
Developer
Developer
Posts: 3980
Joined: Fri Jan 03, 2003 4:53 am
Location: Stanford, CA
Contact:

Post by hellcatv »

first of all... you shouldn't be running in fullscreen for development purposes...
that bug you note is an SDL-bug sort of issue where an early crash in fullscreen leaves the mouse defunct until you run another noncrashy 3d app

secondly ace123 mentioned earlier that you need to have at least 3 files in your mod:
vegastrike.config
weapon_list.xml
and communications/ folder full of the faction speech to each other
Vega Strike Lead Developer
http://vegastrike.sourceforge.net/
legine
Bounty Hunter
Bounty Hunter
Posts: 139
Joined: Mon Sep 27, 2004 8:40 am
Location: Germany
Contact:

Post by legine »

Ohh I just have the communication folder.

ty for the tipps :D

[edit:]
I updated the wikki with your info. If it is okay, I add more info as I move along.
Post Reply