1

Topic: Reading the source code

My target before programming teeworlds mods und clients was understanding the hole source code, so i wanted to read it. but i've got a problem. I don't knwo where i have to start reading. Can anybody help me and give me the order of files i have to read the source code. thanks,     .wTf!*

2

Re: Reading the source code

I hear you have to start at the beginning of the code and read it like a book.

3

Re: Reading the source code

Maybe src/engine/server/server.cpp is a good beginning.

4

Re: Reading the source code

Forgive me if I'm wrong but I think that it doesn't really have a begining or an end. It's just source files connected with each other.

I guess you could start with the engine.

Once in a century...

5 (edited by TeePhoenix 2012-06-10 17:19:43)

Re: Reading the source code

Deleted.

The face of terrorism is called United States of America!

6

Re: Reading the source code

Elite Tee wrote:

Forgive me if I'm wrong but I think that it doesn't really have a begining or an end. It's just source files connected with each other.

I guess you could start with the engine.

There is a beginning and an end. Actually two possible beginnings, first one for the client and second one for the server.

This is the beginning:

int main(int argc, const char **argv) // ignore_convention

And here is the end:

    return 0;
}

Although, you should more have a global view of the code, how the modules are linked to each other rather than trying to read it like a book, it's impossible to, unless you actually are a machine.

Not Luck, Just Magic.

7 (edited by TeePhoenix 2012-06-10 17:19:35)

Re: Reading the source code

Deleted.

The face of terrorism is called United States of America!

8 (edited by Dune 2011-10-18 19:26:21)

Re: Reading the source code

TeePhoenix wrote:

To do this, you need a good documentation. Is there any? If not, you have just to start and try to understand what the programmer did. If you are unlucky, you have to read the whole source code to get an idea about what goes on.

int main(int argc, const char **argv) // ignore_convention

What do you want to say with the comment at this line?

There is no real documentation on how the code is structured afaik. About the code, I just copied the main from the Teeworlds code, it's not my commentary.

Not Luck, Just Magic.

9

Re: Reading the source code

TeePhoenix wrote:
int main(int argc, const char **argv) // ignore_convention

What do you want to say with the comment at this line?

He just copied it from the teeworlds code. The // ignore_convention prevents the script scripts/refactor_count.py from reporting the names main, argc and argv as un-refactored, as the new style would require them to be Main, Argc and ppArgv.

10

Re: Reading the source code

heinrich5991 wrote:

He just copied it from the teeworlds code. The // ignore_convention prevents the script scripts/refactor_count.py from reporting the names main, argc and argv as un-refactored, as the new style would require them to be Main, Argc and ppArgv.

Why would you write Main in caps? It's a function, the convention about that is lowercaps, right?

Not Luck, Just Magic.

11 (edited by TeePhoenix 2012-06-10 17:19:13)

Re: Reading the source code

Deleted.

The face of terrorism is called United States of America!

12

Re: Reading the source code

Dune wrote:
heinrich5991 wrote:

He just copied it from the teeworlds code. The // ignore_convention prevents the script scripts/refactor_count.py from reporting the names main, argc and argv as un-refactored, as the new style would require them to be Main, Argc and ppArgv.

Why would you write Main in caps? It's a function, the convention about that is lowercaps, right?

Yes, but the teeworlds convention is to write CamelCase names, which the main function can't sufice, for the reasons you gave. And because of the teeworlds convention which doesn't apply for this function, there is a comment that this line should be ignored when checking for teeworlds convention. smile