Slow compile times after adding word list on BullCowGame

Hey everyone,

Is it normal to have the compile times skyrocket once the word list gets added to the game? I’m talking about 3 seconds to compile if the list is 10 words long, vs 51 seconds with all 1000 words.

CPU utilization (AMD Ryzen 3600X) spikes up to 50% for a second and then lowers to 12% for the rest of the the compile… Unreal seems to be trying to use all available threads, but I guess there isn’t much multi-threading to do on going through a list of words :slight_smile:

Cheers!

1 Like

You can move it to runtime by using FFileHelper and move HiddenWordList.h to the Content directory and change the file extension to txt having just the words separated by new lines i.e.

a
ability
able
about
...

Then in BeginPlay

#include "FIleHelper.h"
#include "Paths.h"
void UBullCowCartridge::BeginPlay()
{
    Super::BeginPlay();
    TArray<FString> WordList;
    const FString WordListPath = FPaths::ProjectContentDir() / TEXT("HiddenWordList.txt");
    FFileHelper::LoadFileToStringArray(WordList, *WordListPath);
    Isograms = GetValidWords(WordList);
    //...

In order for this to work in a packaged game you would need to create a directory in the Content folder and put the word list in there. Update the WordListPath accordingly e.g.
/ TEXT("WordList/HiddenWordList.txt");
Then add it to the “Addiitional Non-Asset Directories to Package” in your project settings which you can easily find using the search.

4 Likes

I have this same issue. I was getting compile time less than a second and after the HiddenWords.h file I started getting 33 second compile times. Did you try the solution below? And if so did it solve your problem?

I can confirm that this works. Thanks much! I’m back to under a second compile time :smiley:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms