[Open Beta] Procedural On-the-Fly Animation in UE4: iTween!

Well, I plan to use iTween also (btw thanks for new release, I will try it asap).

My problem is actually the number of moving actors. I am close to “Event tick” limit and kill fps for a lot of small animated objects (simple rotation/translations to a point and back).

I’ve also started a thread, asking what can be the best way to avoid this:

Some peoples suggest to put a big colider on pawn and check against to disable/enable those small anims actors. However, I don’t think this is the best method. I am not sure if is simple to access/use spatial partition of engine, octree or whatever UE is using, putting all those objects and disable/enable based on visibility probable can be much better. But this is just an idea.

Also, the need to have over 100 iTweens objects is not something not realistic, if you think for a big level this number is nothing.

Hello ,
Great update, will check it out asap!

Many tnx!

Greetz,
G

That gets me thinking, it might be possible to automate that process for you. I can’t make any promises, but pending the API, maybe we can have the tween run all the time but only update its object’s transform if the object is being rendered. I’ll investigate this for you and if it’s possible it’ll be in the next release!

I hope it makes your workflow more productive!

If you fallow that route, there should be a setting for iTween like “cullable yes/no”, basically, you want to update a lift even if it’s not visible, but you don’t want to update an iTween for a rotating lamp in a room if it’s not visible. So user’s can chose what’s important for update and what’s not.

If you can make this happen you are golden, basically, you remove the limit of iTween objects in a map.

Well of course, customization options are a big part of iTween. It would have to be optional exactly for cases like you describe. But the way I want to do it is to have the tween run whether or not the object is rendered, the object just wouldn’t be updated unless it were rendered. So when the object came into the camera frustrum again, it would be exactly where it would be had you been looking at it the whole time. The only issue is “popping” where the object might snap to its new transform on-camera. I’m not sure if that can be mitigated.

:)!

Though it’s relatively simple, just wanted to share a method I worked out for float iTweens I wanted to run once when relevant, that’s far more elegant than the mess of ‘do once’ nodes that required a mass of reset lines traveling everywhere.
You want to check if the tween is not already valid (it’s not running), and also check that the value you’re setting is not already at the end value (so it won’t repeat itself after the tween is completed).


is a before and after of my mess of do once/reset lines going everywhere before swapping it out for this, so much better :D.
Before
After

Simply awesome stuff there, can’t wait to see more.

Hello ,

A question / suggestion;

Currently TweenEvents are based off Actors. Would it be (relative simply???) possible to let TweenEvents extend ActorComponents instead?
I think this would get rid of lot of unneeded Actor overhead and could improve performance when tweening lots and lots of objects…

I haven’t done any extensive research on this, but this idea popped up while coding my project. (I need to spawn lots of bullets)

What do you think about this?

Greetz,

G

Whoa, good stuff there Swift. I’m not sure I 100% understand what you’re going for, but if it works that’s the most important factor :slight_smile:

Thanks, ! Feel free to use iTween in! I’d love to see what your team can come up with.

Hey again gpvd,

yes, I’ve been toying around with this idea since 4.7P8. However I will not be moving iTween over to this system just yet. It’s definitely a possibility in the future since I have the code mostly written for it, but I won’t be doing this for three reasons:

  • It won’t work for Slate or UMG because they do not accept SceneComponents or ActorComponents as they are a different branch or UObject
  • Of course we could make it the way for just Actors. This is the way iTween for Unity does it, tweens as an attachable component. However, I have not seen any actual performance gain from this method yet. I will continue to test as time goes on, but
  • this will fundamentally change the workflow for users which is something that I’m hesitant to do if it won’t benefit performance.

However this idea is far from out the window. I always want iTween to be as fast as possible while still offering all the options I can, so this may make the release as ActorComponents get more and more performance passes by Epic and the community.

In your situation, if you are spawning bullets whilst shooting a gun, I think the physics system might be more appropriate than iTween. But I don’t know exactly how your project operates, so it’s only a suggestion!

Thanks, gpvd!

Tnx for the explanation;

I now better understand the impact when overhauling the system to make iTweenEvents components…
About bullets you’re right when doing simple forward movement.
But, i want to do additional movement behaviour on the bullets e.g. Nice sinus move, spiralling etc
, and i think iTween is great for that job!

Greetz,
G

Hello again,

I’ve got some questions about looptype = ‘rewind’ and calling pause tween in OnTweenLoop…

The setup i use right now in Blueprint:

  • added interface iTInterface to actor

  • Create a move actor to tween.

    • tweenName = Unique name
    • actorToMove = reference to self
    • locationFrom = actorLocation
    • locationTo = random Vector
    • tickType = seconds
    • loopType = rewind
    • tickTypeValue = random float
    • onTweenLoopTarget = reference to self
    • The rest of the props are default.
  • Implemented event OnTweenLoop
    When the tween is done with a loop and OnTweenLoop is called, i do the following;

    • call PauseTweeningByTweenName

