Download

Question about execution order

Hi,

I have been searching for the answer and while this has been talked about on a few places in different context, I’m not 100% sure about a few things:

1.) Execution order when sequence is used
From the docs i understand that sequence even though looks like all exec pins fire at the same time, internally they are supposed to go in sequence from top to bottom (but nevertheless all happening in the same frame (or between frames)).
In a case like the following image:

&stc=1

Is it guaranteed that internally the node#1 will set the “Speed” variable before the node#2 sets the “Test” variable even though node#1 needs to evaluate the math expression?

**
2.) Another one for the sequence**
In a case like the following image:

&stc=1

Is there guaranteed order in which variables will be set in the case of node#2 and node#3? Would that be first #2 and then #3?
If the answer to previous question would be that node#2 is set first and then node#3 is set, would this continue and then node#4 and after that node#5 would do it’s job?

Thanks

  1. Yes, Speed will do all the calculations and set its value before Set Test is executed

  2. The execution order in that image is: 1 3 5 2 4, where Speed (1) will be set to Direction/2+4 before any other node is executed. Direction*0.0+20 is never calculated.

Afaik sequences always guarantee the execution order. It will always be in order, and it will always finish an entire execution path before jumping from “then x” to “then x+1”.

It will complete the entire “Then 0” row before it starts on “Then 1”. This is guaranteed. It is like one long big chain, going from one end to the other… no shortcuts in what you show us. That is guaranteed.

Also, what you show us there will be in one single frame. That is guaranteed.

How often it is done however depends on what it is linked up to… if it is linked to a mouse button, it will do the work in one frame, but only the frame when the game receives the mouse click event.

This actually explains everything :slight_smile:

So if more actors are running bp driven by tick, are they processed in parallel or one after another (either in random order or how they were spawned) so if one would know the order in which they will be processed it could actually be said in which order all the nodes in all actors driven by tick would be processed?

Thanks everybody.

As far as I know, BP processing runs on a single main thread, so there is no parallelism involved (that’s probably very fortunate, all things considered) so it’s one after the other.

If you need ticks to happen in an explicitly defined order, there is apparently something called tick groups and ways to ensure that one thing precedes another, but I have not looked into this, and I don’t know if it is exposed to BP or only available in C++.

I’m sure someone else has useful information regarding those things. Would be interesting to know!

Thanks again.

I don’t really need (at least not at the moment) to explicitly define the order, it’s just something that helps me understand the engine and how things work. For someone without much programing background that can help a lot :slight_smile:

One more - with character that is using anim bp, I guess first is processed the character bp, then anim bp. Inside anim bp, the event graph is first processed and only after that is done, the animation graph is processed?

@Xenome, one execution line is running on a thread, BUT, multiple events could run at the same time.
There is one debug case study I put up on wiki demonstrate this. Only function are suppose to return and then run the next node. All other event calls are fire and forget as they have no return value to depend on.
Be very careful to NOT assume there is only one thread running all the bp events, which is obviously not the case.

           https://wiki.unrealengine.com/Blueprint_Debug_Case_Study

           It is unfortunate that after I created the wiki there is still only one case study to date.

That’s great info there, PenguinTD, much appreciated! Explains some odd things I’ve encountered on a few occasions.