Qhimm.com Forums

Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: warnakey on 2006-11-28 22:39:03

Title: C Language
Post by: warnakey on 2006-11-28 22:39:03
Im a freshman in college and I just started a C Programming course.

I think Final Fantasy 7 was coded in C, so that really interested me in this forum.

I guess I should just say, Im a super newb at all of this and I was wondering if someone could give me an overview of how the hacking/modding/game design thing works.

I would like to get an idea of it so I could start to do some things on my own.

thanks
Title: Re: C Language
Post by: halkun on 2006-11-28 23:59:48
FF7 like Q-gears was programmed in C++. Your best bet is to look at some of the posts on something that you find intresting.

Most of what we do is experimentation. We observe, make a theory, test, and check the result. We do this a few thousand times and come up with a working model for the game.

If you are learning C, you should concentrate on file I/O and structs. Once you lean to read data into your program, you can then start doing cool stuff.

Oh and pointers.... You really need to make sure you have pointers down.
Title: Re: C Language
Post by: Cyberman on 2006-11-29 00:45:35
You should start with the hello world program.
This covers IO and pointers in one shot.

Code: [Select]
// This is the classic "hello World" program written in C
// Send to the console the text "Hello World"

// include standard library functions in order to use printf
#include <stidio.h>
#include <stdlib.h>
// main does not return error codes in this application, so return nothing (void)
// there are no command line parameters passed so we have an empty parameter list ( )
void main()
{
  // Send the text "Hello World" to the console
  printf("Hello World");
 // end the program
}
Things to think about this code,
The string "Hello World" is a constant the actual string is NOT passed to printf however.
printf is defined as a variable arguement function as such
Code: [Select]
int printf(const char *, ...);
Elipse is C mean that this function can accept a variable number of arguements.
Notice const char *.
char * <-- refers to a pointer to a string
const says it must be a constant (IE not a variable).
This means printf accepts as it's first parameter a pointer to a string constant.

So you are passing a pointer to a string to the printf function, and since you are not passing any more than just that, it sends the output of that string to a special file called, STDOUT also known as the console.  You can perform interactive IO with the console, but I don't recomend it since this is messy and complicated especially if you wish to obtain binary data (like that used in FF7).

A lot goes on in a simple program like hello world.  I suggest reading your textbook and writting a few programs to handle simple things.  If you are new to Computer Science, I suggest reading as much as possible about the principles of programming before writting code.  A good suggestion (technically it is a commandment as you might get a poorer grade if you don't do this) ALWAYS comment your code as to specifically what you are doing.  The comments are not for you, thus you should never assume whoever is reading them knows what you are talking about.  My comments aren't always the best but hopefully they'll give you a clue as to the things you should say and do in them.

Cyb
Title: Re: C Language
Post by: warnakey on 2006-11-29 02:13:55
well, it is a little confusing (Im going to have to check some dictionaries too, haha) but in all honesty thanks! We did do a version of the hello world!!! thing in class today (using Win32 code in visual studio.net 2005) I feel like the way I did it is much simpler!

But I am going to do what you said and experiment. Thanks for your reply guys. If you can think of any other stuff you have the patience to explain I would appreciate it a lot!!

thanks - eric