Locate sample

Dev environment around Planet Centauri

This page is mainly aimed at developers, and explains in detail the tools used to develop Planet Centauri.

As for the technologies used in the game engine, see this page.

Linux and C++

First of all, I develop the game under Linux. This may seem strange to those who don’t know, but Linux is generally much simpler and more suitable for C++ development than windows.

It natively integrates development tools, and has a powerful package manager that allows you to install libraries in a single line. This is usually hard under windows, not to mention all the binaries compatibility problems that may require compiling yourself the libraries.

The GCC compiler respects the C++ standard much more (and much faster) than MSVC the C++ compiler made by microsoft.

All the tools I use to develop Planet Centauri are free, and therefore generally supported on multiple platforms.

IDE

To write my code I use the IDE Qt Creator, which is written in C++, very optimized and powerful.

It supports many features like refactoring, live error preview, has a good integration of the debugger GDB, many plugins, themes…

Code sample
A dark theme is a must when you code a lot.

QTC’s locate console is very powerful.
It allows you to locate any file in the project with a simple shortcut (F2 for me). This becomes quickly necessary when the project starts to have dozens of files.

Locate sample
Quickly access a file with ‘locate’.

It also allows you to search for a class, a function, a symbol, execute commands…

Locate sample
The QTC ‘locate’ console.

QTC allows you to cut your working window the way you want, and offers many widgets, such as the open file list which replaces the traditional tab system, and is much cleaner/practical.

Open files
The ‘Open documents’ widget.

Other essential features:

  • CMake project integration
  • Compilation kits (allows to manage several compilers or configurations)
  • Git integration
  • Bookmark system for quickly navigating between multiple code markers
  • Integrated ‘perf’ performance analyzer
  • Built-in ‘Valgrind’ memory analyzer
  • Powerful plugin system


Compiler

I use GCC on Linux, MinGW to compile on windows an Clang on mac.

CMake

Unlike some IDEs such as codeblocks, QTC uses a standard system to define and configure its projects. QTC will be able to build the tree structure of the project files, and manage the dependencies just with a CMakeLists.txt
This will also allow to compile the project outside the IDE, and thus to compile on multiple platforms easily.

Git

Git is a powerful version management software that allows you to memorize each state/version of your project code quite easily. It’s a must as soon as you need to work with several people on the same code base, and allows you to easily go back when you make an irreparable error.

Being alone I use it mainly to track every code modification I make, like bugfixes, adding features, or keeping track of game versions.

Perf

Perf is a powerful analysis software mainly used to evaluate the performance of your code.

It is natively integrated in QTC and allows you to easily visualize the performance of the program with beautiful graphics: ‘Timeline’, ‘Flamegraphe’ and ‘Statistics’

Code sample
Flamegraphe.

It can also be used outside the IDE with the command line interface, or with software like Hotspot to visualize the data in a nice UI.

Clang-tidy

Clang-tidy is a clang-based static code analysis tool. It has the particularity of being directly integrable in QTC via a plugin, with real-time visualization of problems. It is fully configurable and works perfectly but be careful, some options can make it heavy in performances.

CppCheck

Like Clang-tidy, CppCheck is a static code analysis tool. It allows to easily detect errors that even some compilers do not detect. It is especially useful when starting in C++ and helps to avoid many common errors. It can be integrated directly into QTC as an experimental plugin which doesn’t work very well, so it is more efficient to use it outside the IDE.

Under Ubuntu and derivatives just type the following command to install it:

sudo apt-get install cppcheck