Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Jade Empire modding (see first post for info summary)

Page: 1 of 9
 stoffe
04-17-2007, 7:17 PM
#1
Index - useful resource links:

JE Modding tools (so far):
TalkEd v1.1.1a (http://www.starwarsknights.com/forumdl/TalkEd%20v1.1.1a.7z) - TLK V4.0 editor for Jade Empire (for modifying all game text in dialog.tlk)


ERF/RIM Edit v0.3.6a (http://www.starwarsknights.com/forumdl/ERFRIMEdit036a.7z) - ERF/MOD/RIM Editor for Jade Empire (with correct file type associations)


JEFindRes v0.3a (http://www.starwarsknights.com/forumdl/JEFindRes03.7z) - Search tool to look for files with names matching the search pattern within all the game's BIF, MOD and RIM files (and the override folder for completeness). Allows extraction of found files and converting images from TXB format to TGA. (See this post (http://www.lucasforums.com/showthread.php?p=2323801#post2323801) for more info)


Txb2Tga v0.1a (http://www.starwarsknights.com/forumdl/Txb2Tga.7z) - Converts TXB textures to a TGA and TXI file to allow viewing and modifying textures and images.


JE DLGEditor v2.3.0a2 (http://www.starwarsknights.com/forumdl/jedlgeditor_230a2.rar) - Dialog editor for Jade Empire, alpha release (See this post (http://www.lucasforums.com/showthread.php?p=2328866#post2328866) for more info )


Jade Empire Savegame Editor v0.6 (http://www.starwarsknights.com/forumdl/jse_06.zip) - A basic savegame editor for Jade Empire (see this post (http://www.lucasforums.com/showpost.php?p=2351948&postcount=100) for more info)


SAC Utils (http://www.starwarsknights.com/forumdl/sac_utils.zip) - A save.sac ripper and mender in case you want to try manual GFF editing of your savegame.


Other Modding tools that work with JE:
Scripts can be compiled with the KOTOR-adapted versions of nwnnsscomp using nwscript.nss from JE's override folder.


2DAs can be edited with any text editor if they're in 2DA V2.0 format. If they are in the 2DA v2.b binary format they can be edited with KotorTool (http://kotortool.starwarsknights.com/) or tk102's Excel Add-in (http://www.lucasforums.com/showthread.php?t=147961) or converted to 2DA V2.0 with my Convert2da (http://www.lucasforums.com/showthread.php?t=153075) utility.


K-GFF (http://www.lucasforums.com/showthread.php?t=149407) v1.2.0 and above seems to work to edit the GFF files from Jade Empire. Make sure you don't use an older version since the new data type JE uses would not be supported then, resulting in data corruption when saving.



Modding info, tutorial and how-to posts:
Making new gems, effects and techniques (http://www.lucasforums.com/showpost.php?p=2313229&postcount=45)
Modifying the combat system (http://jade.bioware.com/forums/viewtopic.html?topic=559879&forum=108&sp=75#5015452)
Model format information (http://www.lucasforums.com/showpost.php?p=2318655&postcount=51)



Released JE Mods in this thread:
stoffe's "White" Radiant Jen-Zi reskin (http://www.lucasforums.com/showthread.php?p=2335125#postid=2335125)

sekan's "Three Brothers Gems" (http://www.lucasforums.com/showthread.php?p=2354065#postid=2354065)

sekan's "Elephant Demon Style & Moon Light Weapon Style" (http://www.lucasforums.com/showthread.php?p=2358632#postid=2358632)




* * *


Original post:

Since I just got Jade Empire for PC I thought I'd try to update my RIM/ERF editor to handle the Jade Empire files to make modding it a little easier. The ERF and RIM file formats seems to be mostly the same, though the ResType <--> File extension lookup table seems to have changed, both changing the meaning of some existing ResTypes, and adding a bunch of new file types to it.

I've been looking through various RIM and MOD files so far trying to figure out what the different files are. So far I've only been able to figure out this fairly short list. Do anyone know what other file type <--> ResType associations there are, or what the new files are used for?

Edit: Found a list, so hopefully the table should be complete now. Still need to figure out the purpose of some of the files, and what format they are in though. (Some may be leftovers from Neverwinter Nights / Knights of the Old Republic and unused in Jade Empire.)


ResType Type Comment/speculation
------- ---- ---------------------------------------
0 RES ???
1 BMP Bitmap image
2 MVE ???
3 TGA Targa image file
4 WAV Wave sound
5 WFX Wave extra info
7 INI Configuration file (plaintext)
8 MP3 MP3 sound
9 MPG MPG video
10 TXT Text file
11 PVD Binary data (Pointer to Void Data).

2000 PLH Polyhedron
2001 TEX Texture
2002 MDL Model data (MDL) [used along with MDX file with the same name]
2003 THG Thing (???)
2005 FNT Font
2007 LUA Lua script
2008 SLT Slot file
2009 NSS Script sourcecode (plaintext)
2010 NCS Script bytecode (NCS)
2011 MOD Module (ERF)
2012 ARE Static area info (GFF)
2013 SET Tileset file
2014 IFO Module information (GFF)
2016 WOK Area Walkmesh
2017 2DA Data table (plaintext or 2DA V2.b binary)
2018 TLK Talk table file (TLK)
2022 TXI Extra Texture Info (plaintext)
2023 GIT Game Instance File (dynamic area info) (GFF)
2024 ITM Item template (GFF)
2026 CRE Creature template (GFF)
2029 DLG Dialog file (GFF)
2030 PAL Palette (GFF)
2031 TRG Triggers (GFF)
2033 DDS DXTC Compressed texture
2034 SND Sounds (???)
2036 LTR ???
2037 GFF Generic GFF file (GFF... duh)
2038 FAC Faction file (GFF)
2039 ENC Encounter template (GFF)
2040 CON Container template (GFF)
2041 DOR Door template (GFF)
2043 PLA Placeable template (GFF)
2045 DFT ???
2046 GIC Game Instance Comments (area editor comment data)
2047 GUI Graphical User Interface definition file. (GFF)
2048 CSS Conditional Source Script
2049 CCS Conditional Compiled Script
2050 MER Merchant/store template (GFF)
2052 DWK Door walkmesh
2053 PWK Placeable walkmesh (plaintext)
2054 GEN Random Item Generator
2056 JRL Journal file (GFF)
2057 SAV Area game state data (GFF)
2058 WAY waypoint template (GFF)
2059 4PC Custom 16-bit RGBA texture format
2060 SSF sound set file (SSF)
2061 HAK HAK file (ERF)
2062 NWM NWN Official Campaign module (ERF)
2063 BIK BINK movie (Bink video)
2064 MIN MiniGame data (GFF)
2065 NDB Script debugger data (toolset)
2066 XWB XACT WaveBank
2067 XSB XACT SoundBank
2068 BIN XBOX DSP filter

3000 LYT Area model layout (plaintext)
3001 VIS Area visibility graph (plaintext)
3002 RIM Resource Image File (RIM)
3004 LIP Lipsync Visemes data
3005 XMV ???
3006 WMA ???
3007 CWD Crowd game object template (GFF)
3008 PRO Projectile static resource type
3009 AOE Area of Effect static resouce type
3010 MAT material file (plaintext)
3011 MAB material file (binary)
3012 QST Quest/journal data (GFF)
3013 STO Store static resource file (GFF) [used with MER file?]
3014 APL Artist placeable
3015 HEX Hex grid (plaintext) [appears to be map-related in some way]
3016 MDX Extra model data (binary) [used along with MDL file]
3017 TXB Compressed image with TXI data
3018 TPC Compressed image with TXI data
3019 CAM ???
3020 SPT ???
3021 STYLE ???
3022 FSM Finite State Machine (FSM) data
3023 ART [Weather/Light data for area?] (INI/plaintext)
3024 AMP ??? (binary)
3025 CWA Crowd Attribute (GFF)
3026 XLS MS Excel spreadsheet
3027 SPF NGF: Style profiles
3028 BIP PATL: Binary LIP. - [lipsync/Sound file?]

9996 IDS Legacy BG Script File
9997 ERF Encapsulated file
9998 BIF BIFF file
9999 KEY Key file
 oldflash
04-18-2007, 3:09 AM
#2
Since I just got Jade Empire for PC I thought I'd try to update my RIM/ERF editor to handle the Jade Empire files to make modding it a little easier. The ERF and RIM file formats seems to be the same, though the ResID <--> File extension lookup table seems to have changed, both changing the meaning of some existing ResIDs, and adding a bunch of new file types to it.

That's a good news.
I've done few things (http://oldflash.125mb.com/x/) like editing some 2da's and make some scripts.
For that I have use 2DA Converter/Merger Tool, ERF/RIM Editor and KotorTool.
Maybe you have a look into .tlk files? All I want is to set description for few items. :)
 stoffe
04-18-2007, 10:40 AM
#3
Maybe you have a look into .tlk files? All I want is to set description for few items. :)

I've made a new version of TalkEd that should handle the TLK V4.0 format used by Jade Empire. It seems to work to read and modify the English TLK file with it from my quick testing. Though please keep an eye out for bugs if you use it since I've only had time to do very limited testing. You can download it here (http://www.starwarsknights.com/forumdl/TalkEd) v1.1.1a.7z) for now. (This version only works with the Jade Empire TLK files, not the KOTOR ones.)

There is one data field in the TLK file I don't know the purpose of currently. It seems to be a 32 bit unsigned integer which is set to 0xFFFFFFFF (-1 I suppose) for the majority of the TLK entries, though a fair number of them (mostly dialog related strings) has some other value set here, and it seems each value (except 0xFFFFFFFF) used is unique and set for just that one entry.

TalkEd just lets you set this number directly (using hexadecimal notation) for the time being until someone can figure out what the purpose of this data is.

Edit: I suspect the unknown numeric value refers to names of the numbered BIP/sound files found in for example audio.bif, though I haven't been able to verify this yet.
 tk102
04-18-2007, 11:04 AM
#4
stoffe, have you tried poking around in the .key/.bif files to fill in the gaps for erf extensions? I found

this thread (http://jade.bioware.com/forums/viewtopic.html?topic=554641&forum=108&highlight=erf) on Bioware's forums that references a tool that recognizes most of the key/bif extensions for Jade Empire. Just a thought.
 stoffe
04-18-2007, 11:09 AM
#5
stoffe, have you tried poking around in the .key/.bif files to fill in the gaps for erf extensions? I found
[url=http://jade.bioware.com/forums/viewtopic.html?topic=554641&forum=108&highlight=erf)
this thread[/url] on Bioware's forums that references a tool that recognizes most of the key/bif extensions for Jade Empire. Just a thought.

I haven't, but the problem I can see with that is that the KEY/BIF format doesn't store file extensions either, as far as I am aware. So if the lookup table for ResID <--> File type has changed for Jade Empire tools made for other games would still output data with the wrong file extension, or no valid extension at all, since it has no way of knowing what those ResID's are supposed to be.

That the data files seems to be an even more disorganized mess than KOTOR, with files or the same type or files belonging to the same area scattered all over the place, doesn't make it easier to find all the file types that are used and how they fit together :)
 tk102
04-18-2007, 11:16 AM
#6
It was my hope that the tool referenced above (in a broken url link, now fixed) would shed the light on some unknown extensions. A long shot I'm sure, but just a different angle to attack from.
 stoffe
04-18-2007, 2:30 PM
#7
It was my hope that the tool referenced above (in a broken url link, now fixed) would shed the light on some unknown extensions. A long shot I'm sure, but just a different angle to attack from.

Poked around the BIF files a bit, and while they do suffer from the same problem of incorrect/unknown file extensions I managed to figure out a few more things (updated the list in the first post).

I've made a JE version of my ERF/RIM Editor that uses the above file extension/ResType table (minus the couple of unknowns in the list) so far. While the list isn't complete it's easier to spot which files aren't properly identified when it doesn't use the KOTOR file associations. :)

If anyone is interested you can download it from the link in the first post in this thread. If you notice any file types that are listed starting with a # followed by a number those are of unknown types. Please let me know what file it it and where (in what file) you found them in those cases. :)
 oldflash
04-19-2007, 4:19 AM
#8
That fiels is for sound ("0xFFFFFFFF" value = no sound). I test this by replacing values and it works. However the sound file must be loaded in that module or to be present in override because if I set a sound which is used in other module will do nothing. I haven't test append new entry but I'm sure is no problem with that. This tool is perfect for what I need to finish my mod.
Many thanks stoffe.
Edit: I just found dialog tool (http://code.google.com/p/jadedlg/) and I should test-it tonight.
I like how easy is to attach scripts for diferite events by editing ar_*.2da files.
 stoffe
04-19-2007, 11:08 AM
#9
That fiels is for sound ("0xFFFFFFFF" value = no sound). I test this by replacing values and it works. However the sound file must be loaded in that module or to be present in override because if I set a sound which is used in other module will do nothing.

Ok, thanks for the confirmation. I've updated TalkEd (http://www.starwarsknights.com/forumdl/TalkEd) v1.1.1a.7z) to handle the values as sound reference numbers and not display them in hexadecimal notation.


I like how easy is to attach scripts for diferite events by editing ar_*.2da files.

Haven't had much time to look at how things fit together yet since I've only had the game installed for roughly a day so far, but that may be very useful if they don't have any debug console in the game (haven't managed to find one) :)
 stoffe
04-19-2007, 3:41 PM
#10
While poking around in the RIM and MOD files I found some more file types I managed to figure out with reasonably certainty what they should be. I've updated the list in the first post and uploaded another version of ERF/RIM Edit with the recent changes, see the link in the first post in this thread to download.

Any other file types I've not managed to find yet?
 RedHawke
04-20-2007, 12:57 AM
#11
Thanks for all the effort stoffe! =)

Now I just need to get off my lazy behind and install the darn game (DDO is evil... just Evil!) ;)
 mjpb3
04-20-2007, 2:57 AM
#12
Kind of on topic here, but if someone could find a way to open the PC & NPC textures (they're in txb form) I would be ever so grateful. :D

(If this doesn't fit in here, please excuse me. ;))
 oldflash
04-20-2007, 5:47 AM
#13
@stoffe: many thanks again for all this tools.
I have no idea how to use a debug console or what is that
.ndb files are debug information for the script debugger and not necessary for the game to function. ... if this info good for anything.
However, I belive to be possible to send mesajes to log or display by #include debug.

@mjpb3: I also look for this and for a decomp. for mdl files
 stoffe
04-20-2007, 2:13 PM
#14
Kind of on topic here, but if someone could find a way to open the PC & NPC textures (they're in txb form) I would be ever so grateful. :D


The TXB format has some similarities to the TPC format used for the KOTOR games. The header is different, but like TPC it contains compressed bitmaps and optionally TXI data at the end.

Don't know if I'm good enough at this kind of programming to be able to make a converter that converts TXB --> TGA directly, but I'll give it a try and see how it goes. :)



I have no idea how to use a debug console or what is that


I was just looking for an in-game debug console (similar to the yellow "> " you can type commands at in KOTOR1, and the invisible one in TSL), but it doesn't seem like Jade Empire has one. Hopefully most of that can be handled via scripts instead though.
 tk102
04-20-2007, 2:21 PM
#15
I built a TPC Perl mdoule based on eiz's tpc2tga source code. If you want any assistance let me know.
 stoffe
04-20-2007, 3:17 PM
#16
I built a TPC Perl mdoule based on eiz's tpc2tga source code. If you want any assistance let me know.

Thanks, that will probably be needed if this is going to go anywhere at all. :) I had a look at the tpc2tga source to get an idea of how to decode the DXT data and was immediately reminded why I strongly dislike C++ (couldn't even get that code to compile, so I'm doing it in Delphi instead).

Edit: Nevermind, I was just stupid. :)
 mjpb3
04-20-2007, 4:08 PM
#17
Whatever you can come up with would be excellent for me. That's the main thing I ever wanted to mod in Jade Empire--the textures. Thanks for anything you can accomplish. :D
 tk102
04-20-2007, 4:22 PM
#18
sub reverse_bytes {
my $in=shift;
return unpack('V',pack('C4',reverse (unpack('C4',pack('V',$in)))));
}
It is indeed a reversal of bytes (0xAABBCCDD becomes 0xDDCCBBAA for example).

This is so the $cpx variable in decode_dxt1 can be right shifted 2 bits at a time and disregarded as the new $px is calculated. The blended array is set up in such a way to make sense of the two bits (which are now reversed).

see:for (my $y=0; $y<4; $y++) {
for (my $x=0; $x<4; $x++) {
my $px = $cpx & 3;
$pixels[($ty-4+$y)*$pitch +($tx+$x)]=$blended[$px];
$cpx >>=2;
}
}


I don't have the tpc2tga source in front of me at the moment so I'm just working off the tpc.pm, btw -- the Perl code was a direct (more or less) translation of the C++.

Edit: crossed out the part about the 2 bits being reversed -- they aren't reversed -- their position within their bytes are unaltered but the bytes themselves are reordered.
 stoffe
04-20-2007, 4:54 PM
#19
sub reverse_bytes {
my $in=shift;
return unpack('V',pack('C4',reverse (unpack('C4',pack('V',$in)))));
}
It is indeed a reversal of bytes (0xAABBCCDD becomes 0xDDCCBBAA for example).

That reminds me why I'm not too fond of Perl either. :) I haven't done anything with Perl for over 6 years, so I didn't understand much of that code. (I prefer high-level "almost english" languages like Delphi, C#, PHP, so it feels like I'm in way over my head with this.)

The unpack() function takes a string and splits it by token into an array, like explode() in PHP? While pack() takes an array and spits out a token-separated string from it?

What does your reverse_bytes() function receive as parameter, a token-separated string (using "V" as separator) containing the three values a texel-struct holds?

If so you convert the string to an array, immediately explode the array into a string again (this time using "C4" as token separator instead), reverse-sort the string, turn it into an array again (wouldn't "C4" be "4C" when you reverse the string?), and immediately turns the array back into a string (this time separated with "V" again) which you return? Wouldn't that return an array of 3 values?

Huh? I don't follow what this accomplishes. :) It obviously works, but I still don't understand what it does. :confused:

(As you don't have the source: The C++ code takes a struct as function parameter containing two 16 bit unsigned ints and one 32 bit unsigned int value... does something with those three values which I have absolutely no idea what, and then spits out a single 32 bit unsigned integer as result.)

* * *

Another question ... this is called in a loop that loops up to the Y-size of the bitmap while writing the TGA (i is the incrementing value in the loop):
fwrite(file->pixels+pitch*(ysz-i-1), 4, pitch, fp)

file->pixels is an array of 32 bit unsigned integers (the RGBA data), pitch is the X-dimension of the image (in pixels), ysz is the Y-dimension of the image

What exactly is it writing? file->pixels is an array, but it doesn't supply any array index in that function call... Does the file->pixels+pitch*(ysz-i-1) add pitch*(ysz-i-1) to the memory pointer of the pixels array and then write the four bytes found in that location? Why do this instead of using an array index?

Weird lower-level languages I haven't used for years confuse me. Use of pointers always confuse me. :)
 tk102
04-20-2007, 5:08 PM
#20
The unpack() function takes a string and splits it by token into an array, like explode() in PHP? While pack() takes an array and spits out a token-separated string from it?

No, The pack and unpack functions are Perl's way forcing data to/from certain interpretations like an unsigned long (template: V) or a unsigned byte (template: C). This is needed because of Perl's weak typing mechanisms. pack takes data forces it into a datatype while unpack translates coerced data back into perl scalars.


What does your reverse_bytes() function receive as parameter, a token-separated string (using "V" as separator) containing the three values a texel-struct holds?
reverse_bytes accepts a perl scalar (which itself was populated from an unpack function with template V). It then packs this value into an unsigned long again, unpacks it into 4 unsigned bytes, reverses the array of bytes, repacks the array of bytes, and then unpacks the result as unsigned long.

(As you don't have the source: The C++ code takes a struct as function parameter containing two 16 bit unsigned ints and one 32 bit unsigned int value... does something with those three values which I have absolutely no idea what, and then spits out a single 32 bit unsigned integer as result.)Anyway the more elegant C++ code appears as this:
inline u32 reverse_bytes(u32 i, int2type<4>) {
return (i&0xFF000000) >> 24
| (i&0x00FF0000) >> 8
| (i&0x0000FF00) << 8
| (i&0x000000FF) << 24;
} Here you can see better the masking and data shifting involved. The perl code accomplishes the same thing but uses a temporary array of bytes that it reverses and repacks into a long then unpacks to get the numeric value. :xp:

* * *
 tk102
04-20-2007, 6:10 PM
#21
Another question ... What exactly is it writing? file->pixels is an array, but it doesn't supply any array index in that function call... Does the file->pixels+pitch*(ysz-i-1) add pitch*(ysz-i-1) to the memory pointer of the pixels array and then write the four bytes found in that location? Why do this instead of using an array index?Yes that is exactly what it is doing, byte by byte. I believe this syntax was used because in the tpc.cpp file, you can see file->pixels+pitch*(ysz-i-1) is used to assign the values byte-by-byte. I think eiz just used copy/paste of the code as a mnuemonic so he could easily recognize what exactly he looping on.
 tk102
04-20-2007, 7:20 PM
#22
The fwrite function is writing row by row starting at the end of the array. Think of the array as the image mirrored vertically. (Left-right is maintained but top-bottom is reversed.) I'm sorry for confusing you by saying byte-by-byte earlier.

Here's the declaration for fwritesize_t fwrite(const void *ptr, size_t size, size_t nitems,
FILE *stream); We are using size=4, and nitems=pitch (the width in pixels of the iamge), so each fwrite is writing 4*pitch bytes. The fwrite function returns the number of items (not bytes) which should be equal to pitch in our case. The array's memory address begins at file->pixels, so at the beginning of the loop to write the last row from the array the offset would be (pitch*(ysz-1)). The next to last row would begin at (pitch*(ysz-2)).

HTH and sorry for not having the concentration earlier. :xp:
 oldflash
04-21-2007, 5:21 AM
#23
I was just looking for an in-game debug console (similar to the yellow "> " you can type commands at in KOTOR1, and the invisible one in TSL), but it doesn't seem like Jade Empire has one. Hopefully most of that can be handled via scripts instead though.
Ah, stupid me... I was thinking to something more complex... I saw a console_font file somewhere.

Great news about textures and I must thank you all for efforts.
 stoffe
04-21-2007, 7:16 AM
#24
The fwrite function is writing row by row starting at the end of the array. Think of the array as the image mirrored vertically. (Left-right is maintained but top-bottom is reversed.) I'm sorry for confusing you by saying byte-by-byte earlier.

But still something does not seem right with how I'm understanding this... In the above example each line of the image has 256 pixels... and each pixel is represented by a dword (4 byte integer) holding its RGBA value. In other words each line contains 4 * 256 = 1024 bytes, which you read from the array and write to the file.

But each iteration of the loop still only seems to back off pitch (=256) bytes. Now can it back up one row if it only backs up 25% of the data that is being read/written? Shouldn't it back up pitch*4 to get to the next line of data? Does the memory pointer voodoo deal with array elements and not byte positions in memory? I.e. it backs up pitch (=256) elements and not bytes?

Edit again: Yes! :emodanc: That seems to have done the trick. Seems like the utility works to convert at least those TXB files to TGA I have tested it on. :)
 tk102
04-21-2007, 11:08 AM
#25
\o/ Yay for stoffe! Did you answer your own question then? The *4 part seems like it should be there to me too... but then again I'm not a C++ guru. I would've expected the use of brackets here to denote element iteration. (Don't like having to think at this level with my programming either, stoffe.) I remember this is the area I fumbled through with trial and error also until I got something recognizable. :D Good job.
 stoffe
04-21-2007, 11:16 AM
#26
\o/ Yay for stoffe! Did you answer your own question then?

More or less, I figured out how to replicate the behavior reasonably using array indexes instead. :)

The quick converter utility seems to work reasonably well on the few TXB textures I've tried to convert with it. I've uploaded it for now in case someone else wants to help test it and determine how well it works: Txb2Tga (http://www.starwarsknights.com/forumdl/Txb2Tga.7z).

Use at your own risk. It seems to work OK, but I've only tested it on a handful of different TXB files. If you encounter any file it can't convert properly please let me know which file that was.

* * *

On more general notes it seems the NWNNSSCOMP for KOTOR (at least the variant tk102 did) works fine to compile scripts for Jade Empire if you use the nwscript.nss file found in the override folder and fix the couple of syntax errors it contains. :emodanc:

Jade Empire also seems to use a mix of the traditional plaintext 2DA V2.0 format, and the same binary 2DA V2.b format used with KOTOR. So the binary files can be edited with KotorTool, or converted to text using tk102's excel plugin or my quick converter utility.
 mjpb3
04-21-2007, 7:28 PM
#27
Yes yes yes!!!! Thank you stoffe and tk102! It works! I was able to convert Scholar Ling's outfit and head texture. Just want I needed!

:bow: :bow: :bow:
 AjuntaPall316
04-21-2007, 9:58 PM
#28
Thanks for all your hard work, nowhere else is even close to this far for texture editing yet. But how do you get these new textures into the game now? Do you need to change them back to txb's? If so, how?
 tk102
04-21-2007, 11:43 PM
#29
I assume the .tga files are readable as-is in the override directory. Bioware has been pretty good about that in the past, just as they do with v2.b and v2.0 2da files.
 AjuntaPall316
04-22-2007, 1:10 AM
#30
Still can't get it to work. I converted Radiant Jen Zi's body and edited it, then saved it as TGA image named P_Li01 which is the same as the txb file. I also tried naming it P_Li01.txb which I knew wouldn't work and it didn't. I deleted the actual txb file thinking it might just be loading that one first, and that didn't work either. Her body came up black, so I replaced it. Any Ideas?
 stoffe
04-22-2007, 6:50 AM
#31
Thanks for all your hard work, nowhere else is even close to this far for texture editing yet. But how do you get these new textures into the game now? Do you need to change them back to txb's? If so, how?

It should work to put both the TGA and TXI file in the override folder directly. Make sure there isn't a corresponding TXB file located in the override folder as well, since it will take precedence over the TGA's. Many of the player appearance textures are located in the override folder as well as in players.mod (where those in override will be used since it has higher priority than the BIF/RIM/MOD files).

I did a quick test and recolored the shirt of my character green, moved p_blossom01.txb out of the override folder and put p_blossom01.tga and p_blossom01.txi in the override folder, and she turned up with a green shirt in-game.

(I.e. you shouldn't need to remove the TXB file from within the data files for the TGA to be used, just make sure one doesn't exist in the override folder.)


Edit: I did a quick reskin of the character you mentioned as well, and it showed up fine in-game:
http://img518.imageshack.us/img518/7334/masteradiantmb9.th.jpg) (http://img518.imageshack.us/img518/7334/masteradiantmb9.jpg)
 AjuntaPall316
04-22-2007, 4:33 PM
#32
Thanks, I got it working now. I don't know why it didn't work the last time I got rid of the TXB though. Thanks again.
 stoffe
04-23-2007, 9:41 AM
#33
Seems like Jade Empire has added yet another data type to the GFF format (still without changing the version number :roleyess:). Type 18 appears to be a StrRef type, similar to ExoLocString in use but only containing a dialog.tlk reference and not any localized substring data. Be warned that these fields may get messed up and stripped if using any GFF editors for NWN or KOTOR to edit Jade Empire's GFF files.

Aside from that it seems JE uses the Rotation and Vector field types added in KOTOR as well, which would cause trouble when using GFF editors made for NWN.
 tk102
04-23-2007, 10:08 AM
#34
So Field 16 and 17 exist-- that's good. Have you been able to tell if CResRef fields include up to 32 chars (like NWN2) or just 16 chars (like KotOR)? If it helps, I could modify either KGFF or NWN2GFF to include field 18. Send me a PM if you like. :)
 stoffe
04-23-2007, 12:24 PM
#35
So Field 16 and 17 exist-- that's good. Have you been able to tell if CResRef fields include up to 32 chars (like NWN2) or just 16 chars (like KotOR)? If it helps, I could modify either KGFF or NWN2GFF to include field 18. Send me a PM if you like. :)

As far as I can tell Jade Empire uses 16 character ResRefs. It seems to be the same format used for KOTOR except for (at least) one new data type that looks like it holds a StrRef from a quick look at it. It would be very useful if you could make a JE-compatible version of k-gff. :)
 Adelphus
04-23-2007, 1:45 PM
#36
Is there any current information about decompiling and replacing models at this time?
 tk102
04-23-2007, 6:19 PM
#37
As far as I can tell Jade Empire uses 16 character ResRefs. It seems to be the same format used for KOTOR except for (at least) one new data type that looks like it holds a StrRef from a quick look at it. It would be very useful if you could make a JE-compatible version of k-gff. :)
KGFF v1.1.9 (http://www.lucasforums.com/showthread.php?threadid=149407) now supports StrRef fields (Field Type: 18). I anticipate if/when KotOR3 gets made, there is a good likelihood it will use this field type as well.

@Adelphus: I don't believe cchargin or Taina have devoted time to modifying their modeling tooling for Jade Empire at this point.
 Adelphus
04-23-2007, 9:26 PM
#38
Nice work on KGFF tk, and thanks for the info.
 stoffe
04-28-2007, 5:30 AM
#39
I've uploaded another minor update to the ERF/RIM Editor, adding some more file associations to the table. See the link in the first post in this thread to download it.
 mjpb3
04-30-2007, 6:36 AM
#40
stoffe, just a couple questions/comments about your TXB2TGA converter...

Not that it doesn't work properly or anything--and I can use it just as it is--but, I was curious as to why I get so much dithering when converting the TXBs to TGAs.

Also, is there any way for the converter to increase the output file size from 256x256 to the more commonly used 512x512? It just seems as if the smaller file size could be causing the dithering, but I could be completely wrong about that and the dithering is caused by something else entirely.

Anyway, thank you so much for this converter! Whether or not you can do anything else with it, it still works fine just as it is and I am enjoying using it a lot! ;)
 wurzelpfrumpf
04-30-2007, 9:17 AM
#41
Help! Can anybody tell me where to find the heads of the pc's? I want to change Lings head and found only the bodies. Maybe I'm blind or was looking in the wrong directory (override).
 stoffe
04-30-2007, 10:03 AM
#42
Not that it doesn't work properly or anything--and I can use it just as it is--but, I was curious as to why I get so much dithering when converting the TXBs to TGAs.

Hmm, I haven't noticed anything like that (but then I haven't tested it very much either :)). Which image in particular would this be noticeable for?


Also, is there any way for the converter to increase the output file size from 256x256 to the more commonly used 512x512?

The TXB files contain compressed bitmaps which come in one resolution. The converter does not do any scaling, it just grabs the bitmap, decompresses it and saves it in TGA format instead. The resolution you get in the TGA is the one the TXB was saved in. Only vector graphics can be rescaled freely without image quality loss, bitmaps are fixed in size. You'd probably get better image quality if you use an image manipulation application like Photoshop, Paintshop Pro or GIMP than if I'd try to make the converter scale them up.

Help! Can anybody tell me where to find the heads of the pc's? I want to change Lings head and found only the bodies. Maybe I'm blind or was looking in the wrong directory (override).

You can find them inside players.mod (in the data folder) if I remember correctly. You should be able to use the ERF/RIM Editor linked to in the first post in this thread to extract them from the MOD file.
 mjpb3
04-30-2007, 12:27 PM
#43
Hmm, I haven't noticed anything like that (but then I haven't tested it very much either :)). Which image in particular would this be noticeable for?
The one I was working on was Scholar Ling's body texture (her outfit).

The image I converted has some dithering around the colored parts, but I actually now suspect that it isn't your converter that's causing it because a few of the images I converted from the ones that already come in the Override folder have dithering too.

I think it may just be because the game is using graphic files that were used on the XBox first. *shrug*

The TXB files contain compressed bitmaps which come in one resolution. The converter does not do any scaling, it just grabs the bitmap, decompresses it and saves it in TGA format instead. The resolution you get in the TGA is the one the TXB was saved in. Only vector graphics can be rescaled freely without image quality loss, bitmaps are fixed in size. You'd probably get better image quality if you use an image manipulation application like Photoshop, Paintshop Pro or GIMP than if I'd try to make the converter scale them up.
Yes, I am using Paint Shop Pro for these (plus everything else I do :D )

I tried scaling them up from 256x256 to 512x512, but because of the dithering it looked worse. I think I can fix it though, using my retouch tool.

Anyway, thanks for the converter! :D
 stoffe
05-03-2007, 9:33 AM
#44
I've uploaded what's hopefully the final version of my ERF/RIM Editor for Jade Empire (unless there are any bugs I have overlooked). I found a list of File Type <--> ResType associations so hopefully it should now fully recognize all data types used by the game and allow extracting/adding them properly.

Link is in the first post in this thread.
 stoffe
05-14-2007, 6:19 PM
#45
Some minor things I've figured out while poking around the game data, in case someone is interested:

How to make a new essence gem
Add two new entries to dialog.tlk, one with the name and one with the description.
Add a new line to the gems.2da - set the columns:

Set the Level column to a value between 1-6 (I think this is for how late in the game they appear)
Set the CombatOnly column to 1 if the effects only should be applied during combat (0 for all the time).
Don't know what the UpgradeCost column is used for.
The Upgrade column seems to point to the row label of the next gem in a "family" (Flawed -> Inferior etc) of gems, or 0 if there is no more powerful of the same type.
Set the Effect0 column to a row label from effects.2da of the type of effect you want the gem to grant.
Set the Parameter0 column to the parameter of that effect as needed (for example the magnitude of a bonus granted)
Set the Duration0 column to 0, since all gem effects are permanent while equipped.
Similarly set Effect1 and Effect2 (and their parameters) if you want the gem to grant up to 3 effects.
Set the UniqueSet column to a line number in unique.2da to only allow one gem if this type to be equipped (or 0 to allow multiple).
Set the MinAlignment column to the lowest alignment (open palm/closed fist) value to allow equipping this gem. Scale goes from 0 (Max Closed Fist) to 255 (Max Open Palm).
Set the MaxAlignment column to the highest alignment value to allow equipping this gem.
Set the AlignmentSRTREF column to a StrRef to show if attempting to equip the gem while falling outside those specified alignment boundraries.

Add a new line to items.2da - set the columns:

Set the TYPE column to gems (makes it use gems.2da)
Set the ID column to the row label in gems.2da of your new line for your gem.
Set the COST column to its base silver value when bought/sold.
Set the 3DMODEL column to w_icon_Damulet. (Model in world when appearing from smashed container)
Set the ICON column to the name of a TXB or TGA file with an icon to be used on the Amulet screen.
Set the STRREF_NAME column to the StrRef of the new dialog.tlk entry holding the name you added.
Set the STRREF_DESC column to the StrRef of the new dialog.tlk entry holding the description you added.
Set the SCRIPT column to **** (not used for gems)

To add the gem as a reward in-game, find the ar_*.2da file for the area you have in mind, locate the reward event line where you want the gem given out, and add the items.2da row label number of your new row to the Item column. If a number already exists here you can add several separated by commas.


Non-standard effects
I wanted my gem to grant a new type of damage shield, similar to the Cyclone gem but with another visual and doing other damage. I wanted it to use the blue cloud and halo effect used to symbolize the Open Palm instead of a whirling particle cloud, and wanted it to drain some Chi from the victim as well.

To do this:
Add a line to DamageArmor.2da:

The Duration column does not seem to matter for this purpose since gem effects are permanent duration.
Set the Health, Chi and Focus columns to how much of that type to drain from the attacker when hit.
Set the DurationVFX column to a row label number from visualcrusts.2da for the visual to play while the effect is active.
Set the ImpactVisualEffect column to a row label number from visualeffects.2da of a visual to play when the attacker gets wounded by the shield.

On the line for the gem in gems.2da set one of the Effect# columns to 60 (DamageArmor effect) and the Parameter column to the line number in DamageArmor.2da you added for the new damage shield. Make sure the CombatOnly column is set to 1 for your line so the shield only will be active while in combat.


The result in-game:
http://img526.imageshack.us/img526/921/jehaloeffectqc1.th.jpg) (http://img526.imageshack.us/img526/921/jehaloeffectqc1.jpg)

In general the 2da column in effects.2da determine what the effect parameter values are used for. The numbers in this column are line numbers from 2das.2da, which tell the game the name of a 2da file to either look up your parameter in, or specify more closely what the effect should do (see below).

If the row column in effects.2da is set to **** your parameter value is the line number in the 2DA file indicated by 2das.2da.

If the row column is set to a value in effects.2da that value is the line number in the 2DA file indicated by 2das.2da, and your parameter is usually just a number that determines how much bonus or penalty the effect should grant.


How to make a new technique
Fairly similar to how to make a new spirit gem, though somewhat more limited since it can only grant two effects, and is limited in what effects it can grant.

Add two new entries to dialog.tlk, one with the name and one with the description.
Add a new line to the improvements.2da - set the columns:

Set the effect0 column to a row label number from effects.2da for the effect to grant. Note that only Body/Mind/Spirit, Health/Chi/Focus, Charm/Intuition/Intimidate modifiers seem to work well to grant with techniques. Other types of effects seem to often be lost as soon as you load a savegame.
Set the parameter0 column to the magnitude of the effect set in effect0. This is usually how much bonus to grant.
Set the storewarningstrref column to a dialog.tlk StrRef of a string to show in a confirm dialog if this technique grants both bonuses and penalties to allow the the player to undo gaining it. StrRef 106958 is usually used for this.
Repeat for effect1/parameter1 if you want the technique to grant two effects.

Add a new line to items.2da - set the columns:

Set the TYPE column to improve (makes it use improvements.2da)
Set the ID column to the row label in improvements.2da of your new line for your technique.
Set the COST column to its base silver value when the technique is bought.
Set the ICON column to the name of a TXB or TGA file with an icon to be used on the Techniques screen.
Set the STRREF_NAME column to the StrRef of the new dialog.tlk entry holding the name you added.
Set the STRREF_DESC column to the StrRef of the new dialog.tlk entry holding the description you added.
Set the SCRIPT column to j99_improvement. This is a standard script that applies the technique effects when the technique is gained.

To add the technique as a reward in-game, find the ar_*.2da file for the area you have in mind, locate the reward event line where you want the technique given out, and add the items.2da row label number of your new row to the Item column. If a number already exists here you can add several separated by commas.


* * *

I'll post some more of what I've figured out later if anyone has any interest in reading it. I've successfully added some "new" (re-using existing animations, but behaving differently) martial and magic styles that works fine when used in game.

If anyone has figured out how other things fit together, please post about it and describe how. :)
 Maian
05-22-2007, 6:56 PM
#46
 stoffe
05-22-2007, 7:50 PM
#47
Posted some game data stuff here:

http://jade.bioware.com/forums/viewtopic.html?topic=559879&forum=108&sp=75#5015452)


Ooh, very nice. :thumbsup: That must have taken some time to write up, thank you for posting it. :) Filled in some gaps about things I hadn't figured out yet. Now I won't have to put more work into a tutorial about how to add new styles, you covered pretty much all of it and more.
 Maian
05-23-2007, 2:10 PM
#48
I haven't covered harmonic combos (synergy.2da), though the system looks simple. I got sidetracked into trying to decipher JE's MDL format. I've been making some progress on that, but the best I can do is just provide a structural layout of the format since I'm not a modeler (or have modeling software).
 Maian
05-23-2007, 7:36 PM
#49
Well, I also mean the synergy-related columns in the as 2das, not just synergy.2da :)
 stoffe
05-23-2007, 7:52 PM
#50
I haven't covered harmonic combos (synergy.2da), though the system looks simple. I got sidetracked into trying to decipher JE's MDL format. I've been making some progress on that, but the best I can do is just provide a structural layout of the format since I'm not a modeler (or have modeling software).

The Harmonic combo data seems to follow the same pattern as the other files.... An effect column that references effects.2da to say what happens when the combo triggers, and a parameter column that specifies what 2DA line is used in the definition 2DA for that effect type. The screenshake column points to a line in visualeffects.2da. The other columns seem unused. Seems to work fine to add new rows here as well when making new styles to give them unique HC behaviors.

The relevant styleAS.2da columns seem to be:

synergyprestate - Set to 1 for the martial style attacks that can finish the Harmonic Combo. Usually only the power attack has this set, but it works on any attack.

synergystart - Set to a row number in synergy.2da for the effect that should happen when the Harmonic Combo triggers. This is set in the support/magic style that initiates the HC timer.

synergyduration - Seems to be a delay before the harmonic combo countdown initiates, in seconds.

The synergyeffect column appear to be unused from what I can tell.

If you set a synergystart and synergyprestate on the same attack the harmonic combo will trigger immediately whenever that attack is made, unless the synergyduration column is set to a value higher than 0, in which case another attack is needed to trigger the combo.

(I did this on my "Flame Strike" martial style where the power attack initiates an Immolation Harmonic Combo countdown after a 10 second delay, which then can be triggered with another power attack from the same style. :))

I'm afraid I can't offer any insight into the Jade Empire MDL/MDX format since I know very little about modeling.

Edit: Made some changes to fix incorrect assumptions and add some other things discovered.
Page: 1 of 9