1 (edited by jxsl13 2015-08-09 19:13:55)

Topic: Teeworlds {Code} Documentation

Hello dear communitee/s,

as teeworlds will maybe get a wider range of popularity due to the publication on steam,
I'd really like to see a better documentation about teeworlds itself as well as about the actual code, so that people get interested in playing with some changes in the code and maybe even use teeworlds as a base for learning c++ and/or c.

As there are a lot of capable coders in this community, I'd really love if lots of you could participate in order to improve the documentation.

As teeworlds mostly consists of three great parts: The map editor, the server and the client, the documentation should be split in these mayor categories.
Because lots of developers are rather specialised on either the server side or the client side or a few on the editor part, it's preferable that everyone with experience in his own category would choose it in his participation.

Furthermore, you needn't explain and describe everything you already did with whatever code is already vanilla teeworlds,
just pick an object from your category and explain what that object does, how it's arguments are filled and what it's functions/methods do, maybe what it is used for or even a small example.
Of course there are not only functions/methods that are bound to object.
For those you could also write a little explanation.
Those are of course only suggestions for those who would like to participate and help creating a kind of code wiki/ documentation.

Small basic overview of the teeworlds code, thanks to unsigned* char. Created with doxygen.

http://uptee.net/documentation/index.html

This is a documentation about how to add comments into the code in order for it to be parsed correctly as the documentation of the code:

The next part would be for the developers to add some commented documentation pull requests on github which follow the documentation syntax of doxygen.

There are several ways to mark a comment block as a detailed description:

You can use the JavaDoc style, which consist of a C-style comment block starting with two *'s, like this:

/**
 * ... text ...
 */

For the brief description there are also several possibilities:

One could use the \brief command with one of the above comment blocks. This command ends at the end of a paragraph, so the detailed description follows after an empty line.

Here is an example:

/** \brief Brief description.
 *         Brief description continued.
 *
 *  Detailed description starts here.
 */

If JAVADOC_AUTOBRIEF is set to YES in the configuration file, then using JavaDoc style comment blocks will automatically start a brief description which ends at the first dot followed by a space or new line. Here is an example:

/** Brief description which ends at this dot. Details follow
 *  here.
 */

Putting documentation after members

If you want to document the members of a file, struct, union, class, or enum, it is sometimes desired to place the documentation block after the member instead of before. For this purpose you have to put an additional < marker in the comment block. Note that this also works for the parameters of a function.

Here are some examples:

int var; /**< Detailed description after the member */

Most often one only wants to put a brief description after a member. This is done as follows:

int var; //!< Brief description after the member

or

int var; ///< Brief description after the member

For functions one can use the @param command to document the parameters and then use [in], [out], [in,out] to document the direction. For inline documentation this is also possible by starting with the direction attribute, e.g.

void foo(int v /**< [in] docs for input parameter v. */);

Note that these blocks have the same structure and meaning as the special comment blocks in the previous section only the < indicates that the member is located in front of the block instead of after the block.

Here is an example of the use of these comment blocks:

/*! A test class */
class Test
{
  public:
    /** An enum type. 
     *  The documentation block cannot be put after the enum! 
     */
    enum EnumType
    {
      int EVal1,     /**< enum value 1 */
      int EVal2      /**< enum value 2 */
    };
    void member();   //!< a member function.
    
  protected:
    int value;       /*!< an integer value */
};

For further and more detailed documentation:
http://www.stack.nl/~dimitri/doxygen/ma … locks.html

Thanks for your attention smile

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

2 (edited by Neox 2015-08-07 19:32:48)

Re: Teeworlds {Code} Documentation

Voted good. I would be glad to help people seeing clearer on server side codes. However I'd like to see an example first, to see how I should explain them.

while(!Success())
    TryAgain();
Try until you succeed.

3

Re: Teeworlds {Code} Documentation

I guess it not only needs documentation, but also some advice on how people can contribute to Teeworlds, how they can set up their build environment (I think the manual is outdated), what issues they can tackle, etc. Then we should probably work on pull request response time. hmm

4

Re: Teeworlds {Code} Documentation

Sounds good, why not use Doxygen? http://www.stack.nl/~dimitri/doxygen/ma … locks.html

5

Re: Teeworlds {Code} Documentation

I will set up a doxygen site in a while, maybe there will be contributors, and for now,
could someone try to pick a simple object or a static function ,
tell where it is declared,
explain it's attributes,
the constructor's arguments,
how it is used
and even maybe a small example of how to use it.

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

