Unreal Engine 4

1. Creating a UE4 Project

1-1. In the window shown below, which appears immediately after launching the UE4 Editor, select 'Game', which is circled in red in the screenshot, and when the 'Open Project' button changes to 'Next', press the 'Next' button.

1-2. In the 'Choose a template' window, select 'Default' and press 'Next'.

1-3. In the 'Project Settings' window, press the 'Blueprint' button, which will expand to a drop-down list of buttons.

1-4. From the expanded drop-down list, select C++ as shown in the screenshot below.

1-5. Enter the path to create the project and the project name in the 'Project path window' and 'Project name window', which are marked with red boxes in the screenshot below, and click 'Create project'.

1-6. When you finish creating the project, the Visual Studio IDE and UE4 Editor will be launched simultaneously with the created project.

1-7. In the Visual Studio IDE, be sure to specify the Configuration and Platform as shown below.

  • Solution Configuration : Development Editor

  • Solution Platform : Win64

2. Integrating ProudNet into your UE4 project

Specify the ProudNet library and header file paths in C# code in the (project name).build.cs file.

  1. Open the cs file and there will be a class with the same project name automatically generated by UE4 Editor. The class is currently held only by the creator.

  2. If you look at the creator's body, you can see a few lines of annotation at the back. Put the code behind the annotation specifying the reference path to the ProudNet library and header file.

  3. To specify the ProudNet library reference path, pass the library path string to the Add function of the PublicAdditionalLibraries object. E.g.: > PublicAdditionalLibraries.Add("D:\ProudNet1.7.48971-master\ProudNet\lib\x64\v140\Release\ProudNetClient.lib")

  4. To specify the ProudNet header file reference path, pass the path to the ProudNet include folder to the Add function of the global object called PublicIncludepaths. E.g.: > PublicIncludePaths.Add("D:\ProudNet1.7.48971-master\ProudNet)

  5. UE4 projects that integrate with ProudNet must be built in 64-bit, so enclose the two previous sentences in curly braces and add an if statement above them.

  6. The lib files required for IOS and Android builds are also enclosed in an if statement.

Below is an example with commenting removed.

// Copyright Epic Games, Inc. All Rights Reserved.
 
using System.IO;
using UnrealBuildTool;
 
public class TestUnreal4 : ModuleRules
{
    public TestUnreal4(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
    
        PublicIncludePaths.AddRange(
	new string[] {
	    // ... add public include paths required here ...
	}
	);
				
		
	PrivateIncludePaths.AddRange(
	new string[] {
	    // ... add other private include paths required here ...
	}
	);
 
        if (Target.Platform == UnrealTargetPlatform.Win64)
        {
            // Add the import library
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\ProudNetClient.lib");
        }
        else if (Target.Platform == UnrealTargetPlatform.IOS)
        {
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\libProudNetClient.a");
            
            PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\x64\v140\Release\libiconv.2.tbd"));
        }
        else if(Target.Platform == UnrealTargetPlatform.Android)
        {
        PublicAdditionalLibraries.Add(@"D:\ProudNet1.8.00002-master\ProudNet\lib\NDK\r20\cmake\clangRelease\arm64-v8a\libProudNetClient.a);
        }
        
         PublicIncludePaths.Add(@"D:\ProudNet1.7.48971-master\ProudNet\include");
    }
}

For iOS and Android, please refer to ProudNet\lib\NDK\r20\cmake\clangDebug\arm64-v8a\libProudNetClient.a instead of ProudNet\lib\x64\v140\Release\libProudNetClient.lib.

Please do not set it to the path in the example code above, but to the path where your actual Proudnet is installed.

As in the example above, you can create a CNetClient normally without any compilation errors.

3. Android Build

Please refer to the link below.

4. iOS Build

You must additionally specify the path to the libiconv.2.tbd library.

If you do not specify it, you will get iconv-related linking errors at build time.

Please refer to the link below.

Last updated