afritz1 / OpenTESArena

Open-source re-implementation of The Elder Scrolls: Arena.
MIT License
988 stars 68 forks source link

Text dump of .DAT files and some info #96

Closed CyberistX closed 6 years ago

CyberistX commented 6 years ago

I gave a fast look into the .DAT files listed as todo in the Projects page. Those are basically lists of zero-terminated ASCII strings. Sadly I didn't really play the original game a lot, so I can't tell exactly what part of the game they are related to. All files seem to use the BEL character (0x0A) as a sort of line separator. I'm attaching text files of the dumped strings, you can find the simple script i used at https://gist.github.com/andreaukk/e5fe01d61d9e38887e18328da19e8dda

ARTIFACT1/2.DAT files contains in some points the byte sequence 0x21 0x00 0x21 0x00 (which i guess is a separator between chunks of strings) and appears in text files as two consecutive strings consisting in a single exclamation mark.

Similarly MUGUILD.DAT uses the byte sequence 0x3F 0x00 0x3F 0x00 0x3F 0x00 0x3F 0x00 0x3F 0x00 0x3F 0x00, which appears as six consecutive strings consisting in a single question mark in the text dump.

NAMECHNK.DAT is different from the other files (also contains non-ascii bytes), and needs further investigation.

Guess I will need to play the game a bit to be able to gather more info.

ARTFACT1.DAT.txt ARTFACT2.DAT.txt EQUIP.DAT.txt MUGUILD.DAT.txt SELLING.DAT.txt TAVERN.DAT.txt

Allofich commented 6 years ago

Welcome to the project!

Those files can already be opened and viewed with a text viewer, so I don't really understand what you were going for, but maybe I'm missing something. Those formatting codes will need to be understood, though, if Carmina16 hasn't already figured them out.

The artifact files are for rumors you hear when getting artifact quests, and the others are text used when bartering at stores.

@afritz1, is there anything in particular you would like help with at the moment?

The only other issue I currently have that I could report is so minor that I haven't bothered with it: I notice that in OpenTESArena you start the Imperial Prison level facing north, while you start it facing south in the original game.

afritz1 commented 6 years ago

Hey @andreaukk. For the most part I've just been using tools like WinArena and my own little hex printer program to look at Arena's data files. I'm not sure what those special character sequences are yet other than maybe a terminator for each segment (Arena generally uses null-terminated strings, but strings can also end with characters like ampersands).

I briefly looked into NAMECHNK.DAT a few months ago and I believe it's a Cartesian product with all the races and genders (13x13 prefixes and suffixes). I thought there was a UESP page on it, but I don't remember.

Eventually we'll be reading in all of these files with the MiscAssets class (or something similar). That class is pretty much a hodgepodge of info at the moment since I haven't figured out a good way to organize all the miscellaneous files yet (text, special data, etc.).

For the incorrect direction @Allofich mentioned, that's just from the arbitrary facing I'm using (here I think), since I don't know what the default in Arena is, nor how it's found when going through level transitions. It's not clear if Arena even chooses a default direction from what I've seen in-game. Sometimes it just seems random.

Carmina16 commented 6 years ago

The DAT files are the trade system resource files. Each of them is an array of 75 zero-terminated strings, grouped as 5 (5 3). The outer group is the function, the inner is depending on the player/vendor charisma, and the last 3 strings are chosen at random.

NAMECHNK.DAT indeed is a list of chunks, being

WORD ChunkLen; // header included
BYTE StringCount;
char Strings[0];

The name generator choses a random string from the chunks with certain indices. I'll post the algorithm in the wiki.

afritz1 commented 6 years ago

@Carmina16, is the array size of char Strings[0] a typo? Or is it intended to be a dynamic array? I guess it depends on the string count.

Carmina16 commented 6 years ago

I meant an undefined size. The array extends to the end of the chunk.

afritz1 commented 6 years ago

See commit e842e762b79da3218377cc1cdd780ef2e92121c5. I added parsers for the six files listed at the top of this issue (ARTFACT1.DAT, ARTFACT2.DAT, EQUIP.DAT, MUGUILD.DAT, SELLING.DAT, and TAVERN.DAT), as well as NAMECHNK.DAT (in commits 237430b2be8f6981a6dedde5b70e9b0d01210ead and d359d52f99d47afe7fed7a96f72ed7e0c72ac570).

I suppose I could close this issue now or just leave it open until the remaining files are being read in (CITYINTR, CITYTXT, SPELLMKR.TXT, SPELLS.LST).

Carmina16 commented 6 years ago

CITYINTR and CITYTXT are not used, BTW.

Allofich commented 6 years ago

I just tried editing CITYTXT and, as Carmina16 says, the results in-game did not change. There seem to be duplicate entries in TEMPLATE.DAT, which are maybe used instead.

afritz1 commented 6 years ago

SPELLSG.65 and SPELLMKR.TXT are now being read in commits b719a359398effa0eda27556f5b883d112f3a592 and 422299537c630cb9e90ffa370a98e693efc79ca4 (looks like SPELLSG.65 and SPELLS.LST are identical). No worries about CITYINTR and CITYTXT like you two mentioned. This issue can probably be closed now.