However, the tween keeps updating…
I think i narrowed it down to the functions:
- AiTweenEvent::LoopWithDelay()
- AiTweenEvent::LoopWithoutDelay()
In both these functions the bool shouldTick is eventually set to true.

The case is when a tween is rewinded and OnTweenLoop is called, and in that OnTweenLoop the tween is paused,
shouldTick is set to true, because after OnTweenLoop is called, AiTweenEvent::LoopWithDelay() or AiTweenEvent::LoopWithoutDelay() is called
,thus resetting shouldTick to true.

I tackled this problem basicly by adding bool bIsTweenPaused, which is used in conjunction with bool shouldTick.
See the code for the details.

Phew, after this long introduction, my question(s)…

Is this a correct modification, or did i forget something?
If you find this a needfull addition, could you implement this in a next update?
While it is open source, i don’t know wether i’m allowed to modify the code due to licensing…
So if i did something wrong , will you let me know this?

Many thanks in advance

Greetz,
G


iTweenEvent.h
 	//--- Added property bIsTweenPaused
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Generic Properties")
		bool bIsTweenPaused = false;
       



void AiTweenEvent::InitEvent()
	//--- Added to beginning of function...
	alpha = 0.f;
	shouldTween = false;
	firstSet = false;

        ... //--- Rest of original code

        shouldTick = true; //--- Original code
        bIsPaused = false; //--- Added  


void AiTweenEvent::LoopWithDelay()
        //--- Replaced shouldTick = true; with:
	shouldTick = !bIsTweenPaused;


void AiTweenEvent::LoopWithoutDelay()
        //--- Replaced shouldTick = true; with:
	shouldTick = !bIsTweenPaused;




//--- Did a search on every occurence of shouldTick.
//--- Where shouldTicck is set to true ,i added bIsPaused = false and vice versa.

//--- for example; 
void UiTween::PauseAllTweens()
{
	for (AiTweenEvent* e : GetAux()->currentTweens)
	{
		e->shouldTick = false;
		e->bIsTweenPaused = true;	//--- Added
	}
}


Whoops! Sometimes there’s an oversight. Thanks for catching that, gpvd. I’m not sure how I missed that, but it’s a pretty glaring exception. I absolutely will be including this in the next release and we really appreciate you taking your time to tell us about it.

As for licensing, iTween’s UE4 implementation is more or less copyleft, meaning you can modify, redistribute, and reverse-engineer as you see fit. You don’t even have to mention iTween in your credits, though we’d love it if you did. It’s a 100% free license to do with the software whatever you please. Change the source, send it to a friend, use it in commercial, free, or edutainment games, torrent it, put it on a floppy disk and burn it, we don’t care.

The only two exceptions are if you try to sell iTween or sell a marketplace package that uses and includes iTween without first talking to us about it. In effect, though you may sell a marketplace item that uses iTween, it may not come with the package. It must link to our website/PixelPlacement/this forum thread for users to download unless an agreement is made beforehand. That isn’t allowed by our license. Again, that only applies to packages that users can use to implement things in their games and apps. You may absolutely sell a packaged game that uses iTween.

Many tnx again for the quick response!.

Greetz,
G

I’ve searched through the wiki and couldn’t find the information anywhere, I’d really appreciate finding out how to resolve the issue of built projects with the “Plugin ‘iTween’ failed to load because module ‘iTween’ could not be found.” issue? Do you need to try and build itween in 32bit and put it in one of the folders or something?

To build with plugins you have to include the module in your Build.cs file and also your project can’t be a ‘Blueprint Only’ project; should have at least one empty C++ class.

Hey Swift, when you say “built” projects, what do you mean? Are you talking about deployed standalone games? Or is this in editor? Can you post a screenshot?

Thanks for your quick response, I think it’s as Bruno says, however I have no idea how that is setup and haven’t found any information at all on it, how do I add the module to the build.cs file and create an empty c++ class for the project?
I’m talking about a deployed standalone game, 's a screenshot of what comes up - Screenshot - 63f29fa36efa8ffccc7ab098ab3efcc1 - Gyazo.

You know, I’ve never actually built a game in UE4 using the plugin version of iTween, I always install the source version, so I may have overlooked something!

When you install iTween, it’s supposed to update your project’s Build.cs for you with all of the necessary dependencies. It may be possible that when installing the plugin version this step does not occur, though it shouldn’t work in the editor if that were the case. I’m out of town today, but tomorrow I will be in-office and will get to the bottom of this by doing some testing and get back to you with a solution asap.

No worries at all, thank you very much for checking up on this when you can :).
I’ve tried converting a project to C++ (via the guide I ended up finding - A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums) and found how to add an empty class, but it had iTween compile errors with the plugin installed as just BP, and when installed with “C++ User or Both” option the plugin seemed to have not been installed at all (or at least it wasn’t available via blueprints and it didn’t show up in the installed plugins window).

Is there an easy way to have the animated objects bounce per collision, or apply gravity and physics, or use random locations in a vector radius?