move many instances, unsynchronised, with an unique timeline

Hello all.

It’s been a few weeks since I decided to learn the UE4 and to try to realize a first and modest game project.

Today, for the first time, I encounter a true difficulty that I cannot resolve on my own, nor with the help of the many tutorials and topics found on the net (French and English). (yes i’m french… so sorry for my bad english)
So I hope that someone can enlighten me from their experience.

So here’s the situation, quite simple on paper:
I want to trigger, at the start of a level (connection to an eventbeginplay), the movements of a multitude of instances of the same static mesh, but unsynchronized.
The movement is very simple and corresponds to the modification of the altitude of each of these instances with simple movement along Z axis (X and Y locked).

Obviously, if we forget the desire to desynchronize the triggering of these movements for each instance, making such an animation is not a problem for me. Likewise, if i wanted to trigger these movements in a loop, instance after instance, that would not pose a problem either.

However, the result I want to reach is to trigger those movements of these instances neither simultaneously, nor one after the other, but a bit like the takeoff of several randomly triggered rockets within a specified time range.
Thus, i wanna be able to launch a second rocket (so, set a second movement) while the first is still in progress. And this for a certain number of rockets (several tens).

I understand, now that I know the node timeline a little better, that it is just impossible to use a single one timeline node to animate several instances of my mesh in desynchronization since launching a new animation will immediately cut the output flow of the animation already playing. It seems to be obiged to wait for each animation to be completed to trigger a new one …

My final question is the following: Am I obliged to create the same adapted code as many times as necessary for each of my instances (96 at the moment o_O ') or is there a function or a technique which allows me to achieve the equivalent of a timeline but who would send an independent stream each time you ask for an additional instance ?

Certainly, a copious request for reading, but I try to be clear enough not to waste your time having to decipher the request … but it may not yet be won

Anyway, thank you for the time you can give me on this topic.
And happy new year to all.

If you are already using a timeline to move the instances, you can use the same setup, but also have an array of the ‘syncronization offsets’. It’s just a float array.

Then, on the execute pin of the timeline you can use a foreach loop to move the Z coord of the instances ( using the offset array ).

Tell me if you need more info ( also maybe show your current timeline code ).

It’s very ‘procedural’ though, this method. There a more subtle method that involves spawning empty actors with timelines to control the rockets.

Is it possible to have different play rates for the same timeline? I have one timeline in my BP controlling the movement of all child actors along a spline, but I was hoping to give the child actors varying speeds/play rates so they each slow down where the spline bends. At the moment they all follow the same play rate and I can’t seem to work out how to give them individual play rates (instances) for the same timeline.

Sure you can have different play rates, you can have an array that holds the rate at which you’re going to move each component, but… the TL ends at the same point for everyone, so there’s a big reset at that moment.

If you want to have independent movement of these children, there’s really only two ways

  1. Spawn a blueprint with a TL to control each child

  2. Make the children blueprints, capable of controlling themselves.

I really appreciate the reply! I did try spawning a timeline with each child actor but I had trouble working out how run all the different child actor timelines at once.

In regards to point 2, what would you think would be the best way to get the children actors to control themselves? Perhaps communicating with my main BP via blueprint interfaces?

Just make a BP with nothing in it but a custom event and a timeline. You spawn one of these, and pass the child object reference to the custom event. The timeline just runs on begin play ( for the spawned BP ).

With method 2, very similar to 1, except that the object is also in the BP. This time, you just pass the spline reference to the BP, and it just moves the object along using it’s own TL.

What sort of objects are you moving around the spline? Maybe I can do an example?

So what I am working on is a blueprint which spawns car blueprints along a spline. The car blueprints are just static mesh actors with some functions for changing colour, wheel rotation, adding drivers etc. At the moment I can spawn the car blueprints at regular intervals and have them move along the spline at whichever speed value I set. What I am hoping to do is have each individual car slow down at corners. I have worked out a way for the cars to recognise significant bends (angles) along the spline and drop their speed by a % that I choose, and then return to their inital speed value again when leaving the corners. I am reducing their speed at corners by reducing the play rate of the timeline. However when the first car reaches the first corner and slows down, all the other cars slow down too, no matter where they are along the spline, so I got stuck trying to figure out how to asign the car actors individual play rates or rather, timeline instances.

If you had time at any stage to create a simple blueprint to move multiple static meshes (say a cube) at varying play rates along a spline you would definitely save me a few more days of messing around with this :smile:

Yup, you’re never going to be able to program this from a central point :slight_smile:

So you put the logic in the BPs, and just spawn them and say, ‘oi, here’s the spline, and your speed, go’ :slight_smile:

I made a basic ‘car’ like this

And my main BP, with the spline, looks like this:

cars

You, sir, are a genius, thank you so much for taking the time to make this! I’ve got it working now in my BP :smiley:

1 Like

Excellent :sunglasses: