Download

Multithread Actors?

so the actors that are usually spawned on the level like pawns or other type of actors
is there a way to move them to another thread because i spawn lots of actors and it starts lagging
my actors are blueprints
ive looked for something like that but seems like theres no blueprint multithreading

No, you can only spawn actors within the game thread;
You can alternatively spawn them from a fixed-size “memory pool” of actors you recycle over and over or if they’re only mesh actors you can use GPU instantiated meshes.

Make sure you disable BP ticking if the actor doesn’t have any logic that needs to tick, since BP tick is enabled by default (it’s a setting it the details panel)

Beyond that, you can create some logic so that far away BP actors aren’t ticking or at least lower their tick rate and then adjust back to normal when in proximity or on an as needed basis.

As far as I know you can multithread some logic inside BPs but you can’t multithread BP actors as a whole.

There’s various BP multithreading options, free and paid.

thanks for the BP ticking disable thing ill use that for far objects on the map

but i cant disable tick on some BP because they are AI which are all on the same place (like a battlefield or a crowded city)
it is not possible to multi thread actors??
so u mean that even if i had the most powerful cpus currently (lntel core i9 7980xe or AMD Threadripper) my game would still lag because it can only run on 1 thread??
theres gotta be a way somehow
usually blueprints are check variables set variables move object here
and i suppose variables are stored in RAM?
so actor from 1 thread could set variable to RAM and actor from other thread could get it from RAM?
eh idk much about coding and stuff
i suppose it would be possible to multithread the events inside the BP or something?

For AI, a common solution would be to reduce the tick rate when the AI is out of sight or not interacting. In other words a dynamic tick rate.

Yes you can multithread the events or logic in blueprints. There a few solutions on the markerplace, one is free and two or three is paid options. Of course successfully understanding how to use them is topic unto itself.

I also suggest doing some basic profiling or researching general optimizing topics, that is if you haven’t already. You might find some areas that gain back your game thread’s performance.

UObject can be created in any threaded and accessed from there, but no AActors…
It’s possible to create an “empty” Actor class which spawns NewObjects within multiple different threads and offload your function computations to those sub objects, but that complicates workflow by a lot.

ok so let me get it right
actor blueprints cannot be outside the main thread
but the events and objects inside the BP can be multithreaded
i got that right?
can i get some more instructions on how to apply this or the links to those plugins (the free ones :P)
doing this will use more cpu threads and increase perfomance right even if i spawn tons of ai or actors the engine will use all resources as necessary until the computer hits it limit?
the thing is i want the hardware to be the limit not the game itself…
just like it is with graphics
like if i want to play at 4k 120 fps 3D you just buy a powerful graphics card
the problem here is that not even a powerful cpu will help because the problem is the game itself :confused:

No, you can’t call events outside game thread.
If you call Blueprint events from outside, you crash…

Everywhere in engine code they have examples of threaded code interacting with game thead;

I think you didn’t notice the “complicates workflow by a lot” part, because that’s not a joke, you gonna end up building your own threaded ECS system for some framerate gain.
While you could’ve just gone with an Actor Pooling system which is way easier to develop;

Somebody posted a ECS source here in forums somewhere, but I don’t know if they completed development or abandoned.

well **Gallonmate said ‘**Yes you can multithread the events or logic in blueprints.’ unless i got that wrong

where are those examples of threaded code in the engine?

and also why is it so hard to multithread BP actors? isnt a BP like a set of code (instructions) and why cant it run on another thread and simply give the results back to the main thread
also is the actor pooling system like a plugin or something?
because i found this [Plugin] Object Pool Component - Marketplace - Unreal Engine Forums
i dont know if this one is what u mean apparaently theres a demo ill try

is the ECS post this one? Entity-Component-System (ECS) for UE4 - Work in Progress - Unreal Engine Forums
i dont see any download link
but why wouldnt unreal engine 4 implement those things? i mean im pretty sure every game could have some more performance :smiley: