PDA

View Full Version : How the FO2 engine finds it's data.



red
06-13-2004, 04:16 AM
I've spent the better part of my free time for the last 3 days investigating how the game finds/loads it's data. This was at first for speed considerations (see the thread about slow fallout), but there's a heck of a lot of useful information for the modders which I've found and would like to share.

First, the "root data" concept: The engine accepts DATs as sources of data as we all know, and also accepts the main directory as most modders know, not precisly how though. I've noticed in various threads that some have even found this out on their own, but I don't know to what extent. The important thing to know is that the engine supports information to be either from a DAT file or from a directory. The engine doesn't care if it's a DAT or a directory, it supports both.

Now the reason I'm talking about "root data" is because the engine uses specific root directories (or DATs...) to find it's data. Here's the order: patchXXX.dat critter_patch critter_dat master_patch master_dat Current directory If it fails to find the data it will try to continue without it as gracefully as it can.Notice how I used _dat instead of .dat. That's to emphasise once more that it can be a directory too. These are in fact the values used in the Fallout2.cfg file as opposed to the "root data" file they point to. It's to be noted that if the file/directory doesn't exist, the engine will create it. Lastly, if two "root data" paths match, the engine won't try to look for the file in the same directory twice.

Special notes:
- patchXXX.dat: is identified as such because the engine is actually looking (in the current directory, not the Fallout directory) for patch000.dat through patch998.dat in 2's incriments. If it finds a file or directory of that name it will use it, otherwise the engine will ingore it entirely (ie: it won't try to create a patch000.dat directory and thus the engine won't try to find data in the empty directory)
- critter_patch: under normal circumstances, this points to "data" if you didn't toy with your CFG since the installation. This is why current mods work given you supply the files manually.
- critter_dat: Under normal circumstances, points to critter.dat (can be on the CD depending on the installation selection).
- master_patch: This is very important for modders. Under normal circumstances, this points to data (as critters_patch). Now this isn't such a big deal, however the game deletes all of master_patch\proto\items\*.pro and master_patch\proto\critters\*.pro. Since it normally points to "data" and this is where most modders will want to put their PRO files so they get loaded by the engine (by the critter_patch reference), this can be a problem. The most commonly used solution is simply to put the files read-only (select all files, right click, properties, select "read only", click OK and wait). An elegant solution was suggested by Haenlomal on this very forum is to put your files in the patch000.dat directory, and finally mine would be to point master_patch somwhere with no PRO files, ideally an empty, easy to figure out directory. [Extra note: the game actually builds the list of files to delete from all "roots", not just the master_patch directory, so you can't fool the game into not deleting files by pointing one of the roots to an empty directory - it even tries to delete master.dat/proto/items/XXXXXXXX.PRO (which thankfully fails) if all "roots" are DATs!]
- master_dat: Nothing much to say about this one see critter_dat.
- Current directory: First, this isn't the Fallout2 directory, but the directory in which you run the game. Under normal circustances they are the same. For those who don't quite understand, click on the Fallout2 icon, right click and "create a chorcut". Then right click on the freshly created shortcut and select "Properties", you should be on the "Shortcut" tab and see a textbox preceeded by "Start in". This is the "current directory". It's to be noted that unlike the other "roots" this one obviously can't be a DAT file, as such the engine doesn't "match" this one to other "roots". This means that even if you make ALL your "roots" point to the current directory, the game sill still looks for the file twice!

