[Bug] Blueprint Script Exceeded bytecode length limit of 64 kb - I hit the limit of BP?

In the latest build, I have a large blueprint that works correctly. I then added a simple custom made macro to it, and it still functions just fine. However the moment I connect Location to my macro, the entire thing stops with the error Script exceeded bytecode length limit of 64 kb.

How can simply connecting location kill the whole thing?

See images.

Ok so this happens on a lot more now than just location. I have apparently truly hit the limit of Blueprint? I only just got started… Are there any plans for increasing this limit to something a lot higher?

And is there any way we can view the current size of Blueprint, and which parts of the blueprint take up most size? So we can try to lower this a bit somehow.

This seems to be related to the following #define in Script.h:

/**
 * a typedef for the number of bytes to skip-over when certain expressions are evaluated by the VM
 * (e.g. context expressions that resolve to NULL, etc.)
 * typedef'd because this type must be synchronized between the blueprint compiler and the VM
 */

// If you change this, make sure to bump either VER_MIN_SCRIPTVM_UE4 or VER_MIN_SCRIPTVM_LICENSEEUE4
#define SCRIPT_LIMIT_BYTECODE_TO_64KB 1

#if SCRIPT_LIMIT_BYTECODE_TO_64KB
typedef uint16 CodeSkipSizeType;
#else
typedef uint32 CodeSkipSizeType;
#endif

It seems configurable in code, but I’m not sure you’ll be able to recompile everything you would need to recompile in Rocket.

That said, unless your Blueprint is considerably bigger than the screenshots you posted above, it doesn’t make sense that you would be running into this kind of limit. It’s possible there is a bug in the code generation, or that a certain node you’re using is particularly heavy in terms of size of code it results in.

For the purposes of narrowing down the possible problems, try creating as simple of a Blueprint as you can that gets this error, preferably in a new project. That would help us identify and solve the problem more quickly.

Thanks!

The BP is way bigger than what is pictured and has several hundreds of nodes. If one of them is particular heavy, it could be any one of the hundreds of things in there. I am not going to trace that by hand and without being able to see the true size of the BP. That is finding a needle in a haystack while Epic knows exactly why this happens probably.
At the very least tools should be present to locate heavy functions + information on exactly what makes the BP add up in size (if I duplicate a variable in the graph 10 time, does that add size? etc.) but ideally there should not be such low limit.

#Workaround And Possibly Even More Efficient

Please see Joe’s answer above if you haven’t already

What happens Sjoerd,

If you create a number of Functions

that contain subsections of your main graph

and then run those events from the main graph?


Does the subdivided graph compile without hitting the bytecode limit?


Below I am showing a setup that would work well for your very large weather graph, which is time-based.


Every function runs, or could run, every tick

and each function contains subsections of your graph

This could be made very efficient

if you put conditions on whether to run each graph subsection depending on current world state

or character location

It appears functions work even beyond the limit. Macros do not. External macros do not either, but functions so far keep compiling successfully.
Functions within the BP are kept track of separately?

Edit: adding a new eventgraph doesn’t work either.

what if you stick the macro in a function, as a wrapper?

" functions so far keep compiling successfully. Functions within the BP are kept track of separately?"

In Blueprint.h

/** Set of functions actually compiled for this class */
	UPROPERTY(transient, duplicatetransient)
	TArray IntermediateGeneratedGraphs;

This indicates to me that each function would have its own 64KB limit

:slight_smile:

Rama

Yeah a macro in a function also works. Anything in a function works in other words. That opens up some possibilities and workaround at least.

So to anyone else doing a lot in BP. Use functions where possible or you will eventually hit the wall I hit.

Thanks man.

“Thanks man.”

Hee hee!

You’re welcome!

Can’t wait to see your next Solus video!

#:heart:

Rama

This was a good thread - it had me worried for a minute!

I think it’s important for the sake of organising your Blueprints to consider them much in the way that you would consider writing code; breaking things down into discrete functions is absolutely the way to go, and macros are best used only for small logical or mathematical operations that you’d be likely to repreat often :slight_smile:

Dear Sjoerd,

In Engine.ini, the only settings I found that looked remotely possibly related where these,

you could try settings the MaxCache size for all of these to something like 2048 in your own config/defaultengine.ini!

Let me know if that helps!

There are 4 places below to set the MaxCacheSize

