Twilight filesystem layout idea

Forest 'LordHavoc' Hale havoc at telefragged.com
Tue Feb 25 20:24:32 EST 2003


Knghtbrd insists on a unified filesystem behavior across platforms, and 
I can't see that as a reasonable possibility by any means, this is my 
current proposal, which does not accomplish that feat but combines the 
proposals I have seen so far...  It comes in two parts, the upper 
majority of this email is the data path, then the profiles path, there 
is also a note about menus at the end.

P.S. I do see how it could be done almost identically across platforms 
using profiles, see notes at end.

To be clear, the data path is where the id1, ctf, fortress, etc 
directories reside, the profiles directory has one directory per user 
profile (on UNIX each user might have multiple profiles), and each of 
those directories contains mod directories (containing configs, 
screenshots, logs, demos, etc).

Note that I still do not like the idea of detecting the executable path, 
but I'll run with the idea anyway, since knghtbrd will insist on it.

Possible configurations for data directory (tried in sequence at startup):
A:
fs_path_data "data/"
B:
fs_path_data ""
E: (UNIX)
fs_path_data "~/.twilight/data/" (note this is typically a link)
F:
fs_path_data "EXECUTABLEPATH/data/"
G:
fs_path_data "EXECUTABLEPATH/"
H:
fs_path_data <read from EXECUTABLEPATH/datadir.txt>
E: (UNIX)
fs_path_data "/opt/twilight/data"
F: (UNIX)
fs_path_data "/usr/share/games/quake"
G: (UNIX)
fs_path_data "/usr/share/games/twilight"

If that failed...
A: (UNIX)
puts up an SDL based messagebox asking where the data is and adjusts the 
~/.twilight/data link to match, then starts the game.
B: (UNIX)
console prompt asking where the data is and adjusts the ~/.twilight/data 
link to match, then starts the game.
C:
same as fallback A except uses EXECUTABLEPATH/datadir.txt file or 
something along those lines instead of ~/.twilight/data. (yes this may 
fail to write the file - it will try to write an empty file there before 
putting up prompt to be sure this works)
D:
puts up an SDL or native messagebox, which reports that no data was 
found, and all the places it tried.

Possible configurations for finding a profiles directory (tried in 
sequence at startup):
A:
fs_path_profiles "profiles/"
B: (UNIX)
fs_path_profiles "~/.twilight/profiles/"
C:
fs_path_profiles "EXECUTABLEPATH/profiles/"

If that failed...
Possible configurations for creating a profiles directory (tried in 
sequence):
A: (UNIX)
fs_path_profiles "~/.twilight/profiles/"
B:
fs_path_profiles "EXECUTABLEPATH/profiles/"
C:
fs_path_profiles "profiles/"
D:
error out with a messagebox and/or console message about being unable to 
find or create a profiles directory

Now as for the nature of ~/.twilight/data (which of course is only on 
UNIX), if a user installed by using the installer, this is a data 
directory or a link to data, it may additionally be altered by the data 
path failure mechanisms (if it asks for the location).

I would also like to strongly suggest that we need to make twilight 
completely capable of running without a data directory of any kind and 
able to switch data directories at any time.  This would give us great 
flexibility in handling of failure conditions and be a good idea 
all-round.  (As a bonus this means NQ could switch mods, we'd want to 
add a mod browser to the menu)

This does of course depend on embedding dpmviewer/lhfont.tga into the 
twilight executables (it's only 7311 bytes as BGRA RLE targa, could be 
made much smaller if needed), and redoing the menu system (come on, it 
needs a rewrite, even if we end up completely changing the look in the 
process).

P.S. the existence of ~/.twilight worries me, because it is an 
unnecessary association with the engine name - you might have multiple 
games installed, each with their own data paths, all using twilight. 
One possible solution would be storing a datadir.txt or whatever per 
profile, and allow it to be edited by the game, this allows multiple 
entire games to be lumped together in the profiles directory, start 
twilight and choose a profile, which also chooses a game.  Comments?

P.S. This could eliminate the whole data search path for most purposes, 
we'd only need to locate the profiles directory (easy!), and let the 
user configure data paths ingame.

-- 
LordHavoc
Author of DarkPlaces Quake1 engine and mod
http://icculus.org/twilight/darkplaces/
"War does not prove who is right, it proves who is left." - Unknown




More information about the twilight-devel mailing list