How to contribute code

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chuckeles
:warning: Old Version Published before Godot 3 was released.

The backstory

I’m a programmer. I found about the Godot engine, tried it and thought it was awesome. Just a little rough around the edges.

Here come the problems

So I thought that as a programmer I could contribute. I have an experience with C and C++. So I forked and pulled the repository and compiled it no problem. Then I took a look into the codebase and became overwhelmed and confused.

I looked for information about contributing and here’s what I was able to find:

  • there are the docs which mainly talk about creating issues and writing the class reference
  • there is CONTRIBUTING.md in the repository which provides some points:
  • please make sure that the functionality is desired
  • you talked to other developers about it
  • almost 800 issues on Github which is a little scary to me :smiley:
  • there’s also the roadmap on Trello but it looks like it’s mostly for the developer team

My point is this

Say I want to just move the code completion popup in the editor because it usually blocks my code and is in the way. The first and foremost, even finding where this functionality is written in the code is so difficult because there are no comments, so I have to rely on Find Reference, Find Implementation and other tools to look for the code.

Second thing, I don’t know if this functionality is desired. How do I find out? It’s just a small thing that frustrates me. Do I just code it and open a pull request? Or yet another issue?

The question

If there are any programmers reading this, how do you contribute code to the Godot engine? I want to help so much, but I just don’t know where to start really.

:bust_in_silhouette: Reply From: Akien

Godot indeed has a huge code base, and not many comments. This can seem daunting at first, but once you get familiar with the code base, it makes a lot of sense; the “core” of Godot is not so big, the various “servers” the core talks to are well split, and the scenes and resources all follow a similar structure (and the files organization reflects that to some extent).

To start, I would have a look at the developer-oriented documentation.

Then your approach is good. Find something that bugs you, and try to fix it. I see several steps that would be worth doing to start:

  • Check in the GitHub issues if this bug is reported already, and what people have been saying about it. As you say, there are 800 open issues, so it’s likely that what bugs you has already be mentioned and discussed by users; but not fixed yet. GitHub’s search function is a bit rough as it doesn’t support wildcards and stuff like that, but you should be able to find some stuff.
    Make searches with simple words, try both singular and plural to make sure you don’t miss stuff. E.g. if I search for “tooltip”, if find interesting things related to your problem:

    The second one is likely the nearest to your issue, but the other ones might be interesting for you too if you want to have a go at fixing them while browsing the tooltip-related code. Check the other matches, and maybe matches for the plural “tooltips” for more issues.

  • Discuss the bug/feature on the relevant issue, or a new issue if it’s about a new topic, or IRC (#godotengine-devel), etc. You’ll likely find contributors to discuss it with you, maybe give hints about the relevant part of the code, or ideas on how to implement the needed fix (especially Juan/reduz often has good ideas as he wrote most of the code base).

  • To find the relevant piece of code to edit, you’ll of course need to get familiar with the code base little by little. I often use ack to search strings in the whole code base and see if I see anything that goes in the right direction. I would try e.g. ack tooltip, so it will probably give many results; ack -l tooltip would give only the file names, so you can easily see if one has a more meaningful name than others (e.g. tools/editor/plugins/script_editor_plugin.cpp might be an interesting match).
    Or if you use a specific IDE, it probably has cool features to achieve similar results; I’m just an old bash bear jumping first on the command line before trying something more elaborate :wink:

In doubt, just ask. You’ll quickly learn to understand Godot’s code base and that it’s relatively easy to make changes such as the one you described.

Also, another great way to learn Godot’s code base is to review new commits, to see how a given bugfix/feature was implemented, what files were changed, etc. “Watching” the issues on GitHub is also great to get familiar with Godot’s code, as you’ll get notified of all new pull requests, etc.; there’s a bit of traffic though, it kind of depends on how much free time you have for this.

Thank you for a comprehensive answer, this is exactly what I needed!

chuckeles | 2016-03-03 15:37

Thanks to you I’ve created my first every pull request! Completion tooltip by martindzejky · Pull Request #3910 · godotengine/godot · GitHub

chuckeles | 2016-03-03 20:12

Excellent, this has bugged me for a while! I totally agree that the tooltip gets in the way, so this looks like an improvement. Would be great to have a “distance” setting in the editor settings to customise exactly how many pixels above or below the current line it should be. And congrats on your first commit :slight_smile:

zendorf | 2016-03-04 01:51