VarsityPuppet 1,085 Posted January 27, 2014 Welcome to Random Tool Adventures with VP, where I will be investigating the file formats used for both KOTOR games to sort of de-mystify some file formats or "under-the-hood" sort of things. The purpose of this is to eventually make some usable tools for this silly game in which, unlike KOTORTool, we can make mass changes all at once and stuff like that. Also, anyone is welcome to share any Day 1: Did a little investigating with the GFF file format with Biowares official GFF debrief. I figured out how to find the offsets I'm looking for! OH man, this is gonna be cool! Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 27, 2014 Welcome to Random Tool Adventures with VP, where I will be investigating the file formats used for both KOTOR games to sort of de-mystify some file formats or "under-the-hood" sort of things. The purpose of this is to eventually make some usable tools for this silly game in which, unlike KOTORTool, we can make mass changes all at once and stuff like that. Also, anyone is welcome to share any Day 1: Did a little investigating with the GFF file format with Biowares official GFF debrief. I figured out how to find the offsets I'm looking for! OH man, this is gonna be cool! OH MY GOSH!!! VP, I've been working on this awhile myself, with the exact same goal!!! Want to team up on it? I've got a pretty good grasp on the formats for the GFF and 2DA, and am most of the way toward de-coding the TLK format... Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 28, 2014 Ultimately depends on what we're doing. I just want to build some tools that will make module creation easier. This involves mostly GFF files. I suppose if it comes down to it, being able to modify 2da/TLK files (like for installation purposes) then I could see a team up occurring. One of the main things I don't like about the current resources for GFF files is that they're in Perl, which I don't even understand. I suppose it would be useful to learn it, but I want to get practice writing my own reader class. A GFF Reader, a Rim/Erf reader/packer. And then of course, eventually, some sort of map editor. That'd be cool, I think. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 28, 2014 Ultimately depends on what we're doing. I just want to build some tools that will make module creation easier. This involves mostly GFF files. I suppose if it comes down to it, being able to modify 2da/TLK files (like for installation purposes) then I could see a team up occurring. One of the main things I don't like about the current resources for GFF files is that they're in Perl, which I don't even understand. I suppose it would be useful to learn it, but I want to get practice writing my own reader class. A GFF Reader, a Rim/Erf reader/packer. And then of course, eventually, some sort of map editor. That'd be cool, I think. No worries, VP. I meant to team up with mapping out the formats and then going from there. I plan to make a special TLK tool once I am able to save, create, and edit a .tlk through programming... It came about as I discovered that there's really no way to mimick TSLPatcher's memory with 2da entries with TLK ones(ie: appending an entry and setting a variable so I can map the new entry number into another file...) The map editor...I think I could help with that eventually. I also plan on an interactive GFF merger tool. Quote Share this post Link to post Share on other sites
Vriff 21 Posted January 28, 2014 What language(s) will you be writing your tools in? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 28, 2014 What language(s) will you be writing your tools in? I'll be using Perl. VP I imagine Java. VP, your thoughts on this? Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 29, 2014 Actually, C# probably. The form builder is generally much easier to use. The Form Builder Plug-in for Eclipse is rubbish I hear, but I could still try it. It'll probably end up being C#. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 29, 2014 Actually, C# probably. The form builder is generally much easier to use. The Form Builder Plug-in for Eclipse is rubbish I hear, but I could still try it. It'll probably end up being C#. Oh, so I have half a chance of reading it? I can somewhat read Java code and can at least tell you what it's doing, but my area is Perl. I plan on going to a community college and then transferring to a four-year to get a bachelor's. For now though, I'm self-taught... Quote Share this post Link to post Share on other sites
Vriff 21 Posted January 29, 2014 Will your tools be open source? Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 29, 2014 Will your tools be open source? Sure, why not? Although, I'm not sure if you'd want to be learning code from my example... Oh, so I have half a chance of reading it? I can somewhat read Java code and can at least tell you what it's doing, but my area is Perl. I plan on going to a community college and then transferring to a four-year to get a bachelor's. For now though, I'm self-taught... C# and Java are fairly similar when it comes down to it. It's nothing like Perl (I'm guessing since my look at Perl was fairly devastating and confusing. Quote Share this post Link to post Share on other sites
Vriff 21 Posted January 29, 2014 Sure, why not? Although, I'm not sure if you'd want to be learning code from my example... I know C++ & C, so I'd be interested seeing some real functional C# code, I don't have much practical coding experience, just academically. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 30, 2014 C# and Java are fairly similar when it comes down to it. It's nothing like Perl (I'm guessing since my look at Perl was fairly devastating and confusing. A part that would/is confusing for people knowing C(or one of its variants) is that Perl only has two variable groups: Global(our $variable;) and lexical(my $variable1). The '$' sign is Perl's Scalar, one of three data types, that is a string, integer, float, or in the case of OO programming, an object. There's no distinction between them, except what you put in them. The other two are arrays(@variable), a list data type, and a hash(%variable), which contains key-value pairs. Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 30, 2014 A part that would/is confusing for people knowing C(or one of its variants) is that Perl only has two variable groups: Global(our $variable;) and lexical(my $variable1). The '$' sign is Perl's Scalar, one of three data types, that is a string, integer, float, or in the case of OO programming, an object. There's no distinction between them, except what you put in them. The other two are arrays(@variable), a list data type, and a hash(%variable), which contains key-value pairs. Sounds kind of confusing - although if I just took the time to learn Perl, I'm sure it would be easy enough. Not gonna lie, I'm mainly using C# because of the amazing form builder they have. Most people are running on Windows anyways so I'm not real worried about Java at all. The only caveat I've been running into recently is that I only have Visual Studio on my desktop computer and my Mac doesn't have enough room to install it on my BootCamp installation. Although, as I'm typing this up, I've run into some nice options for C# development on Macs. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 30, 2014 Sounds kind of confusing - although if I just took the time to learn Perl, I'm sure it would be easy enough. Not gonna lie, I'm mainly using C# because of the amazing form builder they have. Most people are running on Windows anyways so I'm not real worried about Java at all. The only caveat I've been running into recently is that I only have Visual Studio on my desktop computer and my Mac doesn't have enough room to install it on my BootCamp installation. Although, as I'm typing this up, I've run into some nice options for C# development on Macs. Well, I'm debating between using Win32::GUI(a perl module/library that allows one to interact with the GUI) and Tk(a perl port of the tcl-TK gui language) for my programs. On the one hand, Win32 route would allow for a Windows feel, since it would have the same layout as Windows Gui elements(dialogue boxes, forms, windows with tabs, dropdown boxes, .etc) and would automatically use the user's current theme. On the other hand, Perl/Tk I'm familiar with and the OO(Object-Oriented) syntax is easy to get used to. P.S: I'm explaining these technical terms for the benefit of those who don't know programming, VP. Heck, as it is, I learned KotOR scripting before I learned Perl. In fact, KSE is the entire reason why I learned programming in the first place! So KotOR has a special meaning for me in the coding department... Quote Share this post Link to post Share on other sites
LiliArch 115 Posted January 30, 2014 Sorry about putting my nose in here, but... Perl sounds interesting. Is it much different than PHP? Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 30, 2014 Sorry about putting my nose in here, but... Perl sounds interesting. Is it much different than PHP? Perl's website Beginning Perl I don't know about PHP, to be honest. Perl can be used for a variety of tasks, from GUIs, phonebooks, text-editing programs, website building, and once someone built a minimalistic OS using Perl and working off a Linux Kernel(But they never released it...). In fact, the site PerlMonks(basically the help-desk forum for Perl questions) was written entirely with Perl... Here's an example of Perl code that does something simple, like having a phonebook(without the OO-code necessary for a GUI or anything): #This is a comment line my %book=qw( # I set up the hash; qw() is a function that separates elements at whitespace(any blank spaces) "Ed" "503-830-2592" "VP" "417-920-5972" "SH" "971-492-0843"); # Finish the hash and close it off with a semi-colon*. print "Type the name of the person you want to get ahold of:\n"; # Prints a line of text to the command prompt and the \n on the end is the same as hitting Enter. my $person = <STDIN>; # This is a filehandle for the input from a command prompt. The program will wait until I type something in and hit Enter. chomp $person; #Removes the \n that STDIN adds print "$person" . "'s phone number is: " . $book{$person} . "\n"; # The . in this is similar to Kotor's +, linking the data into a single string. You have to use a $ to access a hash or array element. In this case, I accessed the data for the person, as typed in the hash above. It's a bit complicated with all of the comments, but it's a simple program, didn't even have to use any libraries. Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 30, 2014 Sorry about putting my nose in here, but... Perl sounds interesting. Is it much different than PHP? By all means, input away! This is what the thread is about. Man, that Perl still looks confusing. Anywho, managed to get a C# IDE running on Mac (sweet!). I had to install some frameworks and I can't build any Windows Forms, but I think I can create a repository on my Mac and my Desktop, thus using the Desktop to make my forms. Most of the parsing code is separate anyways, so it should be a breeze. As I always tend to forget, I had to look up the code to read the binary of a file and store it in a byte array. Might not be the best way to pull this off in the end, but for the sake of experimenting, this is how I'll do it. I'd much rather, as I read the file, keep track of all of the offsets and where everything is located, but I suppose I need to be able to generally map out the header and go from there. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 30, 2014 By all means, input away! This is what the thread is about. Man, that Perl still looks confusing. Anywho, managed to get a C# IDE running on Mac (sweet!). I had to install some frameworks and I can't build any Windows Forms, but I think I can create a repository on my Mac and my Desktop, thus using the Desktop to make my forms. Most of the parsing code is separate anyways, so it should be a breeze. As I always tend to forget, I had to look up the code to read the binary of a file and store it in a byte array. Might not be the best way to pull this off in the end, but for the sake of experimenting, this is how I'll do it. I'd much rather, as I read the file, keep track of all of the offsets and where everything is located, but I suppose I need to be able to generally map out the header and go from there. The link I sent you in a note had pdfs on the formats, headers included... Quote Share this post Link to post Share on other sites
Vriff 21 Posted January 31, 2014 Perl's website Beginning Perl I don't know about PHP, to be honest. Perl can be used for a variety of tasks, from GUIs, phonebooks, text-editing programs, website building, and once someone built a minimalistic OS using Perl and working off a Linux Kernel(But they never released it...). In fact, the site PerlMonks(basically the help-desk forum for Perl questions) was written entirely with Perl... Here's an example of Perl code that does something simple, like having a phonebook(without the OO-code necessary for a GUI or anything): #This is a comment line my %book=qw( # I set up the hash; qw() is a function that separates elements at whitespace(any blank spaces) "Ed" "503-830-2592" "VP" "417-920-5972" "SH" "971-492-0843"); # Finish the hash and close it off with a semi-colon*. print "Type the name of the person you want to get ahold of:\n"; # Prints a line of text to the command prompt and the \n on the end is the same as hitting Enter. my $person = <STDIN>; # This is a filehandle for the input from a command prompt. The program will wait until I type something in and hit Enter. chomp $person; #Removes the \n that STDIN adds print "$person" . "'s phone number is: " . $book{$person} . "\n"; # The . in this is similar to Kotor's +, linking the data into a single string. You have to use a $ to access a hash or array element. In this case, I accessed the data for the person, as typed in the hash above. It's a bit complicated with all of the comments, but it's a simple program, didn't even have to use any libraries. I've written similar programs and it definitely looks less syntax-heavy than C++, interesting. Quote Share this post Link to post Share on other sites
VarsityPuppet 1,085 Posted January 31, 2014 Well, I've got it parsing the Header perfectly! The code is nice and concise, although the code to write it to the console is somewhat lengthy... not that it'll be there in the long run.. eh, maybe I could leave it there. Next up is reading the other data structures in the file. I'd look at them now, but it's pretty late and I'm sleepy. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted January 31, 2014 Well, I've got it parsing the Header perfectly! The code is nice and concise, although the code to write it to the console is somewhat lengthy... not that it'll be there in the long run.. eh, maybe I could leave it there. Next up is reading the other data structures in the file. I'd look at them now, but it's pretty late and I'm sleepy. Yay! Progress is coming! Yeah, I should be heading to sleep soon too... It's 11:37pm here, so I imagine it's close to 2:39am over with you VP. And I've got school tomorrow... Ah, the lament of nighttime projects, no? Quote Share this post Link to post Share on other sites
LiliArch 115 Posted January 31, 2014 It's a bit complicated with all of the commentsNot at all... quite contrary. It's much easier with the comments, in my programmer's opinion. Accordinc to the installation readme file, PHP can be used to make GUIs also, though I've never tested it... and it can be run from command line. Well, written in PHP the same script would be something like that... // This is a one-line comment /* This is a comment block, it can have multiple lines, just remember to close it (closing on next line) */ $book = array( // Let's use array here, it seems to be closest to hash "Ed" => "503-830-2592", // "key" => "value", remember to put , in the end or pair, or it crashes... "VP" => "417-920-5972", "SH" => "971-492-0843", ); // And close array with ); ... pretty common in most programming languages I've used. print "Type the name of the person you want to get ahold of:\n"; // As we're working command line... $person = stream_get_line(STDIN, 1024, PHP_EOL); /* There's a simpler command for that, but it doesn't work on Windows systems. * I'm not really sure about even that, just found it from php.net... should read user input. * I've never actually used PHP on command line, just web stuff, so bear with me... */ print "$person" . "'s phone number is: " . $book[$person] . "\n"; /* Because our $book is an array, we need to use [(array key)] to get the right value. * As we have stored the key into $person variable, we simply put that between [ and ] ... */ Looks pretty similar to Perl to me. And now I think about that, PHP has Perl-compatible regular expressions... siblings, obviously. Quote Share this post Link to post Share on other sites
Fair Strides 509 Posted February 1, 2014 Not at all... quite contrary. It's much easier with the comments, in my programmer's opinion. Accordinc to the installation readme file, PHP can be used to make GUIs also, though I've never tested it... and it can be run from command line. Well, written in PHP the same script would be something like that... // This is a one-line comment /* This is a comment block, it can have multiple lines, just remember to close it (closing on next line) */ $book = array( // Let's use array here, it seems to be closest to hash "Ed" => "503-830-2592", // "key" => "value", remember to put , in the end or pair, or it crashes... "VP" => "417-920-5972", "SH" => "971-492-0843", ); // And close array with ); ... pretty common in most programming languages I've used. print "Type the name of the person you want to get ahold of:\n"; // As we're working command line... $person = stream_get_line(STDIN, 1024, PHP_EOL); /* There's a simpler command for that, but it doesn't work on Windows systems. * I'm not really sure about even that, just found it from php.net... should read user input. * I've never actually used PHP on command line, just web stuff, so bear with me... */ print "$person" . "'s phone number is: " . $book[$person] . "\n"; /* Because our $book is an array, we need to use [(array key)] to get the right value. * As we have stored the key into $person variable, we simply put that between [ and ] ... */ Looks pretty similar to Perl to me. And now I think about that, PHP has Perl-compatible regular expressions... siblings, obviously. I'd need to re-research it, but I believe PHP came about as a result of Perl, and was mainly specialized for interacting with the web. Don't quote me on that, but I'm sure it's close to what I read... Quote Share this post Link to post Share on other sites
Vriff 21 Posted February 1, 2014 I'd need to re-research it, but I believe PHP came about as a result of Perl, and was mainly specialized for interacting with the web. Don't quote me on that, but I'm sure it's close to what I read... Pretty much, not just Perl though, influenced heavily by C also. Quote Share this post Link to post Share on other sites
LiliArch 115 Posted February 4, 2014 I believe you are right, and it is of course mainly meant to use for web applications. But it can be used elsewhere, although it might need a different build. Anyway, my main point was simply that I suppose I shouldn't find learning Perl too hard, as I have worked with PHP. Which means I might be able to understand something about your source codes... Quote Share this post Link to post Share on other sites