6

Re: Teeworlds {Code} Documentation

this is great , i think teeworlds is too hard but good for c++ learning as i was newbie on c++

join  my telegram group  teeworld players  :  https://t.me/teeworlds2019
Teeworld Developers group : https://t.me/teeworldsdev

7

Re: Teeworlds {Code} Documentation

Just a quick note on this as the teeworlds source already has some (yes, a tiny bit!) documentation (using NaturalDocs).

Choupom also refactored some code, which might be interesting: https://github.com/teeworlds/teeworlds/pull/1375

Additionally, I think most of the problems with teeworlds code are rather due to the lack of knowledge about games engineering than being able to read the code. An basic overview over the code structure and maybe a quick tutorial with a small project, which touches the game code, might be more useful than trying to document all the functions.

8 (edited by jxsl13 2015-08-14 13:01:51)

Re: Teeworlds {Code} Documentation

Choupom did a great job there, refactoring the code and making it more or less self-explaining, but why hasn't it been merged yet,I wonder.

Teeworlds [ friends ] clan
Some YouTube Stuff about Teeworlds

9

Re: Teeworlds {Code} Documentation

BeaR wrote:

Additionally, I think most of the problems with teeworlds code are rather due to the lack of knowledge about games engineering than being able to read the code. An basic overview over the code structure and maybe a quick tutorial with a small project, which touches the game code, might be more useful than trying to document all the functions.

I agree totally, atleast thats exactly the case with me.

10

Re: Teeworlds {Code} Documentation

This is a game and not the place to learn how to code.

Remember the 80s - good times smile

11

Re: Teeworlds {Code} Documentation

Oy wrote:

This is a game and not the place to learn how to code.

So rude. Teeworlds is an opensource game with a lot of developpers, if someone wants to practice here on this game (because he will have fun while learning), he is free to do it. It's not like coding in a really big game or getting a job and saying "hey I am here to code but idk how to code so I will learn with you !"

As the game is opensource and that people are free to edit it, they are MORE free to create a topic to help people about the teeworlds codes, even if people are new to development.

while(!Success())
    TryAgain();
Try until you succeed.

12

Re: Teeworlds {Code} Documentation

Oy wrote:

This is a game and not the place to learn how to code.

The Rust compiler is not a place for learning how to code either, but they still manage to have good documentation, easy build setup, and welcome developers.

CONTRIBUTING.md by the Rust compiler.
Compiling on Linux:

1) Install dependencies
2) ./configure
3) make

Same for Windows:

1) Install MSYS2, install dependencies (explicit commands given)
2) ./configure
3) make

You can't say the same for Teeworlds, where such issues are actively closed.

13

Re: Teeworlds {Code} Documentation

Oy wrote:

This is a game and not the place to learn how to code.

The reason to make a documentation is not to give people a place to learn how to code but to give (new) developers hints, information and an overview about the the project, its components and their functions.

There are many parts and circumstances in the project/in the code which purpose can not be comprehended on the first sight or might require further knowledge and understanding, thus they increase the difficulty to develop and maintain the code,  lead to blurring the boundaries of components and increase the probability to make mistakes, resulting to an even more unmaintainable code. Even for members of the developing team which should already know the code, this will be a great help.

So, my recommendation is to add more comments and a documentation to teeworlds in future commits, too.

14

Re: Teeworlds {Code} Documentation

This would be great.

I know how to code,  but I havent experience with great projects in c++, working on a poor documentated one would be hard for me, and I think I'm not alone.

www.steamcommunity.com/id/Th3V0iD
Contact: v0idpwn at gmail dot com

15 (edited by Schwertspize 2015-09-27 08:35:19)

Re: Teeworlds {Code} Documentation

