Search Unity

Animator (statemachine) for Timeline?

Discussion in 'Timeline' started by DGordon, Mar 31, 2017.

  1. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    Any chance something like this is in the works? The ability to move between timelines based on params without code would be fantastic for our artists. We've been very happy with Animator for moving between animations, but timeline just opens up so many doors :).
     
  2. mikew_unity

    mikew_unity

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    99
    Yes absolutely! Since animators are built on the same underlying system that timeline uses, this is exactly where we are looking to go with the system in the future.

    Embedding timelines within state machines, state machines within timelines - all of these and more ;}

    Super exciting ;}
     
    Lazulite, Alverik and TrickyHandz like this.
  3. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    Awesome ... so you guys are going to build this in officially, correct? We're hoping to use Timeline ASAP, so I'm figuring out what custom plugins I need to think about :). If this is going to be built by Unity I'll definitely let you guys handle it ... Any idea on a rough ETA?

    Should we be expecting a lot more custom timeline plugins from you guys (ie: the lerping, etc) in an official manner, or should we be writing our own at this point with the assumption that if its not there now, we'll probably need to create it once 2017 is released? Is there any list somewhere of what is being planned for future updates to Timeline? I've already made one at the request of our artist and I'm thinking about putting in quite a bit more work to make it asset store ready ... I'm just nervous that you guys are working on something similar internally.
     
  4. mikew_unity

    mikew_unity

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    99
    Closer integration with the animation system (and it's state machines) and Timeline are definitely coming, we'll see many things added over the next few releases (and probably for the forseeable future).

    The other side of what we are starting to work on is expanding the example playables that are available to the community - things like the simple examples that we included with the preview release, reusable custom tracks are all things that we are building, but there are probably any number of different variations that we haven't though of, and are looking forward to seeing what the community creates to support the system.

    the TLDR is: we definitely anticipate that there are a wide variety of 'common' playables that people will want to use, we're trying to create a library (the 'Standard Playables' package) to give everyone a head start, but what that looks like is still a bit up in the air.
     
    Alverik likes this.
  5. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    Great. That all makes a lot of sense and definitely is exciting to hear :). My only feedback would be once you have an idea of what that library may be, to post the ideas somewhere ... that way anyone who wants to get a head start on creating custom playables doesn't have to worry about duplicating functionality you guys are building in.

    I must say, this is probably the most excited I've been about a feature in a long time (in terms of what is actually useful for our company, and not my having fun personally ;)). Its enough that we're considering delaying production for a few months in order to be able to use this ... the last I heard was a hopeful release around July ... but that could be nonsense. Any official word on this?
     
  6. mikew_unity

    mikew_unity

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    99
    My goal is to have the 'standard playables' up on github so that not only our internal teams can contribute but we can get pull requests / contributions from the community - I agree completely that Timeline is really a game changer for how you work with Unity, and the power of the playable system is what drives it all.

    2017.1 will go beta in a week or so, aiming for a June-ish release so far. I think it depends on how the beta cycle goes, there are quite a few awesome new features coming with 2017.1, but hopefully the beta process goes smoothly and we'll see this in the official release by early summer!
     
  7. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    I'm going to ask something I know I shouldn't in here and derail my own thread ... simply because I'm hoping you'll respond. Sorry :(. (To be fair ... it ties into timeline ... kinda)

    Any idea when we'll get an eta on an Octane preview/beta and/or its workflow (ie: will existing shaders such as Standard, Alloy, or Uber magically work or is there a new shader required)? I'm dying to (a) figure out if Unity + the Asset Store will basically supply shaders for Octane's rendering (thus making it far easier to set up than in other octane plugins), and (b) use it with the new timeline for pre-rendered videos :D.

    PS: Also, thank you for being so responsive. Even if you cannot say any more on the matter, its really nice to see Unity developers in contact with people on the forums. Definitely much appreciated ...
     
    Last edited: Apr 3, 2017
  8. mikew_unity

    mikew_unity

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    99
    The Otoy integration is actually under our umbrella so it's fine ;}

    We're working with them on the plugin and things are progressing, don't have a release date yet though. Currently it targets the Unity standard shader. Materials and shaders are the big challenge for any solution like this. Since Otoy (or any offline renderer) has it's own custom shader pipeline, we're trying to figure out the best solution to manage materials between the (very different) platforms. More news about the Otoy integration should start to come out soon.
     
  9. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    Sure. I will note that our artist did not want to use Octane in 3ds Max because he felt the shader set did not give enough default options to tweak and unless you have some shader knowledge, creating the right shader for the job is not simple. Whatever the final result, I'm hoping that it will be (a) user-friendly and (b) customize-able enough that we'll end up with an Asset Store full of shaders that work with octane (skies, oceans, skin, vegetation, hair, etc) if the existing one's don't work off the bat ... something like Alloy or Uber combined with the Time Of Day (etc) allows someone with next to no shader knowledge to still create a very beautiful game ... I'm hoping we'll wind up with the equivalent for Octane. The ease of use would definitely cause us to lean towards Unity for our rendering (both still and video) needs at that point ... especially when we can combine it with things like Terrain Composer, Timeline, IK solutions, etc.
     
  10. mikew_unity

    mikew_unity

    Unity Technologies

    Joined:
    Sep 27, 2016
    Posts:
    99
    Just pointing out - Octane is not meant for game rendering or 'runtime' output - it doesn't replace the normal Unity renderer for game output. It is meant for outputting rendered content from Unity.
     
  11. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    Yep. I'm only discussing pre-rendered stuff. We do still images for 2D first person adventure games.

    The main line is Mission-US. Games For Change winner, just got a second nomination for a daytime emmy, etc. My biggest gripe is they used to be built in Flash AS3 (has to run on old school machines) and we're severely limited tech wise. We're rebuilding the line in Unity now (what I'm currently working on). Just hoping that Unity + Octane lets us continue to bump up the visuals without requiring any additional time (something we're short on). Hence my hope for a variety of shaders (ie: with POM and all the goodies) that our artist can use out-of-the-box or at least out-of-the-store ;).
     
  12. hamza37102

    hamza37102

    Joined:
    May 11, 2017
    Posts:
    1
    timeline has alot of console errors
     
  13. spiraloid

    spiraloid

    Joined:
    Aug 11, 2015
    Posts:
    7
    bump for 'standard playables' up on github.
     
  14. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    222
    Hi,
    any news regarding timelines within state machines?
     
  15. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    2,210
    Any news?

    Or any news on why all the useful features of timeline seem to be not being worked on? You cant just leave it in the state it is now.
     
    zyzyx likes this.
  16. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    222
    Still very quiet here. Any kind of communication would be highly appreciated.
     
  17. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,082
    Timelines in state machines is being worked on, but it is still in the very early stages of development. It won't be in a full release until sometime in 2018, likely around mid-year.
     
    GameDevCouple_I likes this.
  18. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    222
    Thanks!
     
  19. lpiljek

    lpiljek

    Joined:
    Nov 11, 2015
    Posts:
    9
    Dear Unity team,
    Can you please finish the feature next time BEFORE you release it? I would appreciate not having to waste days of my life learning about that shiny new thing you presented so proudly only to realise that it's just a nicely wrapped box filled with confetti and is otherwise completely useless in most real-world scenarios.

    Much love,
    Luka
     
  20. thierry_unity

    thierry_unity

    Unity Technologies

    Joined:
    Jun 10, 2015
    Posts:
    182
    Hi,
    I would love to hear about theses most real-world scenarios. We are trying to cover as much as possible with timeline and it's always possible that our user would use it in way we didn't imagined yet.
    Constructive feedback is always welcome
    thanks.
     
  21. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    436
    I know this is a thread for timeline thread, and I don't want to be angsty (so sorry if it comes off that way), but I agree with the general thrust of what he said. Just take a look at the "video player not working on android" threads from a while back. Multiple threads about how it was unuseable on android for production because of a specific bug, a Unity Developer who chimed in on one of those threads stating it was known and in the process of being fixed, and then almost a year of never having a response again throughout multiple threads with many people asking what was going on because it was ruining their projects. When I asked Sales if there was any way to get direct feedback for something like that, they told me not unless I paid 15k per year for 10 seats of tech service. Our company actually implemented an entire system around this, only to have to rip it out and rebuild it using timeline + stills. There was ZERO feedback ever given on this matter throughout the entire fiasco, and this was all over something that was touted as being released properly, then admitted there was a bug, then silence on the matter for the entire duration of the project and forward. So yeah ... there really does need to be better accountability to making sure a touted feature is actually production ready, and if it isn't, some way of actually getting proper feedback on it.

    As to the specific thing the above poster was discussing ... no idea. But his general complaint is extremely valid. The closest thing I got to an answer when I had the same problem was a Sales member telling me to use the forums if I wouldn't pay over 10k since they work so well, ignoring me while I mentioned that the forums had no guarantee of a response and that it was a known bug that was supposedly being fixed that many people were inquiring into, so opening a "new" bug didn't make sense to inquire into.

    Little angsty over it still, but not towards you :).
     
  22. lpiljek

    lpiljek

    Joined:
    Nov 11, 2015
    Posts:
    9
    OK, I admit that I actually like timeline and playables (at least in concept) and there actually is a real use for timeline that works pretty well: predefined non-interactive cut scenes.
    Now if that was all it was supposed to I would congratulate you, but I was under the impression (maybe it was just wishful thinking) that it was supposed to work well with interactive gameplay too (because we are making games after all). If that was the case (and some speeches given by Unity people in various conferences suggest that it is) then don't you think it would be useful if this new animation sequencing system was compatible with that other (in fact the ONLY other) animation system in Unity? You know, the one where you can actually define the logic behind the animations.

    I realise that I'm mostly just channeling my deep hatred of the disaster that is mecanim and am now dealing with disappointment since I was really hoping timeline (and playables) would fix some of the many MANY shortcomings of the current animator system.

    In case you are genuinely interested in a real-world scenario where this might be useful (though it doesn't take much to think of one) here's the problem I currently have:
    I have a character that at specific places and times (driven by user input) has to enter an animation loop (interacting with another object, much like an example in one of Unity presentations on timeline and gameplay) that lasts until the user (or some other system) decides to stop that action at which point it needs to cleanly finish the current loop iteration and play an exit sequence.
    This logic is very simple to model in the animator state machine, but since the looping sequence involves multiple animations on multiple objects and includes audio clips that have to be synced with those animations, one could really use a sequencing tool. Except one can't because animator states don't recognise timeline sequences or any other playable for that matter and the whole state transition logic would have to be coded from scratch to make this work.
    To make matters worse, timeline doesn't even have built-in support for events the way animations do.
    So now we're stuck in that all too familiar place of having to decide wether to spend a lot of time on implementing our own solution for this problem (either a sequencer that works with existing state machine, or a state machine that works with timeline) or wait and pray Unity will someday deliver a complete feature.
     
    Last edited: Feb 27, 2018
  23. thierry_unity

    thierry_unity

    Unity Technologies

    Joined:
    Jun 10, 2015
    Posts:
    182
    I understand your frustration, and yes we are genuinely interested in constructive feedback. It is definitely one of the goals of Unity to continuously improve our features based on the usage of our users.

    From what I read here, one of the main issue is that we don't have (yet) events directly integrated with timeline. That being said, I can say that we are actively working on it's implementation and in the meantime there is a workaround where you can trigger Animation events created on clips. I totally agree that it's not super elegant but at least it should help for current development until we come with our official implemented solution of events.

    For Timeline in state machines the way you want to use it, unfortunately it's not a trivial fix. We have it planned for the future but we don't have a generic solution. Only solution you have for that use-case is to create your own manager at the moment that would handle the blends on tracks and also manage the loops and exit of timelines.

    -- Edit --
    here is a script made by one of our devs that will probably help you out and basically does what I'm talking about

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.Playables;
    5. using UnityEngine.Timeline;
    6. using UnityEngine.Animations;
    7.  
    8. public class PlayTimeline : StateMachineBehaviour {
    9.  
    10.     public TimelineAsset timeline;
    11.     PlayableGraph graph;
    12.     AnimationPlayableOutput output;
    13.  
    14.     private void SetWeight(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    15.     {
    16.         float weight = 1.0f;
    17.         if(animator.IsInTransition(layerIndex))
    18.         {
    19.             float transitionWeight = animator.GetAnimatorTransitionInfo(layerIndex).normalizedTime;
    20.             if (animator.GetCurrentAnimatorStateInfo(layerIndex).fullPathHash == stateInfo.fullPathHash)
    21.             {
    22.                 weight = 1.0f - transitionWeight;
    23.             }
    24.             else
    25.             {
    26.                 weight = transitionWeight;
    27.             }
    28.          
    29.         }
    30.  
    31.         output.SetWeight(weight);
    32.     }
    33.      // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    34.     override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    35.  
    36.         graph = PlayableGraph.Create();
    37.         output = AnimationPlayableOutput.Create(graph, "animation", animator);
    38.         var playable = timeline.CreatePlayable(graph, animator.gameObject);                        
    39.         output.SetSourcePlayable(playable);
    40.         output.SetSourceInputPort(0);
    41.         SetWeight(animator, stateInfo,layerIndex);
    42.        // graph.Prepare(0);
    43.         graph.Play();
    44.  
    45.     }
    46.  
    47.     // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    48.     override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    49.     {
    50.         SetWeight(animator, stateInfo, layerIndex);
    51.     }
    52.  
    53.     // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    54.     override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    55.     {
    56.         graph.Destroy();
    57.     }
    58.  
    59. }
    60.  
     
    Last edited: Feb 27, 2018
    fbittner likes this.
  24. lpiljek

    lpiljek

    Joined:
    Nov 11, 2015
    Posts:
    9
    Thanks for the effort. The problem is that I have to let the animation finish before transitioning state, so in a way I have to trigger the transition when the timeline sequence is done. Any advice regarding that?
    I can think of a couple of ways, but I'm not really getting excited about any of them.
     
  25. pierrepaul

    pierrepaul

    Unity Technologies

    Joined:
    Jun 19, 2012
    Posts:
    162
    What you need to do, is create a Trigger Parameter that will make the State change. Then in the StateMachineBehaviour provided by Thierry simply check the percentage of progression in the Timeline and set the Trigger to true (ie animator.SetTrigger(mTrigger)) when you want the change to happen.
     
    fbittner and thierry_unity like this.
  26. bullyentertainment

    bullyentertainment

    Joined:
    May 29, 2015
    Posts:
    5
    Hi, sorry for bumping year old thread, but it's first one that Google picks up on this topic.

    What is the current status on "timelines inside state machines" feature?

    I can see the Playable's repository and documentation already landed which is awesome - so we can hack timeline state machines using playable graphs similar to what sample code provided above does, or using trigger-jump-tracks on single timeline.

    Also in roadmap there is "Timeline Signals" which is really nice, but no mention on this feature - is it still in plans to have official support for timelines driven by mechanim state machines, may a link for community voting on it?
     
  27. JamesB

    JamesB

    Unity Technologies

    Joined:
    Feb 21, 2012
    Posts:
    112
    @bullyentertainment

    *** WARNING SPECULATION AHEAD - NOT OFFICIAL***

    So far as I know (I don't work on the Timeline or Statemachine features) there doesn't seem to be a plan to implement a statemachine which can play and blend timelines. I have made a VERY rough project which has some of the features of the animator's statemachine but works for timelines instead. It has states, transitions and parameters but instead of animation clips it uses timelines. The transitions blend animation and audio tracks but that's it. It's also completely untested. My original intention was to create it as a prototype, present it in a talk at Unite and gauge people's reaction as to how useful a feature it would be. This would mean that the appropriate people could consider it for official development.

    However, Unity is moving to a DOTS architecture for the future and so both the animation and timeline systems will be doing the same. As such it seems unlikely that a timeline statemachine will ever be a feature for the current iteration of Timeline/Animator. Because of this, making a prototype is a little pointless now and so I've halted development on my project (I was only doing it in my spare time anyway). Whilst this might be a little frustrating now, in the long run this is better. I have spoken with a lot of the people involved with development and they are aware of how useful a feature it would be and I hope they will keep it mind when developing using the new architecture.

    I'd like to reiterate that I'm NOT on the development teams involved and so anything here is not official and just what I have learned from casual conversation.
     
    createtheimaginable likes this.
  28. leobatista21

    leobatista21

    Joined:
    Sep 22, 2013
    Posts:
    1
    @JamesB,

    Perhaps you could share your project with community! It would be an opportunity to get more examples using timelines for game logics.

    For instance, how can I expose binding properties to make a custom monobehaviour like Playable Director that instantiates more than one timeline?

    In my case I'm using timelines as sources for generic abilities. Instead of having all the character logic at a monolithic state machine I'm trying to split it in abilities (actions that an actor performs when it receives an external command while all conditions inside a list are true).

    For this purpose I'm trying to create a generic Class "Ability" that extends from "ScriptableObjects" and contains a list of timeline assets. Each ability can be instantiated (like a timeline asset at a Playable Director) by an actor component trough a list of abilities. In theory, designers will implement new generic abilities (jump, roll, slide, kick) just by creating a new one at Assets Menu, giving a name and a timeline asset (the logic will live inside timeline). They will be able to add abilities to an actor just by dragging it from the assets.

    This way an actor can be much more flexible. While a Zombie (character actor instance) can performs abilities like "idle", "walk", "attack" and "die", a Hero (character actor instance) can performs "idle", "walk", "run", "jump", "roll", "slide". Maybe an obstacle actor or a weapon actor could "teachs" a character how to perform when a collision ocurrs or when a mode is active... thanks to Scriptable Objects!

    The abilities described above should be mixed at runtime to make sense, otherwise transitions between animation outputs from each timeline will look very very ugly. So how to manipulate timeline transitions mantaining the "template" aspect? How to do that from a non-linear way?

    One great feature that could be implemented this way (using timeline as source of logic) would be "motion matching"!

    Imagine a looped timeline used for a "CharacterRun" ability. While the character is running is possible to jump (other ability) at any time. How to performs a smooth and highly responsive jump for each foot? How the future ability could know about current pose? Obviously a generic link between abilities would be necessary. Custom marks!

    Custom marks could store the frame for each ideal pose (defined by designer) and pass it to an external ability manager saying something like "hey, here is when the right foot touches the ground, at frame #100". The manager could calculate de distance (in frames) to the nearest mark (ideal) at the moment of transition (current) then pass mark and distance in frames from current to ideal moment.

    In this case, the jump ability could store a clip for each "type" of jump at its animation track: "RunningJumpFromRighFoot", "RunningJumpFromLeftFoot" with custom marks that match moment names (RightFootGroundTouch, LeftFootGroundTouch). There would't necessary a perfect pose alignment because the abilities mixer would handle the small gaps.

    For jumps from walking or idle the same wokflow could be applyed (WalkingJumpFromRightFoot, WalkingJumpFromLeftFoot, IdleJump)

    Timelines open a bunch of possibilities for game design. A way to easily control transitions between timelines without losing the aspect of template (witch is its purpose) would be a nice feature for game designers.
     
  29. JamesB

    JamesB

    Unity Technologies

    Joined:
    Feb 21, 2012
    Posts:
    112
    @leobatista21

    Thanks for your interest. It's not really ready for user consumption - by any standards really. The groundwork I had been using was flawed and so I've started again with a better approach. I plan on continuing to work on this when I have time and I will release it to the public when I'm done. However, as I believe I already said, this isn't my day job so progress might be slow going. I'll update this thread when I have more.
     
    leobatista21 likes this.