Quantcast
Channel: CLion : A Cross-Platform IDE for C and C++ | The JetBrains Blog
Viewing all articles
Browse latest Browse all 682

Tips for creating games with Unreal Engine 4 in CLion

$
0
0

C++ game development is strongly linked with Unreal Engine 4, one of the most popular and widely spread C++ game engines. It is no surprise that we are getting lots of requests about UE4 setup within CLion. In this blog post we’ll share our own experience along with a couple of tips and useful links.

Background

The story started some time ago when one of our team members decided to try UE4. As you may know, CLion relies heavily on CMake project model, so it was crucial to get a CMake-based UE4 project. The official Linux-only CMake generator for UE4 projects had existed for some time, but it wasn’t perfect and more importantly, limited to Linux. Philipp Smorygo from the AppCode/CLion team investigated the source of this problem and contributed to Unreal Engine repository with his CMake + UE4 changes. You can read about his experience in his own blog.

While this approach worked, it still brought lots of performance problems. Mostly because the CMakeLists.txt used add_custom_target() commands for nearly everything, making it impossible for CLion to understand the project structure correctly. Also, with this approach CLion has to index and build symbols for the entire engine sources, not just necessary headers and source files, which leads to high CPU usage and really long initial project indexing stage.

Recently we found out some good work had been done by the community and decided to give UE4 another try. And guess what, things are much simpler now! There is even a 3rd-party plugin (thanks to our users!) that creates a fully flushed out CMakeList file for use with CLion, adding intellisense, compiler definitions, etc.

Setup

Short instructions on how to get started with UE4 in CLion:

  1. Get the engine
    • Register at Epic Games and download the Epic Games Launcher.
    • Run it and let it download all the necessary Unreal Engine 4 binaries for you.
    • Create or open your project with UE4 Editor to generate an *.uproject file.
  2. Get Mono
    • Download and install Mono to be able to launch on Linux and macOS.
  3. Get CLionSourceCodeAccess plugin for UE4
    • Download the plugin sources from GitHub.
    • Follow the instructions on the plugin’s wiki to setup the plugin. After the plugin is built, you’ll need to provide paths to C/C++ compilers, CLion itself and Mono:
      plugins_settings

      Then you can set it up as source code accessor:
      general_settings

  4. Now simply call Open CLion from the UE4 Editor menu. CMake project structure will be generated for you automatically on this step.
    open_clion_menu

Now you can use CLion for your UE4 project and enjoy all of its features!
ue4_nav

Plugin also generates custom targets for building and cleaning your game. Fake target is added for CLion needs to make all the intellisense possible.

Unreal Engine 4 SDK Support plugin

If you write games with UE4 in CLion, you may also find useful an Unreal Engine 4 SDK Support plugin from Philipp, our team member. To install it, go to Preferences/Settings | Plugins and Browse repository to search for it:
ue4_plugin

The plugin adds extra completion options for reflection specifiers, which CLion is unable to provide by default:
ue4_completion

Performance and known issues

Our experience shows that initial indexing time is acceptable, as the CMake project model generated this way allows CLion not to index and build symbols for the entire engine source, but only for necessary engine headers and source files.

Besides, recent CLion 2016.3 EAP build brought a significant performance improvement for reopening the project that was already indexed once in CLion. As our tests show it takes seconds instead of minutes on Unreal Engine sources themselves.

However, we still recommend that you increase the amount of memory used by CLion, or at least check the real usage by switching on the memory indicator (Preferences/Settings | Appearance & Behavior | Appearance | Show memory indicator).

As for the CLionSourceCodeAccess plugin, we’ve tested it on macOS. On Windows we’ve got an issue with building the plugin in Unreal Engine editor.

We’ll appreciate your feedback on the whole workflow and both plugins! Let us know in the comments section below.


Viewing all articles
Browse latest Browse all 682

Latest Images

Trending Articles



Latest Images