Is C++ Really This SLOW in Unreal 4?

Alright, I’ve been using Blueprints for my projects on Unreal 4 for several years, but now I’ve recently decided to get into really learning some actual code with C++.
I’ve been doing some Youtube tutorials from Reuben Ward, simple things like setting up an inventory that prints a list of objects you can “pick up” and have their names reprinted through a debug message from an array of strings. Very simple, very small things.

BUT…

When I compile ANYTHING using Visual Studio I get to wait around 5 minutes (I can only imagine what it will be like on a larger project) just to see if I fixed a single error. But wait! that’s not all… the intellisense is utterly non-existent (or so slow its actually faster to go onto Bing and just look up the code I’m looking for).

Now, I’ve heard about something called Visual Assist, some people say its supposed to help with improving compile times and (supposedly) with intellisense, but I thought I’d ask around to see how many other people are having these same issues (if anyone is), and if they’ve found any better solutions.

Also, here’s my specs:

Windows Edition

Windows 10 Home

System

Processor: Intel(R) Core™ i5-6400 CPU@ 2.70GHz 2.71GHz

Installed Memory (RAM): 12.0 GB

System Type: 64-bit Operating System, x64-based processor

It’s not that C++ or Visual Studio is slow, but the Unreal Engine source code is just really big.

A few tips to speed up the compile process:

  • use a SSD for Visual Studio and all of the source files
  • Get a better processor!
  • Visual Assist does not help with the compile time, but it is nonetheless useful for Intellisense and other things
  • Only build your project, not all the projects in your VS view
  • shut off your antivirus

There is a reason why most people prefer to use blueprints when the performance is not critical - they allow faster iteration times.

2 Likes

Even compiling just your game’s code can take up some time. An almost blank project takes about 30 seconds on an i7 with 16Gb of RAM and an SSD drive.

Thanks for the answers guys!

But is it at all possible to make a game using mainly (like 90%) Blueprint? Or will that cause performance issues since I’ve heard Blueprint programmed functionality is slower than that programmed in C++.

It really depends on the game you’re making. You can probably do most of the gameplay mechanics in BP and resort to C++ for parts that need optimizations.

Something seems off.
With my projects(average size, not too big or small) it usually takes 10-30 sec to compile. I have i7-4770k and SSD, so if you have it SSD too then difference in compile time should not be THAT big.
Intellisense is non-existent , yeah, I think Visual Assist is not a recommendation, but a requirement for UE4 C++ work. It won’t help you with compile time, though

Here’s one tip around tweaking the Unreal Build Tool parameters that has actually made working with C++ bearable for me - previously, similar to what you’ve mentioned, I’d have to wait anywhere from 1 to 5+ minutes to compile ANY change, no matter small. Using the tip below build time is now 4-5 seconds(!) if I’m only editing a CPP file (e.g. changing logic within existing class methods), and about 50 seconds if I change a header file. So the workflow now is flesh out the class structure as much as possible first, then implementing and testing logic within each function is now VERY quick.

No guarantees you’ll get similar results, but worth a go.

Steps:

  1. You need to create a file (if it doesn’t exist) - C:\Users<your user>\Documents\Unreal Engine\UnrealBuildTool\BuildConfiguration.xml
  2. Paste the following in to the file above:


<?xml version="1.0" encoding="utf-8"?>
<Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
	<BuildConfiguration>
		<bUseUnityBuild>false</bUseUnityBuild>
		<MinFilesUsingPrecompiledHeader>1</MinFilesUsingPrecompiledHeader>
	</BuildConfiguration>
</Configuration>


  1. Save file, try build again. Then try just changing code in .cpp files (leave headers alone) and build again (just bulid, not rebuild) and fingers crossed it only takes a few seconds.

Note, I trigger my builds from within visual studio, but it should work from the editor too as they both use the same build tool anyway.

Also, regarding intellisense, I’ve tried both Visual Assist and Resharper C++ a fair bit, and although Resharper takes a longer to scan all the files the first time through, in my experience I’ve found it then provides much better info than Visual Assist. It’s only in a fairly recent version that they’ve got it working properly with UE4 though, so just in case you’ve tried it some time back, it’s worth having another go.

2 Likes

