Announcement

Collapse
No announcement yet.

Setting up Unreal Tournament in Qt Creator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [TUTORIAL] Setting up Unreal Tournament in Qt Creator

    I will mostly focus on Linux here, as I can't (and don't have a need to) test this on Windows and OS X. But any additions are welcome. Mainly I'm just documenting things I discover as I go.

    Introduction

    Qt Creator is a free software, full-featured, fast, cross-platform integrated development environment (IDE) for C++, which can be used for writing native Unreal Engine 4 code and mods for Unreal Tournament. Qt Creator is very popular as an alternative to Visual Studio (especially on platforms that doesn't have VS to begin with) and has several advantages over it (see UE4 wiki). Also, don't be fooled by the name: Qt Creator was made for making Qt interfaces, but it has outgrown that purpose and is now a general-purpose IDE.

    Preparation

    To start off, you of course need to install Qt Creator. On Linux, this is easily doable from your package manager, for instance:

    Code:
    sudo zypper install qt-creator
    Then, you need to have Unreal Tournament Editor set up. See the documentation on the Wiki or the Linux tutorial if you don't have that done already.

    File viewing

    The first step in the set up is to make the code readable from within Qt Creator. This is very easy to do. During initial setup of Unreal Tournament Editor, you had to run a script called GenerateProjectFiles – among others, it generates a project file for Qt Creator. All you have to do is open said file!

    Launch Qt Creator, and select "File" → "Open File or Project...". Navigate to the root directory of the Unreal Tournament source code, and select the file "UE4.pro". This will open the Configure Project page:
    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

    Press "Configure Project" and Qt Creator will parse all the C++ files in the source tree. You will be put into the "Edit" tab with the source tree view visible. From there you can browse both the engine and UT4 source code with ease.

    Note that whenever you update the UT4 source repository, you need to remember to re-run the GenerateProjectFiles script in order for Qt Creator to discover any new files added to the source tree.

    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

    Compiling

    Viewing code is nice, but an IDE is for code creation, so you'll also want to be able to compile the code. For that we need to configure the build options. Press the "Projects" tab on the left side of the screen, and you'll see a "Build Settings" screen.

    First, let's handle the case of compiling UT4 code itself (as opposed to mods). In Build Settings, switch "Edit build configuration" to "Release", and set the "Build directory" to the UnrealTournament/Intermediate/Build directory (full path, starting from the root of the UT4 source repository). Next, remove all the build and clean steps (by hovering the mouse on them and pressing X). Then, press "Add Build Step" → "Custom Process Step". There, point the "Command" field to the Build batch file (on Linux, that's UnrealTournament/Engine/Build/BatchFiles/Linux/Build.sh, while on Windows there is an equivalent .bat file). In the "Arguments" field, enter a string like this:
    Code:
    UnrealTournamentEditor Linux Development /full/path/to/UnrealTournament/UnrealTournament.uproject
    Adjust the "Linux" part for the OS you're using (if different), adjust the "Development" part if you want various levels of debugging (see this page for all the possible combinations), and adjust the path to point to the actual UnrealTournament/UnrealTournament.uproject file.

    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

    That's it, now you can use the "Build Project" button (hammer icon in the lower right corner) to build the source and the Editor!

    Running the Editor

    It doesn't take much more to hook up the Editor to the "Run" button, too. Click the "Run" button below the "Desktop" label in the black box at the top. This opens the Run Settings. Under "Run", press the "Add" → "Custom Executable" button. Point the "Exectuable" field to UE4Editor (on Linux, that's Engine/Binaries/Linux/UE4Editor), point the "Arguments" field to the UnrealTournament/UnrealTournament.uproject file, and point the "Working directory" field to the directly the UE4Editor executable is in (on Linux, that's Engine/Binaries/Linux). Lastly, check "Run in terminal" to see some log output when running the Editor. You can also press the "Rename..." button to change the name to something readable, like "Editor only".

    Note that on Linux, if your distribution requires defining the LD_LIBRARY_PATH variable for the Editor to run (as explained in the UT4 Editor on Linux tutorial), you also need to define it here. In the "Run Environment" section, press "Details", "Add", enter LD_LIBRARY_PATH under "Variable", and copy-paste the contents of the "Working directory" field you entered before into the "Value" field.

    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

    That's it, now you can use the "Run" button (green triangle in the lower right corner) to have Qt Creator both rebuild the Unreal Tournament sources and run the Unreal Tournament Editor right after that.

    Running the game with a mutator

    What if you want to run the game, instead of the Editor? And how to test mutators? Both are actually very similar to the Editor case. In fact, follow the same steps as above, with the only change being the "Arguments field". For launching the game and using a mutator, the syntax is like this:
    Code:
    UnrealTournament/UnrealTournament.uproject -game Example_Map?mutator=SampleMutator.SampleMutator
    The "-game" part makes it launch the game instead of the editor, the "Example_Map" part is which map to launch, and the "mutator" part is which mutator to launch.

    This Image Was Automatically Resized by using the Screenshot Tag.  Click to view the full version

    Rename this configuration to something readable too, like "Game with Mutator". You can select which action the Run button takes by pressing on the PC icon below "UE4" at the lower right corner.

    To do

    That's all for now, these simple steps should be enough to allow you to start writing code.
    I'm planning to write more about this, including information on how to build mods, how to use debugging, and perhaps some other nifty things like integrating with git. Any contributions to this tutorial would be appreciated, too.

    Information source and further reading material (highly Windows-specific, I'm not sure how up to date, and no info on UT4 specifics, though):
    https://wiki.unrealengine.com/Using_..._UnrealEngine4
    https://forums.unrealengine.com/show...real-Engine-4-!
    Last edited by GreatEmerald; 02-13-2015, 06:19 PM.
    Unreal Tournament 4 eXpanded MultiPlayer (UT4XMP) efforts
    My website, listing all my Unreal series mods and mutators

    #2
    Do i have to do this with every new project?

    Comment


      #3
      If you're thinking about mods, I think so, yes. It's only a matter of copy-pasting a few lines, though.
      Unreal Tournament 4 eXpanded MultiPlayer (UT4XMP) efforts
      My website, listing all my Unreal series mods and mutators

      Comment

      Working...
      X