An example generated with the code from the Voxel Terrain Tutorial

Voxel Terrain in Unreal Engine 4 Part 4.5: Upgrading to 4.12

And we’re back with another part of the Voxel Terrain in UE4 tutorial! While the last few versions of Unreal Engine 4 have done wonders for code compatibility, this time around we have a small change to make to our project before we’ll be able to compile it with the new version of the engine. From this tutorial forward I will be continuing the series using Unreal Engine 4.12, up from 4.10. Make sure you apply this change before you try to upgrade to 4.12!

The Changes

This is actually one of the smallest changes I’ve ever had to make to upgrade a project to a new version of the engine. All we need to do is replace our custom-made ModulePath member with the newly implemented ModuleDirectory member, which acts as a direct replacement for our previous code. As a start, go find this chunk of code in your ProjectName.Build.cs file and remove it.

// The path to our game module; e.g. ProjectFolder/Source/ModuleName/
    private string ModulePath
    {
        get { return Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name)); }
    }

Next go ahead and replace all uses of the ModulePath member with the new ModuleDirectory member. This is actually really simple, we only had a single use of that member in our file. Find the ThirdPartyPath member and change it to the following:

// The path to our Third Party code assets; e.g. ProjectFolder/ThirdParty/
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../ThirdParty/")); }
    }

With that change in place, you should now be able to compile your project. Just in case though, this is the entire file:

// Fill out your copyright notice in the Description page of Project Settings.
using System.IO; // Make sure you are using System.IO! Its not in here by default!
using UnrealBuildTool;

public class VoxelTerrain : ModuleRules
{
    // The path to our Third Party code assets; e.g. ProjectFolder/ThirdParty/
    private string ThirdPartyPath
    {
        get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../ThirdParty/")); }
    }

    public VoxelTerrain(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "ProceduralMeshComponent" });


        PrivateDependencyModuleNames.AddRange(new string[] {  });

        ////////////////////// Custom Voxel Terrain Stuff Starts Here //////////////////////////////////////
        // You will need to compile and add additional libraries if you want to use this on platforms not listed below!
        switch (Target.Platform)
        {
            // 64-bit Windows
            case UnrealTargetPlatform.Win64:
                PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "accidental-noise-library", "build", "ANL", "x64", "ANL.lib"));
                break;

            // 32-bit Windows
            case UnrealTargetPlatform.Win32:
                PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "accidental-noise-library", "build", "ANL", "x86", "ANL.lib"));
                break;

            // Mac
            case UnrealTargetPlatform.Mac:
                PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "accidental-noise-library", "build", "ANL", "Universal", "libANL.a"));
                break;
            
            // Linux
            case UnrealTargetPlatform.Linux:
                PublicAdditionalLibraries.Add(Path.Combine(ThirdPartyPath, "accidental-noise-library", "build", "ANL", "x64", "libANL.a"));
                break;

            default:
                break;
        }

        // Include the headers for PolyVox and ANL so we can access them later.
        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "polyvox", "include"));
        PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "accidental-noise-library"));
        ////////////////////// End Voxel Terrain Stuff //////////////////////////////////////////////////////
    }
}

I would also like to leave a link to the project’s GitHub page for anyone who isn’t already aware of it! I created this towards the beginning of the project, but I only ever mentioned it on Twitter, so I don’t think many people know about it. If you ever need to see how my entire project is set up, please check this out.

105 comments on “Voxel Terrain in Unreal Engine 4 Part 4.5: Upgrading to 4.12Add yours →

  1. Pingback: 먹튀신고
  2. Pingback: freemoviesz
  3. Pingback: home11
  4. Pingback: 검증사이트
  5. Pingback: Bassetti Decken
  6. Pingback: iq colarts
  7. Pingback: forex signals
  8. Pingback: Predrag Timotic
  9. Pingback: GOA ESCORTS
  10. Pingback: Kolkata Escorts
  11. Pingback: freshamateurs289
  12. Pingback: garvinized.com357
  13. Pingback: garvinized.com765
  14. Pingback: garvinized.com619
  15. Pingback: comment535
  16. Pingback: comment338
  17. Pingback: comment190
  18. Pingback: comment165
  19. Pingback: comment443
  20. Pingback: comment696
  21. Pingback: comment985
  22. Pingback: comment321
  23. Pingback: comment166
  24. Pingback: comment346
  25. Pingback: comment81
  26. Pingback: comment765
  27. Pingback: comment26
  28. Pingback: comment570
  29. Pingback: comment433
  30. Pingback: comment445
  31. Pingback: comment304
  32. Pingback: comment857
  33. Pingback: comment516
  34. Pingback: comment888
  35. Pingback: comment473
  36. Pingback: comment63
  37. Pingback: comment463
  38. Pingback: comment820
  39. Pingback: comment259
  40. Pingback: comment997
  41. Pingback: comment316
  42. Pingback: comment593
  43. Pingback: comment768
  44. Pingback: comment289
  45. Pingback: comment348
  46. Pingback: comment893
  47. Pingback: comment201
  48. Pingback: comment360
  49. Pingback: 639ry6Vl45p
  50. Pingback: hdmobilesex.me

Leave a Reply