I have the same configuration in my project Source/Test2DPlatformer.Build.cs file just like this:


using UnrealBuildTool;

public class Test2DPlatformer : ModuleRules
{
	public Test2DPlatformer(TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "Paper2D" });

		PrivateDependencyModuleNames.AddRange(new string] {  });

		// tanis - start faster compile time for small projects
		MinFilesUsingPrecompiledHeaderOverride = 1;
 		bFasterWithoutUnity = true;
 		// tanis - end
	}
}

But it didn’t really make any difference to my compile times. And my project is just about 10 classes at the moment. Total compile time is still around 30 seconds.

Compilation times are fast for me…
But you’re right about Visual Assist X, can’t work on Unreal without it; the built-in intellisense will not work and even Visual Assist will break some times.
A good thing to do is create only base classes in C++ and make functions there to process the heavy calculations; everything else you end up connecting pins on Blueprint side specially now that Unreal will convert back Blueprint to C++ when packaging the game.

  • The problem with VAssist is for many hobbyists it feels expensive when you need to buy that just to work on UE4 using C++.

Thanks for the excellent info! My sub for VAX is almost up, I think I will try Resharper! – Also, I believe 4.15 will help with compile times, at least that’s what I’ve heard… not tried the preview yet.

teak

Hmm, I had a feeling that when I’d first tried I hadn’t had much luck having the options in the build.cs, which is why I’d settled on the BuildConfiguration.xml. But I’ve just tested again, removing BuildConfiguration.xml and using those exact options in my project’s build.cs and it definitely has the same effect. Changing a “int test = 5;” to “int test = 6;”, compile time goes from 460 seconds without, to 6 seconds with. I also compared VS 2015 and VS 2017 and same result.

Just to confirm - with the 30 seconds, that’s only making changes in a .cpp file? Changing a .h will always take longer
And as Cultrarius suggested do you have an SSD to use for VS and UE4? That was the other thing which helped me a lot.

Yes definitely worth trying out. I’d actually bought a VAX licence just recently as I prefer that to Jetbrain’s subscription model. But with their latest 2 Resharper C++ updates, 2016.2 and 2016.3, they’ve actually made improvements explicitly mentioning Unreal Engine 4, and it did improve things dramatically so I’ve ended up subscribing… I still don’t like the subscription model, but I have to admit it’s a good product :slight_smile:
Anyway, main thing I wanted to mention, make sure you check this note if you’re using VS2017, I missed it initally and nearly gave up

Thanks again for the info… Will certainly read the note…

teak

Yes, I’m only changing one line in a single .cpp file and I do have everything on the same SSD. I’m on macOS if that might make any difference and using the “Compile” command from within the editor to recompile.

BTW as a side note I must add that CLion (which probably shares the same ReSharper engine for Intellisense) is very good for code completion.

Thanks for checking my videos out :slight_smile:

Intellisense doesn’t work very consistently for me, but on the plus side it makes you remember code better, since you’re not always relying on intellisense to help out.

It seems very random, i’ve talked to people with large SSD’s and they get very slow intellisense times, but make sure everything (Visual Studio, Unreal Source, etc) is all on the SSD.

This should do it.
I needed to restart Visual Studio before I noticed the differene. VS compiles my code, typically, in a few seconds. I have quite a few classes with close to 1000 lines of code.

Regarding Intellisense speed, there is a switch which significantly improve the Intellisense:-

*I just banged my head against the wall with this issue in a Class last term. *

When Intellisense Breaks (aka errors abound but things compile fine ). Close Visual Studio and Refresh the Files.
There is an option to do this from the editor. It’s Under “File” from the menu bar.
**And yes, you might have to do this just because you added a include in a header file. **

Here’s some documentation about this…

Just don’t use Intellisense. It’s flat-out garbage for large codebases like Unreal.

Seriously, just get VAX. It’s not too expensive and it’ll change your life, I promise!

Right now I’m using CLion on macOS and it’s way better than Xcode when it comes to indexing a large codebase. Autocompletion is quick and works very well. I noticed in the release log of 4.15 that it says that compilation times are 50% faster than before but I guess it’s for the engine itself only as compiling the game code is still taking the same time.
Did you guys notice any difference?