Skip to content

Getting Started

Ruslan Mustakov edited this page May 15, 2016 · 8 revisions

Set up Unreal Engine 4

This library has been tested to work with Unreal Engine 4.10 and 4.11 on Windows and OS X. It may work with earlier versions of UE4, too, as long as you don't use features added in recent versions. Notice that the library intentionally doesn't provide wrappers for deprecated methods and fields.

Follow instructions on the official Unreal Engine site to set up Unreal Engine 4.

Set up Nim and nimue4

  1. Compile Nim for your platform as described at https://github.com/nim-lang/Nim/. Notice that nimue4 currently depends on devel branch (upcoming release) of Nim. So, after cloning the repository, run git checkout devel, and then follow the compilation instructions.

  2. Visual Studio Code is the recommended environment for working with Nim code. Install VSCode by following the instructions on the website, then install nim extension by bringing up the command palette (ctrl-shift-p), selecting Install Extension and typing nim. Also, install c# extension to work with C# code (UE4 build files).

  3. Clone this repository into a folder of your choice:

git clone https://github.com/pragmagic/nimue4.git

Set up Unreal Project with Nim support

  1. Create a new C++ project using the Unreal Editor.

  2. Copy files from nimue4/stubs/ folder into the project's root folder.

  3. Open the project's root folder in VSCode (File -> Open Folder).

  4. Delete all the generated .h and .cpp files from Source folder.

  5. Change paths to nimue4 and Nim inside build.cmd and build.sh files. If on Windows, change path to Visual Studio, if necessary.

  6. Change nim.project setting inside .vscode/settings.json to match your project name. For example, if the project is called MyGame, set it to Intermediate/Nim/MyGameRoot.nim.

  7. Add these lines to the game module's build rules constructor (MyGame.Build.cs):

    var moduleDir = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));
    PrivateIncludePaths.Add(Path.Combine(Environment.GetEnvironmentVariable("NIM_HOME"), "lib"));
    PublicIncludePaths.Add(Path.Combine(moduleDir, ".nimgen", "Public"));
    PrivateIncludePaths.Add(Path.Combine(moduleDir, ".nimgen", "Private"));
    UEBuildConfiguration.bForceEnableExceptions = true;
  8. These imports also have to be added at the top of the Build.cs file:

    using System;
    using System.IO;
  9. Add these lines to Config/DefaultEngine.ini (change MyGame to your project's name):

    [/Script/Engine.Engine]
    GameEngine=/Script/MyGame.NimGameEngine
  10. From now on, press ctrl+shift+B (cmd+shift+B on OS X) in VSCode to compile and deploy your code.

These steps will soon be automated so that the Nim project template can be created from Unreal Editor via plugin.

Clone this wiki locally