
   ShoC Treatment version 1.0 by NatVac
   for STALKER Shadow of Chernobyl

ShoC Treatment is a rework of the vanilla script files for a 
smoother, cleaner vanilla game, with improvements that should 
also be automatically evident in many mods -- unless they are 
AMK-based, which add a lot of dynamic processing.

Benefits include faster synchronizing, most noticeable upon 
level reloads (e.g., after player death), along with less of 
a burden on the game engine which should result in a smoother 
feel for the game.  Some minor bug fixes have also been added 
to the release, like the cure for the permanent radiation bug,
for those who still play pure vanilla.

As of this release, most bugs and all annoyances remain 
untouched, so you will still want to use a mod to address 
that.

One problem with the current modding scheme to fix bugs is 
that the game will still load unmodified scripts from the 
game's database archives:  gamedata.db4. gamedata.dba, and 
gamedata.dbb for vanilla patched to 1.0004, with minor script 
additions in gamedata.dbc (1.0005) and gamedata.dbd (1.0006).

Why is that a problem?  Well, half of those scripts are not 
used by the game and a few are even invalid.  Yet they are 
still loaded and processed by the game.  (Ironically the 
invalid ones don't impact gameplay beyond the synchronizing 
phase.)

The remainder of the scripts have a lot of debug code that 
does nothing in the retail version of the game except waste 
time and memory, mainly via printf() and print_table() calls. 
These have been commented out in the ShoC Treatment scripts 
and some obsolete forms have been removed (see _g.script) or 
replaced with Lua 5.1-compatible code.  The best example of 
this is the change from the use of table.getn() to the use of 
the length operator #.

There are two parts to the ShoC Treatment effort:  removal of 
the unused scripts, and some cleanup of the ones that remain. 

First we extract the database archives that include the 
scripts.  We then completely remove the script directories 
from two of the extracted archives (.db4 and .dba) and repack 
them.

We then either clean up the .dbb scripts directory by 
executing the batch file move_unused_scripts.bat, or we move 
the scripts subdirectory elsewhere (for archival purposes) 
and replace it with the updated one.  The dbb subdirectory is 
then repacked.

That's it.  The game can be played as is.  Most mods should 
not be affected by the files.  Should any mod make use of a 
file that was removed, you can just add it to the mod's 
scripts\ subdirectory.

__________
Steam users:  Before adding any mods or making any changes 
to the archives (e.g., with this Shoc_Treatment stuff), you 
should verify the integrity of your game cache.  This should 
be one of the right-click options in the Steam game launcher.

Every time you verify the cache, you will restore your game 
to its original form.  This will remove all ShoC_Treatment 
changes.

__________
Extracting the archives:

You will need a database unpacker/packer to complete this 
process, as the unwanted scripts have to be removed from the 
archive files in order for this treatment to work.  The 
remainder of this readme will use SoCPUP for this purpose, 
available separately.

You will need write permission for the directory where the 
work will be performed (the "working directory").  You can 
do this in your STALKER installation directory if that is 
the case; just add SoCPUP.exe to the directory. 
Alternatively, you can copy the three needed gamedata.db* 
files to your Documents directory, and put SoCPUP.exe there.

For the world-wide and North American versions of the game, 
SoCPUP has a default that makes this process simple.  To 
extract an archive, you just execute these commands in an 
MS-DOS command prompt shell opened on the working directory:

SoCPUP gamedata.db4
SoCPUP gamedata.dba
SoCPUP gamedata.dbb

If you are using the CIS (Russian/Ukrainian) version, you 
will also need the "-2947ru" format specifier.

The above commands will extract the contents of the archives 
to subdirectories defined by the extensions of the archives. 
For example, executing "SoCPUP gamedata.db4" will create a 
subdirectory called "db4" and put the extracted files there.

After the extraction is complete, you will have three new 
subdirectories in your working directory.

__________
Cleaning up the archives:

Here are the extracted archive contents.  Instructions are 
given in the comments.

