BACK TO MAIN PAGE

Advanced topics

Hakpak | Put contents of hakpak into cache

[describe]

Hakpak | Single Hak Mode

Normally you have multiple hakpak files inside hak directory - one for each server you play on. This is generally a waste of space, especially because a lot of content is probably share, plus ALL of it is inside your cache. If you enable Single Hak Mode, then when you choose 'Connect to' option, all hakpaks except one needed to play on given server will be deleted. Warning: This also include hakpaks which are not registered inside Hak Updater. So if you plan to use such hakpaks, do not use this option and manage hak directory yourself (you can just delete file there - it will be regenerated when you update next time with Hak Updater).

Config | Compressed Cache

All files downloaded by hak updater are kept in cache. It can grow over time - at minimum it will be as large as your largest hakpak, probably somewhat larger. This is in addition to size of ready-to-use hakpaks in nwn hak directory. Basic benefit of it is that you delete your hakpaks and be able to regenerated them easily, plus you share all files between all hakpaks - but this takes some space on disk.
If you check this option (Compressed Cache), files in cache will be compressed (what a surprise...). They will take less space, but repacking hakpak will take more time. This is classical space/time tradeoff. From my tests, you should get around 50% size reduction, while packing hakpak will take about two times as much time. For example, my test hakpak, containing 89MB of images, normally take up 89MB in cache and packs in 10-15s (with average 10s) , while compressed it take up 55MB and packs in 17-24s (with average 20s). Here you do not see 50% reduction in size, but these are images only, text should compress better.
Warning: to compress/uncompress you will need free space equal to missing part - so for decompression of above cache taking 55MB, you will need extra 89MB (because first all files are unpacked and only then originals deleted).

Compressed repositories

Edit your pakinfo.txt and change UpdateCompressed to true. Then, do everything as usual, including 'Generate listing...'. Now, press 'Prepare compressed contents...' -  'gzipped' directory should appear in place you have placed you hak files. Copy it's contents to server, instead of normal files. Important note - DO NOT put it into 'gzipped' dir on server - you should put it exactly in same place where noncompressed files should go. So, if paklist.txt used to be at http://myhost.com/pak/paklist.txt now it will be at http://myhost.com/pak/paklist.txt.gz, NOT http://myhost.com/pak/gzipped/paklist.txt.gz.
After that your players will enjoy compressed downloads on updates. Just remember correct order when adding new content - first 'Generate listing...', then 'Prepare compressed contents...'.

Compression level will vary. It ranges from 30-40% gain for tga up to 80-90% for wok files. For image heavy hakpak, you can expect around 50% gain, but for example for Arcanius 25in1 tileset pack, compression took size from 570MB down to 170MB - this means 400MB less to download on first run...


Library repositories

[describe] - LibraryURL

Override directory

Unfortunately, not all files can be overridden by putting them in hakpak. Bioware hopefully will fix it, but it can be non-trivial in some cases - so for now, there is a temporary solution. Pakinfo spec allows you to specify some files which will be put into override folder. Just pack them normally into your hakpak and then list their names with extensions in Override= field in pakinfo.txt. Separate files with commas.
Override=appearance.2da,spells.2da,feats.2da
This is an example. These files will still be packed into hakpak !!! So if at any point Bioware will support hakpaking all resources, your hakpak is ready for it. You then just need to empty Override line - but no need to hurry (there is nothing wrong with having same file both in hakpak and in override dir).
Now, said that, please note that this system does not scale easily for large number of files. Keeping a list of them in one line, comma separated is tiresome. I have done it on purpose - to make putting files in override harder for hakpak creator. DO IT ONLY FOR FILES WHERE IT IS REALLY NEEDED. Do not put textures, models etc into override.
Every time player will start NWN using Hak Updater, IF you have any entry in Override or DialogDiff, there will be some extra activity Hak Updater needs to do. First it needs to delete override directory, then copy everything from backup, add your files and patch dialog.tlk. This can take quite a few seconds - 10-20s I think on average. So remember, that it will be a bit of nuisance to user - use this things only if you really want to. Good news is that it will be done only on server change - as long as player plays only on your server, no copying/patching will need to be done (unless of course you will upgrade dialog/override contents).

Dialog.tlk patching

It works in similar way to override directory support, but instead of putting things in override dir, Hak Updater modified dialog.tlk to contain your entries. To enable this option, put comma delimited list of patches (more on that in the moment) in DialogDiff= line. All changes from patches will be taken applied to copy of original Bioware dialog.tlk and modified file will be used for given game.

Dialog.tlk patch is text file, with one entry per line. Every entry adds or modifies strref inside dialog.tlk. Format for the file is:

index [extra] Text comes here until end of line.
index [extra]:flen Text comes here until end of line.


Examples

1 [] Barbarians
223 [] Type of Feat: General\nPrerequisite: Armor Proficiency (Light) and Armor Proficiency (Medium).\nSpecifics: This feat grants the knowledge to make effective use of heavy armor.\nUse: Automatic. Fighters, paladins, and clerics receive this feat for free.\n
2373 [P_FemaA046]  
3000 [P_FemaJ034] I'm really sorry. Not that it helps, but like "the fire's out" and "the swelling's gone," it's just kind of nice to hear.
11195 [vs_favhen3m_050]:2.0917969 Yes, {Sir/Madam}. Is there something you need?


New lines have to be escaped using \n - because entire entry has to fit on one line in patch file. Only changed entries should appear in patch - there is no point to care about padding, Hak Updater will do it automatically. This also means, that if you use some very large number, dialog.tlk will grow tremedously. Cost is about 1MB per 30.000 empty entries. This is not much if we are talking about indices like 100.000, but for multi-million indices it is out of question.

Format of line is mostly obvious. First comes the index. Then, inside [] you see meta data. It is used mostly for voice sets - I suppose that you will leave it empty. There is an optional :flen parameter after it - I have no idea what it is for, maybe length of voice set ? If it is omitted, I presume it is 0. Then comes the string, to end of line.

Some extra info:
First space after ] is ignored - it is not a part of string. Next character is part of string, even if it is another space.
There can be any number of white characters at start of line or between index and [extra string].
flen has to go exactly after ]: - there can be no space (in other case it should be interpreted as part of string)
Behavior of system if [extra string] is longer that 16 characters is undefined (probably it should display error on import and truncucate).


You can use any extension recognizable by NWN for dialog patch, but it will be safest to stick to .txt. If you specify more than one patch, all of them will be applied, in alphabetical order of filenames (in case they are any conflicts, zzzzzz.txt patch will be one which takes precedence - but non-conflicting entries will be merged peacefully :).


Media files

[Describe media/ subdirectory handling at server]
[Describe allow custom content options on client]



You can contact me at abies@pg.gda.pl

Hosted by: SourceForge.net Logo