JetBrains Rider - Now for Unreal Engine

Hi Habr!

Last week, after the releases of version 2020.1, another major event happened for all our desktop products - we opened public access to the trial version of Rider for Unreal Engine . At the moment, this is a separate product, a version of our development environment for Rider, but with support for C ++ and Unreal Engine. So stop it! C ++ development environment. One more?! Let's sort it out in order.

Rider for unreal engine



Let's start with a little story. A few years ago, we gathered everyone who makes C ++ tools at JetBrains to discuss how difficult it is for users to navigate the variety of our offers. After all, there is CLion, ReSharper C ++, and support for C ++ in AppCode. After several hours of discussion, we came to the following conclusions:

  • Although the universal tool looks tempting, with the expansion of targeting, the increase in the number of integrated third-party tools, supported use cases, it becomes very difficult to find a balance between the convenience, intuitiveness of the interface and the abundance of opportunities.
  • The world of software development has long had no clear boundaries in development languages. Many projects are multilingual. More important is the scope of the software and technologies that are used in it.

As a result, we decided to unify the user experience in our tools for C ++, but agreed that the approach to make different tools (albeit with a common kernel or on a common platform) for different areas of software development is the right one. In practice, it looks like this:

  • CLion — C C++. , , , AI, , . , , ( CMake, Gradle Native, compilation database, Bazel, Makefiles) . , , CLion msbuild, , .
  • ReSharper C++ — , Windows, , Visual Studio. C++ C#. Visual Studio, ReSharper, C++.
  • AppCode — , iOS/macOS. C/C++ mac- .

So, what does the Rider have to do with it? What is the cross-platform development environment for .NET related to C ++? In practice, about 30% of Rider users are game studios and game development companies. It is understandable, because Rider is largely popular precisely as a development environment for Unity . This is not the first year that the Rider team has been customizing an instrument specifically for this game engine. The result is liked not only by Unity programmers, but also by Unity Technologies themselves, with whom we have long and fruitfully interacted in terms of technology itself.

Going to many of our users in the field of game development, we noticed that many studios do not have a clear separation - make games only on Unity or only on Unreal Engine. Today they play on one technology, and tomorrow on another, or one team uses the Unreal Engine, and the other Unity, or even its own custom engine. It’s clear that developers and companies in general really don’t like to “jump” between different development environments. And here we decided that if we could make Rider successful for Unity, then we can go further and make it successful in general for the world of game development. So the idea of Rider was born as a universal development environment for Game Dev .

What Rider for Unreal Engine consists of


The further development of events is quite obvious for those who are familiar with the technology on which the Rider is built. Rider consists of a front-end part based on the IntelliJ platform and a back-end part based on ReSharper. All language support works on the back-end. Therefore, we just connected the existing C ++ and Unreal Engine support in ReSharper C ++ to Rider using the same technology. From the specific, I had to additionally implement:

  • Plugin for selecting Rider as a development environment in Unreal Editor ( Rider Source Code Access ) for engine versions 4.22-4.24. Starting with version 4.25, this functionality will already be included in the UE engine itself.
  • UnrealLink plugins for Rider and RiderLink for Unreal Editor, which provide integration with Blueprints in Rider and are generally responsible for communication between Rider and Unreal Editor.
  • Debugger

It is worth noting that now the preview of Rider for Unreal Engine is available only on Windows, opens .sln files and relies on the build by the compiler from Microsoft. In the future, by the time of release, we will try to expand to all three platforms and implement support for .uproject as the main design model.

LLDB based debugger


A significant part of game development is happening now on the Windows platform and as part of the Microsoft toolchain. If we look at what debugging tools exist for code compiled using the Microsoft Visual C ++ compiler, we will see:

  1. Microsoft uses debugging tools based on vsdebugeng.dll in its own tools . The license does not allow the use of these tools in third-party development environments.
  2. CDB WinDbg dbgeng.dll. MS . (.pdb), , , .
  3. There were also developments in the LLVM community for debugging support for the Visual Studio toolchain using LLDB. We used them, and just a year and a half wrote the first version of a generally working debugger. It includes initial and still raw support for the NatVis format (such MS-specific pretty printers). At the same time, Rider for Unreal Engine now finds NatVis in the project on Unreal Engine and loads them to the debugger. We are now using the same debugger in CLion for the Visual Studio toolchain (it is enabled by default in this case starting from version 2020.1).

The new debugger is still damp, of course, it still has significant problems and slowdowns. But we hope to bring it to mind for release.

C ++ Support


I repeat - all the language support functionality from ReSharper C ++ is now available in the Rider for Unreal Engine Preview. It includes:

  • About 170 different code inspections and over 50 quick fixes.
  • Refactors that take into account all contextual uses of a symbol (renaming, changing the method signature, method removal, adding a field / variable / typedef, substituting (Inline) a variable or typedef, and others).
  • Code generation (getters / setters methods, constructors, comparison operators, code documentation templates).
  • Actions to help write code, navigation, formatting and support for naming styles, sorting #includedirectives.