db4\
	levels\
	meshes\
	scripts\ --move this to a directory outside db4\
	shaders\
	sounds\

dba\
	_back_xr_shaders\ --empty, remove before repacking
	_new_xr_shaders\  --empty, remove before repacking
	ai\      --empty, remove before repacking
	anims\   --empty, remove before repacking
	levels\  --empty, remove before repacking
	meshes\  --empty, remove before repacking
	config\
	scripts\ --move this to a directory outside dba\
	shaders\
	shaders_07_02_03\ --empty, remove before repacking
	sounds\  --empty, remove before repacking
	spawns\
	textures\ --empty, remove before repacking
	(nine other files)

dbb\
	config\
	levels\
	scripts\ -- See Note 1
	shaders\
	spawns\
	textures\
	game.graph

Note 1:  You have two choices here -- choose only one:

1) You can move the scripts\ to a directory outside dbb\ 
and then put the ShoC_Treatment scripts\ subdirectory in its 
former place. (Recommended for smoother gameplay.)

Or

2) You can run the move_unused_scripts.bat batch file in a 
command shell in the working directory, like so:

move_unused_scripts dbb

This just moves the unused scripts to a subdirectory called 
"unused\" in the scripts subdirectory.  You would want to 
move the unused\ subdirectory elsewhere before repacking.

To recap:  You want to remove the scripts\ subdirectories 
from both the db4 and dba folders AND you want to replace 
(or rework) the scripts\ subdirectory in the dbb folder.

When the process is complete, the folders will look like this:

db4\
	levels\
	meshes\
	shaders\
	sounds\

dba\
	config\
	shaders\
	spawns\
	(nine other files)

dbb\
	config\
	levels\
	scripts\
	shaders\
	spawns\
	textures\
	game.graph

__________
Repacking the archives:

To repack the archives, use the following commands -- again, 
the CIS folks will also need the "-2947ru" format specifier.

SoCPUP db4
SoCPUP dba
SoCPUP dbb

These commands will attempt to rename the original archives 
before creating the new ones from the supplied subdirectories. 
See the SoCPUP documentation for details on that program.

The SoCPUP repack doesn't recompress the actual files, just 
the directory references, so there can be an increase in the 
size of the archives up to about an additional third.  Again, 
see the SoCPUP docs.

The repacked archives will automatically be used by the game. 
Copy them back (including the renamed archive files) if your 
working directory wasn't your STALKER installation folder. 
You should first rename your original gamedata.db4/dba/dbb 
files (better still, move them to another directory) to avoid 
any operating system shadow-copy or virtual-store issues.

Note:  Do not rename gamedata.dbn files so that their 
extension still starts with ".db".  These files are found and 
used by the game, so renaming, say, gamedata.db4 to 
gamedata.db4_not_used will not stop the game from using it
anyway.

At any time you can make a change to the db* directories and 
then repack.  For example, you can update or re-add a script, 
or you can fix/replace the config\rspec_*.ltx files, or put 
in an updated all.spawn that you want to be the vanilla 
default. (Note that an all.spawn change requires a restart to 
take effect and it must be compatible with the version of 
game.graph used by the game.)

__________
Extracting data from the original archives:

You can extract files from the renamed archives if they are 
ever needed, although you will need the explicit options that 
explain to SoCPUP how to treat the files, something like this:

SoCPUP -dir orig_dbb -2947ww -unpack gamedata_dbb

You can add "-extract scripts\" if you just want the scripts\
subdirectory.

__________
Support:

This is an early version and you can expect some changes. 
Look to the GSC forum site in the Mod Discussion section for 
a thread related to ShoC_Treatment.  You can report on bugs 
there as well as make suggestions.  Also check the Downloads 
page at Metacognix from time to time for possible updates.

GSC STALKER-SoC forum site (English):

http://www.gsc-game.com/index.php?t=community&s=forums&s_game_type=xr&lang=en

This is subject to change depending on the status of the forum 
and/or the websites mentioned.

Enjoy.  --NatVac, 2011/01/19