Final Words:
- For "fast" fallout: Extract everything in the Fallout base directory (as opposed to in "data"!) This way when a file is missing it'll check for the same file (which should be faster then checking another file as it'll be cached for sure). Edit Fallout2.cfg and put the full path to your fallout base directory. Then finally, remember to make your proto/items/*.pro and proto/critters/*.pro read only! With that in place the load screen now takes under 1/2 second on my p3-600, 640MB RAM (on second run - keep in mind that on the first run it can create files (wolrdmap.dat) and the cache isn't setup. The main gain of speed though was the decompression, not the "root" modifications, albeit every bit helps.).
- For modders: I'd suggest using critter_patch as your modding "base", and extract EVERYTHING into the base directory of fallout. Point master_patch to somewhere invalid as you'll most probably need those PRO files unless working on a TC or somesuch. Point everything else left to your fallout base. Rename patch000.dat to something else to keep as reference when rebuilding your mod for ditribution. This way you can name your mod dir something meaningful too! Extra note, for modders who might be thinking of avoiding the whole "replace patch000.dat" ordeal: Sadly the CFG file the game uses IS the same as the one found in the same directory as the fallout2.exe file and not the one in the current directory. This means you can't make a directory with just a link to Fallout using your own CFG file, you'll also need the executable (which makes the link pointless in the first place).

Extra notes for modders:
- mapper2 pretty much works the same way, however it does not look for patchXXX.dat!
- It saves it's data into master_patch.
To make best use of this whole ordeal, first make sure to extract everything (to make sure the patches are loaded); then point mapper2.cfg's critter_dat to the original Fallout data, point critter_patch to your mod dir and also point master_patch to your mod dir. This way it loads everything you didn't touch from the original data, without overwriting them - and writes in your mod dir; if you edited them then it will load them from your mod dir since critter_patch is loaded before critter_dat! Ain't this spiffy?

Don't hesitate to ask questions if anything's not clear.
Sure hope this helps out!

Odin
06-13-2004, 05:58 AM
Wow, good job Red!! And it's nice to have you back again!

red
06-14-2004, 10:29 PM
I just found out (say you're working on a translation - though clever people could find other good uses for this) that changing the "language" setting in the Fallout2.cfg actually looks for whatever you put in there in the text folder. Rename "english" to test, change the CFG to the same and the game will load appropriatly. I though this was limited to "supported" binary options, but it's not. This is also quite interesting for people working on multi-lingual mods (I'm mostly thinking of them russian and polish people here as they seem to be the only ones doing such things): you could make a single release with both languages providing two cfgs and isntalling the correct one (or if you're less lazy, make a program that generates it). Although you're still stuck with a single set of movies (and if so, sounds) - at least the subtitles can be translated. It's pretty sad since they could have done the same with sound/speech...

Otherwise, less interesting is the music_path1 and music_path2 properties. Basically the game looks in those folders (1 first as expected) for the music. Note that unlike the dats, it doesn't look in the current directories and additionally it still looks for both even if the directories are the same. Also you can't make them point to a DAT file.

Special note about "ordering" of files in DATs: these are only guesses! -- When the game loads a DAT file structure into memory, it checks for the first letters matching (say proto\critters\00000001.pro) in a non-case sensitive fashion (obviously). So it looks at the first file (which should be art\background\Adobe.frm). It just looks at "a" which doesn't match and continues until it finds "p". then looks for "r".
Now given you put a file in a wrong order, (say add proto\critters\00000002.pro at the end of the file), it'll reach proto\critters\00000001.pro, then see proto\critters\00000003. Seeing as 2 is under 3 it'll assume the files is missing instead of looking though the rest. A very slight optimization I guess though using a hash table would have probably been much better but hey.

Haenlomal
06-15-2004, 05:17 PM
Good job, Red. I recall arriving at similar conclusions myself, but I haven't touched Fallout for a while now.

A quick question: Have you figured out why the game engine writes to the Patch000.dat directory unless you do a system deny write? When I fiddled with it, and when I save a game, it seems that the engine attempts to write the saved game files to Patch000.dat directory instead of the proper location. This of course quickly corrupts your game -- not good!

On the other hand, if you set "Deny Write" on your Patch000.dat directory, the write attempt fails, and then the engine seems to smarten up and write the saved game files to the proper location. If it weren't for that, my solution would properly be the most elegant (setting "Deny Write" makes swapping mods in and out a royal pain in the behind).

No biggies here. As I said, I'm not that much into the Fallout scene anymore, but hopefully what I just wrote might point you in new directions for further exploration.

Cheers,

-- The Haen.

APTYP
06-15-2004, 05:49 PM
"Scene", heh. That's so european.

red
07-03-2004, 09:43 PM
I'll look into the creation of files later on. The current tests were done quickly (ie: load the game and quit). You have to actually load/start a game for the engine to write files, which I didn't do.

I've noted your mention about the patch???.dat directory (which I would have probably overlooked since I prefer using the trick mentioned for the mapper to work) - Obviously oif the game finds no patch it doesn't try to write to it. Given it finds it, it might try to delete patch000.dat/proto/items et al, didn't check that.

red
07-07-2004, 07:23 AM
OK, I've looked into a few things:

First, for savegames to work, you need both critter_patches and master_patches to point to the same directory! Second, if the game finds *.SAV files in any root/MAPS folder than the master_patch directory, the game will complain it can't save; so make sure to delete all *.SAV files not in the SAVEGAME directory - though in theory this shouldn't happen unless you mess with Fallout2...

Whenever you leave a map (this means chaging maps, saving a game or going onto the worldmap), first it tried to create <master_patches>\MAPS, <master_patches>\proto\items and <master_patches>\proto\critters (I haven't tried to make this part fail to see if it might try to create other directories failing that); then game writes all the critter PIDs listed in data/party.txt (calculate proto ID using the number - 16777216) into the first valid proto/critters, also writes proto/items/00000455.pro (I don't know how it knows to save it, but it's the trunk) in the first proto/items it finds in the root list and finally saves the map as it's normal name put postfixed with SAV in the first MAPS folder it finds. [There are a few other files updated too but they don't merit much comments.]

So this is why pretty much any used proto directory can get overwritten by wrong PRO files. The only two workarounds are providing an extra directory (say you use critter_patches as your testbed, then use patch00.dat/proto/items etc), or make them readonly. Since the mapper doesn't use the patch, there is no nice workaround for it allowing you to edit the PRO files too.

When saving the game (after this previous step was done), it's pretty much repeated in the proper <master_patches>/SAVEGAME/SLOTXX number.

When going onto onether map, the game finds the proto's it just wrote and uses those instead of those from the of the game (this might actually be the reason why both dirs need to match, though this could be overruled by patch.dat when the dat is a file rather than a directory... oversight? Or perhaps they didn't care because none of the protos in the patch are "at risk"... Any NPC changed in the patch.dat can't level as he'll get reverted to his original state once you change maps (or reload the game).)

Perceptron
07-12-2004, 09:04 PM
Hi, red!
I've translated your opus on Russian, and I have some questions.

1. From which "roots" the game tries to delete PRO files? From master_patches and critter_patches only or from critter_dat, master_dat, patchXXX.dat, current directory too?
Does the game delete only critters and items PRO files?

2. You wrote: "...it checks for the first letters matching...in a non-case sensitive fashion...".
And what about second letters matching? Are they matching in a non-case sensitive fashion too?

3. In your example ("say add proto\critters\00000002.pro at the end of the file"): what files the game assume is missing? All except the 00000001.pro or 00000002.pro only?
What does it mean "...but hey."? Give me a synonym, please. I didn't understand this.

4. So, as I understand, I can't use patch000.dat directory because of:
a) game tries to write the saved game files to it
b) "game might try to delete patch000.dat/proto/items et al, didn't check that."
BTW, "I (red) didn't check that" or "game didn't check that"? Sorry for my stupidity.

5. You also wrote: "The only two workarounds are providing an extra directory..."
What kind of "extra directory": critter_patches and master_patches directory, "backup" directory or anything else? Explain in detail, please.

6. "When going onto onether map..." - "onether" - what is it?

red
07-12-2004, 10:41 PM
1. From which "roots" the game tries to delete PRO files? From master_patches and critter_patches only or from critter_dat, master_dat, patchXXX.dat, current directory too?
Does the game delete only critters and items PRO files?It lists the files in ALL directories and the tries to delete the resulting bunch of files in master_patches.
2. You wrote: "...it checks for the first letters matching...in a non-case sensitive fashion...".
And what about second letters matching? Are they matching in a non-case sensitive fashion too?Yes, everything is non-case sensitve, as FAT and NTFS.
3. In your example ("say add proto\critters\00000002.pro at the end of the file"): what files the game assume is missing? All except the 00000001.pro or 00000002.pro only?basically, if a file is at the "end" of the file list instead of being alphanumerically ordered, it will miss it because the engine thinks it should be alphanumerically ordered. I think that can pretty much sum it up.
What does it mean "...but hey."? Give me a synonym, please. I didn't understand this.Um, it's just an expression meaning (in context) that it's better than no optimization but with some conotation of deception. In this case the deception of this optimization is that we have to recompile the entire DAT file if the added file isn't at the end of the list...
4. So, as I understand, I can't use patch000.dat directory because of:
a) game tries to write the saved game files to itYes. It checks the "available roots" and the first the works, it writes the save data in it.
b) "game might try to delete patch000.dat/proto/items et al, didn't check that."
BTW, "I (red) didn't check that" or "game didn't check that"? Sorry for my stupidity.Actually I did check that and the only reason it'll try to delete patch00.dat/proto is because you pointed to it with master_patches.
5. You also wrote: "The only two workarounds are providing an extra directory..."
What kind of "extra directory": critter_patches and master_patches directory, "backup" directory or anything else? Explain in detail, please.Providing the game with patch000.dat directory will make the game write the save data into the patch00.dat directory. To acheive this you'll need to create the patch000.dat/proto/items and patch000.dat/proto/critters. For my setup it's the only way since we want to write our stuff in master_patches, read it from critter_patches (for mods); and from critter_dat for the original data. If we don't supply patch000.dat then the first match will be the "mod" directory which will possibly overwrite your own mod stuff. There might be another way to acheive this though.
6. "When going onto onether map..." - "onether" - what is it?When you leave the map and enter another. Typo, sorry.

Haenlomal
07-13-2004, 08:20 PM
If this is the case, then for actual playing purposes, the best solution still seems to be to go with a Patch000.dat directory. All you have to do is to make sure that nothing can be written to it. This is done differently depending on which O/S you're using.

For Win98, all you have to do is to make all the directories and subdirectories read only. I'm not sure about the security structure in WinME, but I think it's similar.

For WinNT, Win2000, and WinXP, the situation is a bit more complex, thanks to the more advanced security features of those O/S. It's no longer sufficient just to set the folders to Read Only. You also need to toggle the Deny Write flags. In order to do this:

(Note: in the following instructions, I'm assuming you're using WinXP Pro. The exact names and labels you encounter on other systems may be slightly different.)

1) Log in as someone with Administrator priviledges

2) Right-click on the Patch000.dat folder and select Properties

3) Look for the Security tab and select it. (If it's not there, you need to disable Simple File sharing. Read below to see how to do this.)

4) Under "Group or users names:" select SYSTEM.

5) Check the "Deny Write" checkbox under "Permissions for SYSTEM".

6) If the userID you're using is also listed under the Group or user names listbox, you should check off Deny Write for it just to be safe.

7) Click OK to save your changes.

This way .SAV files won't get written to the patch directory, allowing you to have properly saved game.

To disable simple file sharing

1) Open any folder

2) From the menu at the top select Tools->Folder Options

3) Select the View Tab

4) Scroll down the Advanced Settings list to find the "Use simple file sharing (recommended)" option, and remove the checkmark in the checkbox

5) click OK to save your changes

Good luck!

-- The Haen.

Perceptron
07-14-2004, 12:27 AM
1. Again:

It lists the files in ALL directories and the tries to delete the resulting bunch of files in master_patches.
So, game lists the files in:
1. Patch000.dat\proto\items and Patch000.dat\proto\critters directories
2. critter_patch\proto\items and critter_patch\proto\critters
3. critter_dat\proto\items and critter_dat\proto\critters
4. master_patch\proto\items and master_patch\proto\critters
5. master_dat\proto\items and master_dat\proto\critters
6. Current_directory\proto\items and Current_directory\proto\critters
OR in ALL above-listed ROOT directories and ALL it's SUBDIRECTORIES?

2.
I think that can pretty much sum it up.
Do you want to repair this (make a patch)?

3.
Yes. It checks the "available roots" and the first the works, it writes the save data in it.
...And if I want to forbid the game to write save data in patch000.dat directory, I must set up the "Read Only" flag on the directory?

4. About an "extra directory":
This way, if we will create the patch000.dat/proto/items and patch000.dat/proto/critters, the game find our stuff in master_patches (first), then write it to patch000.dat, and in next iteration it will read our protos already from the patch000.dat, without overwrite it, isnít it?

More questions:

So, after all, for fast fallout, should I:

1. Decompress all data from master.dat, critter.dat, patch000.dat into fallout base directory.
2. In the Fallout2.cfg:
critter_patch=X:\PathToFalloutBaseDirectory\
critter_dat=X:\PathToFalloutBaseDirectory\
master_patch=X:\PathToFalloutBaseDirectory\
master_dat=X:\PathToFalloutBaseDirectory\
where X - logical or physical drive, on which fallout is installed.
3. Make my X:\PathToFalloutBaseDirectory\proto\items\*.pro and X:\PathToFalloutBaseDirectory\proto\critters\*.pro read only?

Correct me, if I have made any mistakes.

And game will look for the file in the following order:
1. critter_patch
2. critter_dat
3. master_patch
4. master_dat
5. Current directory (X:\PathToFalloutBaseDirectory)

And if the file is missing, I get the gain of speed (while game looking for it) because of:
1. game will check the directory (X:\PathToFalloutBaseDirectory) only twice - first as path to data and pathces (here game will see that the file is missing), second as current directory
2. due to caching in second case (as current directory) because of directory is the same?
Am I right?

And for modding, I must follow this way:

1. Decompress all data from master.dat, critter.dat, patch000.dat (in this order) into fallout base directory.
2. In the Fallout2.cfg:
critter_patch=X:\PathToModBaseDirectory\
critter_dat=X:\PathToFalloutBaseDirectory\
master_patch=X:\PathToModBaseDirectory\
master_dat=X:\PathToFalloutBaseDirectory\
where X - logical or physical drive, on which fallout is installed.
3. Either make a patch000.dat\proto\items and patch000.dat\proto\critters directories and donít save the game, chaging maps or going onto the worldmap while testingÖ
or make my X:\PathToFalloutBaseDirectory\proto\items\*.pro, X:\PathToModBaseDirectory\proto\items\*.pro, X:\PathToFalloutBaseDirectory\proto\critters\*.pro and X:\PathToModBaseDirectory\proto\critters\*.pro read only anytime I start the game?

red
07-14-2004, 12:28 AM
If this is the case, then for actual playing purposes, the best solution still seems to be to go with a Patch000.dat directory. All you have to do is to make sure that nothing can be written to it.That works but it's not the best solution: given you have a single directory with all the files it matters not where it is - so you might as well name it something else than patchxxx.dat and make the files read-only. (say in critter_dat). In fact it will end up being faster since when the engine fails to find a file (which does happen quite a bit), it'll STILL looks in all the other folders (listed in the first post); given file chaching for best performance you'll want to point all the folders to the "running path" (though technically you can all those to patch000.dat).

Given you plan on using BIS's mapper though I recommend another entirely different setup: You want the mapper to be able to save maps and protos You want both fallout and the mapper to be able to load/save games and use the modified data when available You want to be able to have the game load your edited data WITHOUT overwriting the original Fallout data. You want it as fast as possible respecting the previous stepsSo, you'll need to do this: Decompress master.dat into a folder (henceforth called <src>) Decompress critter.dat in <src> Decompress patch000.dat in <src> Create a folder for mod (NOT the same directory as where you extracte the DAT, copy: Fallout2.exe, Mapper2.exe, Fallout2.cfg, Mapper2.cfg (folder henceforth called <mod>) Create <drive>:\fallout2\dev\proto, in it create critters, items, mist, scenery, tiles, walls, where drive is the same as the one you'll be running the mapper from. (This allows proto editing in the mapper) Edit fallout2.cfg and change critter_dat, master_dat and point to <src>, change critter_patches and master_patches to point to <mod>; this allows for fastest loading times whilst still using the mod files (and still allows the game to work properly). For the music, update music_path1 to point to <mod>\sound\music and music_path2 to point to where ever the sound is (normally with the installation with the cd this points to the CD... I suggest simply copying the files on the HD though, in <src>\sound\music) Edit mapper2.cfg in the exact same way as the fallout2.cfg. This will allow the mod to access all the files from the original games, yet anything we "Edit" from the original and save through the mapper will end up in the <mod> directory. When you edit your FRMs, you should put them in the <mod> directory tree (this way we can easyly keep track of which files are modified too). Create patch000.dat in the <mod> directory to allow the game to put it's save data there instead of in critter_patches (thus avoiding getting the items/critters getting overwritten)
For WinNT, Win2000, and WinXP, the situation is a bit more complexIt's not. You can set the read-only flag on NTFS too and it works just fine.

red
07-14-2004, 12:51 AM
So, game lists the files in:
1. Patch000.dat\proto\items and Patch000.dat\proto\critters directories
2. critter_patch\proto\items and critter_patch\proto\critters
3. critter_dat\proto\items and critter_dat\proto\critters
4. master_patch\proto\items and master_patch\proto\critters
5. master_dat\proto\items and master_dat\proto\critters
6. Current_directory\proto\items and Current_directory\proto\critters
OR in ALL above-listed ROOT directories and ALL it's SUBDIRECTORIES?To be more precise, all the above listed directories are correct, and it lists *.pro rather then all files.
Do you want to repair this (make a patch)?I don't care - though if you decide to make one you could confirm my theory as I never traced the code. With the computers nowadays re-compiling a new DAT file is pretty fast anyway and you only really need to do this once: when you're ready to realease your patch...
...And if I want to forbid the game to write save data in patch000.dat directory, I must set up the "Read Only" flag on the directory?If you have a patch000.dat directory, it's the only way.
This way, if we will create the patch000.dat/proto/items and patch000.dat/proto/critters, the game find our stuff in master_patches (first), then write it to patch000.dat, and in next iteration it will read our protos already from the patch000.dat, without overwrite it, isnít it?No, the game will first find stuff in patch000.dat if it exists. If it doesn't exists, it looks in the next "root" (as mentioned in first psot). When leaving the map, the game will save where first possible and the load it again (from first possible. This actually means that making the files read-only makes the NPCs revert to the original ones - I'll test this soon.
2. In the Fallout2.cfg:
critter_patch=X:\PathToFalloutBaseDirectory\
critter_dat=X:\PathToFalloutBaseDirectory\
master_patch=X:\PathToFalloutBaseDirectory\
master_dat=X:\PathToFalloutBaseDirectory\
where X - logical or physical drive, on which fallout is installed.I suggest just using "." isntead of specifying the full path this way you can move the whole fallout directory anywhere on your computer/network :)
3. Make my X:\PathToFalloutBaseDirectory\proto\items\*.pro and X:\PathToFalloutBaseDirectory\proto\critters\*.pro read only?Hmm. Well, in light of two comments up; no. I'll test this tonight.
And game will look for the file in the following order:
1. critter_patch
2. critter_dat
3. master_patch
4. master_dat
5. Current directory (X:\PathToFalloutBaseDirectory)patchXXX.dat first! and remember that the current directory isn't necessarely where Fallout2.exe is located... It's actually the "running directory".
And if the file is missing, I get the gain of speed (while game looking for it) because of:
1. game will check the directory (X:\PathToFalloutBaseDirectory) only twice - first as path to data and pathces (here game will see that the file is missing), second as current directory
2. due to caching in second case (as current directory) because of directory is the same?
Am I right?Almost. The first reason as that the game is "smart" and if two "root" directories point to the same directory it will only use one "root".
And for modding, I must follow this waySee previous post.

Extra note:
It might be possible that making a new DAT file without any compression enabled might be faster than finding the files - and while at it, it'd be better to merge the three DAT files into one too - this would also solve the preoblem with overwriting PROs et al.

Extra extra note; about pro "saving":
The game actually tries to create master_patches\proto\items (and critters) if it doesn't exist when "Saving" it's proto to disk (if it didn't it would never be able to work since by default the game only uses the DAT files).

Perceptron
07-14-2004, 10:37 PM
Thank you for answers, red (Red!, I mean). And sorry for my awful English. :-)

Given you plan on using BIS's mapper though I recommend another entirely different setupÖ
Give me resembling solution for the ďfast falloutĒ, if you please.

So, follow your solution, fallout will save itís protos and saved games into patch000.dat in the <mod> directory, and my items/critters protos will never be overwritten by the game, am I state correct?

EnderWiggin
07-20-2004, 05:44 AM
Forgive me, but I'm dyslexic, and this thread makes my brain hurt. I haven't extracted any Fallout .dat files yet, or played with the Mapper or tools yet.

However, I'd like to set them all up properly on the first go. Can you give me instructions on what dat files I want to extract, where to extract them, and how to edit the fallout.cfg and mapper.cfg files to get this right the first time?

And wouldn't I just repack my mod into the .dat files and distribute a modified dat file if that's what the game wants to read?

red
07-20-2004, 02:44 PM
So, follow your solution, fallout will save itís protos and saved games into patch000.dat in the <mod> directory, and my items/critters protos will never be overwritten by the game, am I state correct?With the solution posted, the games will save it's temporary pro data into patch000.dat, and the savegames themselves will end up in the <mod> directory, without overwriting either the <mod> nor the <src> decompressed data.

When loading data, it will first look for it in the <mod> dir and than in the <src> dir. Everything will get saved into the <mod> dir thus not overwriting the original DAT data.

I'll try and devise the best "fast fallout" instructions during the week - though the more I think about it, the more I beleive the game would run faster if we'd decompress the DATs then remerge them without compression (if any of the DAT managers allows that) into a common DAT which you would name patch000.dat and finally point all the fallout2.cfg directories to "." - this way we avoid any uneccesary request to the system about file existance and the directories matches the current folder allowing for cache hits on missing files.

Perceptron
07-28-2004, 08:53 PM
Hello, Red.

I had tested your solution.
I had installed mapper and fallout, then created a new protofile in the mapper and changed artemple.map.
After that I was found following new files:
<mod>\proto\critters\00000484.pro
<mod>\proto\critters\critters.lst
<mod>\maps\artemple.map
<mod>\maps\artemple.cfg
<mod>\patch000.dat\worldmap.dat
<drive>\Fallout2\dev\proto\target.dat
<drive>\Fallout2\dev\proto\critters\00000484.txt
Then I was run fallout and found out that:
1) it has deleted <mod>\proto\critters\00000484.pro
2) it (or mapper) has created <mod>\sound\music\17arroyo.acm

So, trick with patch000.dat in the <mod> directory hasn't work.

red
07-30-2004, 04:27 PM
The thing is that the patch000.dat directory trick is needed so that the game saves it's temp save data (or current data if you want to call it that way).

Keep in mind that Fallout2.exe deletes the pros from master_patches. So to use the mapper and game properly, you'll need to make sure that the Fallout2.cfg master_patches points elsewhere so they don't get deleted.

Although I've found that if critter_patches and master_patches don't match, Fallout2 won't save; which means you'll have to point critter_dat to <mod> and master_dat to <src> and both _patches to "." (current dir). Keep patch000.dat so the game doesn't overwrite any PROs from NPCs

So indeed you're right, the solution posted is not correct - not even for "fast fallout.

APTYP
07-30-2004, 04:38 PM
Has anyone actually profiled the performance difference for red's solution?

Perceptron
07-31-2004, 06:04 PM
Addition to the Red’s solution (of Wed Jul 14, 2004 3:28 ):

1. If you want fallout to save it’s temporary data into the patch000.dat directory, you also must create patch000.dat\proto\critters\, patch000.dat\proto\items\, patch000.dat\maps\ directories, because the game doesn’t try to create this directories.

2. But the game unfortunately doesn’t try to delete it’s temporary files from above listed directories. So, in the next time you’ll load the game, it will read this files instead of <src> files or your <mod> files, that can cause any mistakes.

3. So, don’t create patch000.dat\maps\ directory, and the game will save it’s temporary data into <mod>\maps\ and delete it when you exit the game.

4. You must delete temporary patch000.dat\proto\critters\*.pro and patch000.dat\proto\items\ any time you quit the game. And always make your items and critters protos read only!

5. Or you can copy all the critter PIDs listed in data\party.txt from the <src>\ proto\critters\ to the patch000.dat\proto\critters\ and the 00000455.pro from the <src>\ proto\items\ to the patch000.dat\proto\items\ and makes them read only.
If you will change above-listed protos, you must remember that you must save them into the patch000.dat\proto\critters\ or patch000.dat\proto\items\!
Also you must move your items and critters protos into the patch000.dat\proto\ and make them read only any time you have created them (before loading the game and going to another map)!
Since this time directory for your modified items and critters protos will be the patch000.dat\proto\ (with proper subdirectory). And the directories for the game temporary protos will be <mod>\proto\critters\ and <mod>\proto\items\ directories. Don’t forget this!

6. Also the game save the music files into the <mod>\sound\music\ directory. If you want to create new music, you must put the files into patch000.dat\sound\music directory (or give them another names – not the same you have found in the game). You don’t have to make them read only – the game doesn’t try to save the music in patch000.dat\sound\music\ directory (as far as I know).

Maybe Red will correct me, if I have made any errors?

red
08-15-2004, 05:02 AM
OK, I did some more test and research though some stuff might still elude me.

For the most part, the game writing to patch000.dat and loading from it doesn't matter since the PRO files in the savegames themselves always have priority over any other ones.

There is however an exception: when you create a new game, obviously it will read the patch000.dat ones first and as such you might get a prematurely upgraded NPC if you forget to delete the directory first.

The maps folder hardly matters since the game saves the maps with the savegame extentions and as such will never overwrite any valuable files. The game will try to create <master_patches>\maps; so you can be pretty sure that the game'll find a place to put it's maps.

As for the music I'm fairly confident the ACM files ending up there were because of the editor rather then the game and as such you shouldn't have to worry about those. Though admitably I didn't verify this.

I didn't think of a new "proper" solution for mapper2/fallout2 and "Fast Fallout2" instructions yet but I hope to write a new version eventually taking all this (discussion) into account.

Perceptron
08-15-2004, 06:12 PM
As for the music: engine saves the music file into <master_patches>\sound\music only if there is no such file in this directory (and it saves music only for current location). If the file is exist, the game won't try to overwrite it.
So, you really shouldn't have to worry about this.

Perceptron
08-21-2004, 09:15 PM
New idea about installing mapper and game (thanks to Alan Killenger for this idea):

You can use bat-file if you don't want to take trouble over your .pro files.
Something like this:

attrib -r <game>\*.* /s
xcopy <mod> <game> /s /y
attrib +r <game>\proto\critters\*.pro
attrib +r <game>\proto\items\*.pro
<game>\fallout2.exe

where <game> - game folder and <mod> - folder with your files.
Use this bat-file every time you want to run the game. Remember that for the "xcopy" command you must use paths like this: "c:\game", without slash (\) at the end.

So, solution for installing the mapper and the game will be following:
1. Decompress master.dat into a folder (henceforth called <src>)
2. Decompress critter.dat in <src>
3. Decompress patch000.dat in <src>
4. Create a folder for mod, copy: Mapper2.exe, Mapper2.cfg (folder henceforth called <mod>)
5. Create a folder for game, copy: Fallout2.exe, Fallout2.cfg (henceforth called <game>)
6. Create <drive>:\fallout2\dev\proto, in it create critters, items, mist, scenery, tiles, walls, where drive is the same as the one you'll be running the mapper from. (This allows proto editing in the mapper)
7. Edit fallout2.cfg and change critter_dat, master_dat and point to <src>, change critter_patches and master_patches to point to <game>; For the music, update music_path1 to point to <game>\sound\music and music_path2 to point to where ever the sound is (for example, <src>\sound\music, if this folder contain the music).
8. Edit mapper2.cfg in the same way as the fallout2.cfg, but change critter_patches and master_patches to point to <mod> and music_path1 to point to <mod>\sound\music;
9. Create bat-file (see above) and run the game using this bat-file.
10. You can use other folder for the mapper (not <mod>) if you don't want to see mapper2.exe and mapper2.cfg in the <game> folder (because .bat file will copy this two files in the <game>). You can use even the <game> folder, if you don't want to copy they every time you start the fallout.

Decoy
10-14-2004, 08:19 AM
G'day guys, ive just started modding fallout2 myself (lot more complicated than i originally thought :) Anyway id just like to say 'damn' this forum is useful. Apart from making me feel like my brain is mush that is... and thanks Red! you solved a little problem i have been having. Keep it up guys.

Perceptron
04-23-2005, 07:22 PM
Hey guys.
There is another way for installing the mapper and the game.
You can compress your mod files into patch000.dat every time you are running Fallout2 (with the help of DAT2 utility). Features:
a. the game load your edited data WITHOUT overwriting and deleting it.
b. you don't need to mark any files "read only"
c. both fallout and the mapper are able to load/save games and use the modified data when available

The solution is:
1. Decompress master.dat into a folder (henceforth called <src>)
2. Decompress critter.dat to <src>
3. Decompress patch000.dat to <src>
4. Move data\sound\music\ from game directory to <src>\sound\music\
5. Create a folder for mapper, copy: Mapper2.exe, Mapper2.cfg
6. Create a folder for mod (folder henceforth called <mod>)
7. Create a folder for game, copy: Fallout2.exe, Fallout2.cfg (henceforth called <game>)
8. Create <drive>:\fallout2\dev\proto, in which create critters, items, mist, scenery, tiles, walls folders, where <drive> is the same as the one you'll be running the mapper from. (This allows proto editing in the mapper)
9. Edit fallout2.cfg and change critter_dat, master_dat and point to <src>, change critter_patches and master_patches to point to empty folder; For the music, update music_path1 to point to <src>\sound\music\ and music_path2 to point to where ever the sound is (for example, <mod>\sound\music, if this folder contain the music).
10. Edit mapper2.cfg in the same way as the fallout2.cfg, but change critter_patches and master_patches to point to <mod>;
11. Copy DAT2 (http://www.teamx.ru/utils/dat2.rar) files (dat2.exe and zlib1.dll) to your Windows directory.
12. Create bat-file and run the game using this bat-file:

cd <mod>
del patch000.dat
dat2 a -r patch000 *.*
copy <mod>\patch000.dat <game>\patch000.dat /y
cd <game>
<game>\fallout2.exe

You can use <game> folder as <src> folder (unpack files to <game>) - for "fast" Fallout, as Red! says.

dude_obj
04-23-2005, 07:56 PM
I do the same but make my own (patch) critter and master dats, and use a different directory from fallout to run them. This is possible with FO2LC configured for a custom patch DAT file. I have a batch file that uses DAT2 to build the DATs. It even makes self-extracting RARs for distribution.