you are not alone. I started learning c++ in theory by some books (because everything practical didn't work on my machine) and looked into the teeworlds Source. I was confused. luckily I had two big friends. the first, Tim, who told me where I should start looking into the server logic, and the second, grep, a powerful search tool.

what I want to say js, please first make a document where some basic game logic is explained (which file has which parts in it, where should beginners look into) and on the other side tag the code so you could easily find code with a search engine.

Having troubles finding servers in the serverlist? Go to Pastebin (its a referer cause there is daily a new pastebin) and add the lines to your settings.cfg (in %APPDATA%\teeworlds). Then open teeworlds and go to the favorites tab. (Note however, standard teeworlds client can only show 256 favorites, use ddnet instead)

16

Re: Teeworlds {Code} Documentation

Russia also want to coding in a teeworlds
My first post: *Klick*

17

Re: Teeworlds {Code} Documentation

Oy wrote:

This is a game and not the place to learn how to code.

You hate mods so much right?

I remember myself few years ago when I and a friend of me wanted to make a simple infection-like mod that I can now make for 5 minutes, but that time it was really hard for us, we didn't know where to begin, where to look for the right files and for the right code we needed, and we didn't get this done...

Orange is my faver color.
Orange and tangerine is my faver fruit.
I never get stuff done, just coz I'm lazy.

18 (edited by android272 2015-10-31 17:40:49)

Re: Teeworlds {Code} Documentation

Orangus wrote:
Oy wrote:

This is a game and not the place to learn how to code.

You hate mods so much right?

I remember myself few years ago when I and a friend of me wanted to make a simple infection-like mod that I can now make for 5 minutes, but that time it was really hard for us, we didn't know where to begin, where to look for the right files and for the right code we needed, and we didn't get this done...

Yah I don't see why this would not be great place to learn to code C/C++.  I know Java but I have never tried my hand at C/C++ and I would like to.  Why turn down people who are willing to help code?  If they learn something while doing so then that is great!  FOSS should never turn away people who want to learn and help out in your project. Learning is a major part of FOSS,  It is one of the reasons that Richard Stallman made the four freedoms. To hack and learn from others code.

Jesus is my Lord and Savior. Praise be unto God for giving us a way to live with him.

Check out my DeviantArt for all my TeeWorlds art and ideas for Teeoworlds

19

Re: Teeworlds {Code} Documentation

One of my friends (who I know in person, not just over the internet) is a decent programmer (can code in C/C++, Rust, tried doing assembly at one point) and I had told him about this game. He tried to make a modification of the game, nothing complicated.

He couldn't understand the code. That's why having documentation of what the code does and where certain things are handled would be very useful. Even if an expert can deduce what the code does on their own, it would save them a considerable amount of time if the code was already documented. The more pointless time doing nothing that it takes to begin contributing, the less likely people will contribute.

I've got two FNG maps which are close to ready for public release, hopefully they'll be on the forums soon! Aforementioned maps are on the back burner. Still doing mapping, but have higher priority map projects.
It should never take 45 seconds to download a map for anyone with a decent connection.

20

Re: Teeworlds {Code} Documentation

Well ah, where can we put the docs?

Orange is my faver color.
Orange and tangerine is my faver fruit.
I never get stuff done, just coz I'm lazy.

21

Re: Teeworlds {Code} Documentation

github wiki. it's the easiest way because we just have to write it, not to host it.

Having troubles finding servers in the serverlist? Go to Pastebin (its a referer cause there is daily a new pastebin) and add the lines to your settings.cfg (in %APPDATA%\teeworlds). Then open teeworlds and go to the favorites tab. (Note however, standard teeworlds client can only show 256 favorites, use ddnet instead)

22 (edited by Orangus 2015-11-15 21:27:50)

Re: Teeworlds {Code} Documentation

Do you mean this?
Or you do mean to make a separate third party wiki?

Orange is my faver color.
Orange and tangerine is my faver fruit.
I never get stuff done, just coz I'm lazy.

23

Re: Teeworlds {Code} Documentation

Something like this : https://github.com/savoirfairelinux/opendht/wiki

It can be host on any repo: https://github.com/teeworlds/teeworlds/wiki

But for code documentation, using comments and doxygen would be more appropriate.  (as the first post suggests)

24

Re: Teeworlds {Code} Documentation

I don't thing we should go for documenting code. we'd bette4 document an uml like model, the functions and the game logic. (like server start up, these void, then after startup every tick this one.....) and if we put it directly into the code you can't look for something and so on.

Having troubles finding servers in the serverlist? Go to Pastebin (its a referer cause there is daily a new pastebin) and add the lines to your settings.cfg (in %APPDATA%\teeworlds). Then open teeworlds and go to the favorites tab. (Note however, standard teeworlds client can only show 256 favorites, use ddnet instead)

25

Re: Teeworlds {Code} Documentation

We need a good tutorial series.

Tutorial 1

How to draw dickbutt with lasers.

Tutorial 2

How to change tee's skin and colors to the ugliest possible combination.

Tutorial 3

How to make everyone else's tee explode on touch.

I'm positive that this series will be a huge hit (if someone actually writes it).