Generate action

Support for HLSL, C #, uproject / uplugin dialects


This year, we started working on language support for writing HLSL shaders in ReSharper C ++ , and it immediately got into the early preview of Rider for Unreal Engine. Support includes syntax highlighting, tooltips with documentation, tooltips for parameter names and types, navigation actions, auto-completion, support for virtual file paths, and even refactoring.

Since Rider for Unreal Engine is based on the development environment for .NET, language support works in both Build.cs and Target.cs files.

And finally, when it comes to supporting language dialects, Rider for Unreal Engine understands dialects of .uproject / .uplugin files, providing options for auto-completion and documentation tools.

uproject dialect

Blueprints Integration


Blueprints files are binary data that is usually edited in a visual editor inside the Unreal Editor. The objects in these files are inherited from classes in C ++; they redefine the properties from the C ++ part of the game. And here Rider for Unreal Engine is that unique development environment that reads out all the necessary Blueprints files and shows these links in the C ++ code editor:

BP derived classes

If you change, for example, the value of the property in the Unreal Engine editor and save the asset, then the value here it will also automatically update in Rider (we have watchers hung to change asset files):

BP properties

Without saving the files, we hope this will work soon too (preparation for this is now being done in the UnrealLink plugin).

The Find usages call includes not only uses in C ++ code, but also Blueprints files. Double-clicking on such uses opens the Unreal Editor.

Understanding the reflection mechanism of UE4


Reflection in Unreal Engine is implemented using special macros (UCLASS, UFUNCTION, UPROPERTY, etc.). Rider knows that the parameters of such macros are not just text. The C ++ parser in ReSharper C ++ and Rider can really “understand” the meaning of these macros without even launching the Unreal Header Build tool (that is, before the contents of the .generated.h files are actually generated ).

By the way, speaking about .generated.h files , ReSharper C ++ and Rider know that automatically added missing #include directives must be inserted strictly before connecting .generated.h files . And also take into account these generated files in renaming refactoring.

Returning to the reflection mechanism, it is worth saying that reflection specifiers are not just text in ReSharper C ++ and Rider. There is auto-completion and documentation hints for them:

Reflection doc

Documentation hints are also available for reflection macros themselves.

And the code analyzer checks the use of reflection macros and indicates the errors associated with this. For instance:

  • UCLASS classes must be publicly inherited from UObject or any of its descendant classes. Moreover, such a parent must be exactly one.
  • UCLASS specifiers should be used for classes, USTRUCT for structures.
  • UE4 classes cannot be declared inside other classes.
  • Objects stored in fields not marked UPROPERTY can be collected at any time by the garbage collector.

Remote Procedure Call (RPC) support for navigation and code generation actions


If we consider the calls of remote procedures from the point of view of a regular C ++ parser, then quite quickly you will notice the parser's ignorance that several functions with different names (for example, suffixes _Validateand _Implementation) can correspond to a function declaration . In ReSharper C ++ / Rider, we have trained a parser to identify RPC over specifiers Client, Serverand NetMulticastin the macro settings UFUNCTION. Thereby:

  • The navigation offers all the necessary options for implementing the function.
  • Code generation can create functions with suffixes _Validateand _Implementationor only those that are missing:
    Rpc generation
  • The code refactorings Rename and Change Signature will update all the necessary functions and thereby keep your code in the correct state.

Knowledge of Unreal Engine 4 Naming Rules


ReSharper C ++ and Rider are aware of the official naming rules in Unreal Engine code. These rules are used by the development environment in all actions for working with code, such as generating getters and setters or refactoring a variable (Introduce Variable). And most importantly, there is an Inconsistent UE4 naming inspections code check and a corresponding quick fix that will cause Rename refactoring and rename all uses of the name that does not comply with the rules.

Editor Performance


We have been doing development support for Unreal Engine in ReSharper C ++ for quite some time and, of course, we see that editor performance is the main complaint. Due to its architecture, Rider is free from many performance problems that are present in ReSharper (they are partly due to studio limitations on 32-bit processes, within which ReSharper works, but not only).

In addition, we specifically tune the IDE to improve performance on the Unreal Engine. We first index the code of the user game, instantly including all the clever actions of the editor on the user code. And the indexing of the engine code itself occurs after that in the background. There are several additional options for managing indexing:

Performance options

As a result, those who have already started using Rider for Unreal Engine respond very positively about the editor's performance! And we are sure that we can do even better.

Video demo and once again on how to access


These and many other features can be seen in action in a demo video (in English) from our developer lawyer:


And to try these features yourself, just fill out a simple form and receive a letter from us with a link to the build and activation of a free license for an early preview. Go, fill out , try, write reviews! For your feedback, as usual, there are comments here, a tracker ( ReSharper C ++ and Rider ) and our support mail ( rider-cpp-support@jetbrains.com ).

Thank you for the attention!

Rider
The Drive to Develop Team

All Articles