Skip to content

Getting Started

Ruslan Mustakov edited this page Aug 29, 2016 · 8 revisions

Set up Unreal Engine 4

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

This library has been tested to work with Unreal Engine 4.12 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.

Set up Nim and nimue4

  1. Compile or download Nim for your platform as described at https://github.com/nim-lang/Nim/. Nim v0.14.0 or newer is required.

  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 = this.ModuleDirectory;
    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.

Clone this wiki locally