[DerivedDataBackendGraph]
MinimumDaysToKeepFile=7
Root=(Type=KeyLength, Length=120, Inner=AsyncPut)
AsyncPut=(Type=AsyncPut, Inner=Hierarchy)
Hierarchy=(Type=Hierarchical, Inner=Boot, Inner=Pak, Inner=EnginePak, Inner=Local, Inner=Shared)
Boot=(Type=Boot, Filename="%GAMEDIR%DerivedDataCache/Boot.ddc", MaxCacheSize=512)
Local=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, PurgeTransient=true, DeleteUnused=true, UnusedFileAge=34, FoldersToClean=-1, Path=../../../Engine/DerivedDataCache)
Shared=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, DeleteUnused=true, UnusedFileAge=38, FoldersToClean=-1, Path=\\epicgames.net\root\UE4DDC, EnvPathOverride=UE-SharedDataCachePath)
AltShared=(Type=FileSystem, ReadOnly=true, Clean=false, Flush=false, DeleteUnused=true, UnusedFileAge=38, FoldersToClean=-1, Path=\\epicgames.net\root\UE4DDC2, EnvPathOverride=UE-SharedDataCachePath2)
Pak=(Type=ReadPak, Filename="%GAMEDIR%DerivedDataCache/DDC.ddp")
EnginePak=(Type=ReadPak, Filename=../../../Engine/DerivedDataCache/DDC.ddp)

[DerivedDataBackendGraph_Fill_Seattle]
MinimumDaysToKeepFile=7
Root=(Type=KeyLength, Length=120, Inner=AsyncPut)
AsyncPut=(Type=AsyncPut, Inner=Hierarchy)
Hierarchy=(Type=Hierarchical, Inner=Boot, Inner=Pak, Inner=EnginePak, Inner=Local, Inner=Seattle)
Boot=(Type=Boot, Filename="%GAMEDIR%DerivedDataCache/Boot.ddc", MaxCacheSize=512)
Local=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, PurgeTransient=true, DeleteUnused=true, UnusedFileAge=34, FoldersToClean=-1, Path=../../../Engine/DerivedDataCache)
Seattle=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, DeleteUnused=true, UnusedFileAge=38, FoldersToClean=-1, Path=\\sea.epicgames.net\root\DDC, EnvPathOverride=UE-SharedDataCachePath_Seattle)
Pak=(Type=ReadPak, Filename="%GAMEDIR%DerivedDataCache/DDC.ddp")
EnginePak=(Type=ReadPak, Filename=../../../Engine/DerivedDataCache/DDC.ddp)

[RocketDerivedDataBackendGraph]
MinimumDaysToKeepFile=7
Root=(Type=KeyLength, Length=120, Inner=AsyncPut)
AsyncPut=(Type=AsyncPut, Inner=Hierarchy)
Hierarchy=(Type=Hierarchical, Inner=Boot, Inner=Pak, Inner=EnginePak, Inner=Local)
Boot=(Type=Boot, Filename="%APPSETTINGSDIR%Rocket/DerivedDataCache/Boot.ddc", MaxCacheSize=512)
Local=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, PurgeTransient=true, DeleteUnused=true, UnusedFileAge=34, FoldersToClean=-1, Path="%APPSETTINGSDIR%Rocket/DerivedDataCache")
Pak=(Type=ReadPak, Filename="%GAMEDIR%DerivedDataCache/DDC.ddp")
EnginePak=(Type=ReadPak, Filename=../../../Engine/DerivedDataCache/DDC.ddp)

[NoShared]
MinimumDaysToKeepFile=7
Root=(Type=KeyLength, Length=120, Inner=AsyncPut)
AsyncPut=(Type=AsyncPut, Inner=Hierarchy)
Hierarchy=(Type=Hierarchical, Inner=Boot, Inner=Pak, Inner=Local)
Boot=(Type=Boot, Filename="%GAMEDIR%DerivedDataCache/Boot.ddc", MaxCacheSize=512)
Local=(Type=FileSystem, ReadOnly=false, Clean=false, Flush=false, PurgeTransient=true, DeleteUnused=true, UnusedFileAge=34, FoldersToClean=-1, Path=../../../Engine/DerivedDataCache)
Pak=(Type=ReadPak, Filename="%GAMEDIR%DerivedDataCache/DDC.ddp")

Thanks, I believe that is the shader cache though.
On the licensee UDN it says it is 16 bit or something only from what I understand? Thus the 64kb limit?

I’ve looked vigorously through every config file and I cant find any reference to a graph size limit.

I also looked through Blueprint.h and Blueprintcore.h

as well as BlueprintEditor.h

and I cannot find anything resembling a variable to control blueprintgraph allowed size.

So whatever the answer to this is I think it may have to wait till Epic gets back from the Holidays and your awesome production shall have to continue elsewhere for now :slight_smile:

If anyone finds an answer to this let us know!

Rama

Those appear to be the config settings for the Derived Data Cache, so no, I don’t believe modifying those will help you with your current issue.

Thanks for the clarification Joe!

Is there any config setting to extend the standard blueprint graph compiled bytecode size limit?