VarsityPuppet

Random CSCI Adventures with VP

Recommended Posts

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!

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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#.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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? :D

 

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 

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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

It's a bit complicated with all of the comments

Not at all... quite contrary. It's much easier with the comments, in my programmer's opinion. :D 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.

Share this post


Link to post
Share on other sites

Not at all... quite contrary. It's much easier with the comments, in my programmer's opinion. :D 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...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.