Announcement

Collapse
No announcement yet.

UFSM: Finite State Machine

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    No problemo, cheers! Whereabouts is the debug checkbox?

    You could also output an error string from the state change node instead, which might be a better solution since I'd like to log them at runtime as well.

    Leave a comment:


  • replied
    Originally posted by Antidamage View Post
    I'm getting an aborted state change and I'm not sure why. The state name exists. Is there a way to debug it or push out a reason for the abort?
    I could add PIE Warning there.
    I will take a look today, that will require "Debug" checkbox enabled tho.

    Leave a comment:


  • replied
    I'm getting an aborted state change and I'm not sure why. The state name exists. Is there a way to debug it or push out a reason for the abort?

    Leave a comment:


  • replied
    Great, thanks!

    Leave a comment:


  • replied
    Originally posted by MajorFailure View Post
    Hello, the launcher is showing an update to UFSM, what are the changes please?

    Thanks.
    Minor Bug Fix:

    "Auto Activate" checkbox disabled had no effect on UE4.18 ~ UE4.19.
    Now if "Auto Activate" on FSM Component is unchecked, the FSM won't run until you call SetActive() function for that FSM Component.

    In case you uncheck "Auto Activate" in Editor, when enabling the FSM Component again, make sure you do a 'full' initialization, like so:
    Code:
    SetActive(true,false);
    SetIsReplicated(true);
    SetComponentTickEnabled(true);
    Last edited by BrUnO XaVIeR; 06-15-2018, 10:23 AM.

    Leave a comment:


  • replied
    Hello, the launcher is showing an update to UFSM, what are the changes please?

    Thanks.

    Leave a comment:


  • replied
    I have added automatic State Transitions to the "Auto Flow" schema of FSM Component Blueprints.
    This has the exactly same result of you creating your own rule functions in Animation BP or BP Graph, but the difference is you don't have to call them ("Set State" nodes) manually if you choose to enable this option for your project.
    Although having the same effect, the way you design your Graphs might change when going this route:




    They are grouped in Graph and prefixed with "<T>" followed by the State they are linked to.
    Whenever the "Condition" result evaluates to "Succeeded" the FSM Component will trigger an Exit from Transition's owner State (if that State is the currently active one) to the target State this trasition rule is pointing to (pretty much what Animation BP does, but with all Blueprint functions available to be used in the Graph).

    If you choose to go this design pattern then the various helper "Evaluate" nodes are your friends here as well:




    .

    To enable this execution mode on your FSM Components, you'll have to check to true the "Blueprint Auto Flow Transitions" on Project Settings Panel, as well as keeping "Blueprint Auto Flow FSM" enabled too:





    Again, note that this basically inutilizes the "Set States" nodes if you design your FSM with this pattern, but it doesn't prohibits you from keeping using them wherever you see fit. The "+Functions" button (only useful for FSM Blueprints) will also automatically generate transition functions for you if it sees you have checked "Blueprint Auto Flow Transitions" enabled.



    This and fixed bug mentioned on previous post above will be in version 1.8.0 (for UE4.18+).
    Last edited by BrUnO XaVIeR; 05-16-2018, 07:13 PM.

    Leave a comment:


  • replied
    Originally posted by Vaei View Post
    One more thing though.. why the byte instead of a float here? Edit: Since you can use FSM: Get time it doesn't matter but I'm curious

    https://i.imgur.com/kOPocAv.png
    Thank you for showing me this!
    This is actually a BUG in the #WITH_EDITOR reflection code (where I generate new functions from), I picked wrong type wildcard when that node is generated :s
    I have fixed and will add to next update as well.

    Leave a comment:


  • replied
    Yes, no problem.
    Once I come back from another task I add that.

    Leave a comment:


  • replied
    Do you think you could add something for me? To allow us to use a CPP enum instead of a BP enum. Because if I want all the BP auto flow functionality and in rare cases to check values in CPP it means creating same enum twice. I'll provide example logic.


    .h
    Code:
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing")
    bool bEnumFromCPP;
    
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing", meta = (EditCondition = "bEnumFromCPP"))
    FString EnumName;
    
    UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing", meta = (EditCondition = "!bEnumFromCPP", DisplayName = "Enum"))
    UEnum* K2_Enum;
    
    UPROPERTY()
    Enum* Enum;
    
    #if WITH_EDITOR
    virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
    #endif  // WITH_EDITOR
    
    FORCEINLINE UEnum* GetEnum() const
    {
        return (bEnumFromCPP) ? Enum : K2_Enum;
    }
    .cpp
    Code:
    #if WITH_EDITOR
    static UEnum* EnumFromString(FString EnumString)
    {
        return FindObject<UEnum>((UObject*)ANY_PACKAGE, *EnumString, true);
    }
    
    void UMyThing::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
    {
        Super::PostEditChangeProperty(PropertyChangedEvent);
    
        const bool bFromToggleCPP = GET_MEMBER_NAME_CHECKED(UMyThing, bEnumFromCPP).IsEqual(PropertyChangedEvent.GetPropertyName());
        const bool bFromEnumName = GET_MEMBER_NAME_CHECKED(UMyThing, EnumName).IsEqual(PropertyChangedEvent.GetPropertyName());
    
        if((bFromToggleCPP && bEnumFromCPP) || bFromEnumName)
        {
            Enum = EnumFromString(EnumName);
        }
    }
    #endif  // WITH_EDITOR

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post

    It needs a custom "Factory".
    To use the custom Asset Factory, you have to right click Asset Browser and click this Icon to create a custom Blueprint:

    Ahh I get it now. Thanks!

    One more thing though.. why the byte instead of a float here? Edit: Since you can use FSM: Get time it doesn't matter but I'm curious

    https://i.imgur.com/kOPocAv.png

    Edit: My god, blueprints actually feel like a viable option for involved systems with this
    Last edited by Vaei; 05-14-2018, 08:02 PM.

    Leave a comment:


  • replied
    Originally posted by Vaei View Post
    By the way, I can't subclass Finite State Machine - it's needed for auto-flow right?

    https://i.imgur.com/YEBmUfF.png
    It needs a custom "Factory".
    To use the custom Asset Factory, you have to right click Asset Browser and click this Icon to create a custom Blueprint:

    Leave a comment:


  • replied
    By the way, I can't subclass Finite State Machine - it's needed for auto-flow right?

    https://i.imgur.com/YEBmUfF.png

    Leave a comment:


  • replied
    Originally posted by Vaei View Post
    Can I run an idea by you - for using the anim node graph you require a skeletal mesh + anim instance - so what if I add a skeletal mesh component that never has a mesh + an anim instance with a dummy skeleton purely for the use of the state machine? Is there any reason this isn't a good way to do it?
    I've seen a designer do something like that before; I'm not sure exactly the "hacks" he did, but it works wonders because he hate to create his own "transition rule" functions in the Blueprint graph.


    Originally posted by Vaei View Post
    Perhaps one day in the future you could consider adding a custom graph that doesn't require a skeletal mesh or anim instance but mimics anim instance Dungeon architect might be a good example of reusing graphs for plugin functionality
    I actually do have a custom Graph. But it's buggy like hell xD
    The problem is I was "taken away" from working on it because a project had to focus on actual gameplay stuff instead of Editor extensions.

    So I can't work on it at the moment to make it really usable, but I didn't give up on that and someday I will make it public
    Meanwhile, I think I can also add to function generator button a way to generate "transition rule" functions in the BP graphs for the non hierarchical FSM Component while I can't work on that one.

    Leave a comment:


  • replied
    Originally posted by BrUnO XaVIeR View Post

    A few posts above explain that "auto flow" only works when you create a Blueprint for your FSM Component then attach it to an Actor.

    The settings can be found on Project Settings panel.

    HFsm was removed and being reworked; Will be back only when all bugs are removed and docs redone.
    Thank you - was that in the docs and I just missed it?

    Can I run an idea by you - for using the anim node graph you require a skeletal mesh + anim instance - so what if I add a skeletal mesh component that never has a mesh + an anim instance with a dummy skeleton purely for the use of the state machine? Is there any reason this isn't a good way to do it?

    Perhaps one day in the future you could consider adding a custom graph that doesn't require a skeletal mesh or anim instance but mimics anim instance Dungeon architect might be a good example of reusing graphs for plugin functionality
    Last edited by Vaei; 05-14-2018, 05:51 PM.

    Leave a comment:

Working...
X