⭐ Unreal Engine/UE RPG Blueprint

[UE] Behavior Tree 3, Spline(Bezier, Catmull-Rom)

Designerd 2023. 2. 22. 09:27

 

언리얼 엔진에서 동작 트리를 만들려면 노드를 끌어다 놓아 트리 구조를 만들 수 있는 동작 트리 편집기를 사용할 수 있다. C++ 또는 Blueprint 스크립팅을 사용하여 사용자 지정 작업 및 장식자 노드를 정의할 수도 있다.

 

목차

     

     


     

     

     

     

     

    Spline -  Bezier vs. Catmull-Rom

     

    캣멀롬 스플라인은 보간 스플라인의 한 종류로서 제어점을 뚫는 모양을 가진다. 

    캣멀롬 스플라인은 네 개의 점 사이를 보간한다.

     

    https://tsyang.tistory.com/57

     

    https://blog.naver.com/PostView.nhn?isHttpsRedirect=true&blogId=sorkelf&logNo=40154552485 

     

     


     

    Behavior Tree - Patrol (+Spline Path)

     

    0. BP_Enemy
    - StateComponent
    BP_AIController_Melee 0. BB_AI
    0. BT_Melee
    1. BP_Enemy_AI
    - WeaponComponent
    - MovingComponent
    - BehaviorTree (Behavior Tree)
    ---------------------
    0. BP_PatrolPath
    ---------------------
    1. BTService_Melee
    2. BP_Enemy_AI_Melee -------------------------
    0. PatrolComponent
    -------------------------
    2. BTTask_Speed
    2. BTTask_Patrol

     

     


     

    0. BP_PatrolPath 생성

     

    Blueprint Class - Actor - BP_PatrolPath 생성

     

    Viewport

    • 컴포넌트 추가 - Spline, TextRender
      • Spline: 위치(0, 0, 30)으로 수정. 
      • TextRender: 트랜스폼 수정. 텍스트 가운데 정렬. 텍스트 색 빨강으로 변경. 

     

    Construction Script

    • Construction Script의 특징
      • Construction Script는 블루프린트의 생성자 정도로 생각하면 된다.
      • 배치가 되거나 생성이 되거나 멤버값이 바뀔 때 호출된다.
    • 변수 생성: Loop (Boolean)
      • Patrol Path에 따라 이동할 때 Loop 여부를 체크하기 위해 만든 변수.

     


     

    0. Patrol Component 생성

     

    Blueprint Class - Actor Component - Patrol Component 생성

     

     

    Is Valid Path (pure)

    • Is Valid Path (pure) 함수 생성.
      • 지정해준 Path가 유효한지 확인해주는 함수. 리턴전용으로 만들어준다.
    • 출력 추가: ReturnValue (Boolean)

     

     

    Get Move To (pure)

    • Get Move To (pure) 함수 생성.
      • IsValidPath로 Path가 유효한지 검사.
        • True라면 Path의 Spline을 따라 이동한다. Get Location at Spline Point는 Spline Point Index의 위치를 리턴해준다.
        • False라면 바로 리턴한다.
    • 출력 추가: Out Result (Boolean), OutLocation (Vector)
      • OutLocation: Spline Point 위치를 리턴한다.

     

     

    Update Next Index

    • 변수 생성: Path (BP_PatrolPath), Update (Integer), Reserve (Boolean)
    • 로컬변수 생성: Count (Integer)

     


     

    2. BP_Enemy_AI_Melee

     

    • Patrol Component 추가

     

     

     


     

    2. BTTask_Patrol 

     

    Drawing

    • Drawing 함수 추가
      • 움직일 곳을 Debugging용으로 보여줄 함수.
      • 체크용으로 사용하는 것이라 추후에 숨기거나 삭제한다.

     

     

    Event Graph

    확대

    • 변수 생성: RandomDistance (Float), Location (Vector), AcceptanceRadius (Float), DrawDebug (Boolean)

     


     

    0. BT_Melee

     


     

     

    실행화면

     

     


     

     

     

     

    Behavior Tree - Equip

     

    0. BP_Enemy
    - StateComponent
    BP_AIController_Melee 0. BB_AI
    0. BT_Melee
    1. BP_Enemy_AI
    - WeaponComponent
    - MovingComponent
    - BehaviorTree (Behavior Tree)
    ---------------------
    0. BP_PatrolPath
    ---------------------
    1. BTService_Melee
    2. BP_Enemy_AI_Melee -------------------------
    0. PatrolComponent
    -------------------------
    2. BTTask_Speed
    2. BTTask_Patrol
    2. BTTask_Equip

     


     

    2. BP_Enemy_AI_Melee

     

    • WeaponComponent - Default - Weapon Classes
      • 슬롯 8개 생성 후 2번 위치에 Combo_Sword 지정 

     

     

    Weapon Component - Get Current Type 함수 생성

     

    Get Current Type 함수 생성

     


     

    2. BTTask_Equip 생성

     

    Event Graph

    • Receive Execute AI 이벤트, Receive Tick AI 이벤트 생성
    • 변수 생성: WeaponType (EWeaponType) 
    • Receive Tick AI 이벤트 상태 체크
      • Weapon - In Equipping이 False인지 체크
      • Is Idle Mode인지 체크
      • 아래의 이미지 참고 

     

    참고) Weapon의 End_Equip 함수

     


     

    0. BT_Melee

     

    • Action Sequence 추가

     

    실행화면

     

     

     

     

     


     

     

    ABP: Animation Blueprint
    AN: Blueprint Class AnimNotify
    ANS: Blueprint Class - AnimNotifyState

    AO: Aim Offset

    BP: Blueprint Class
    BS: Blend Space

    BF: Blueprint Function Library
    CS: Matinee Camera Shake
    E: Enum 열거형
    DT: Data Table
    F: 구조체

    I: Blueprint Interface

    WB: Widget Bluepprint

     

    UE2212_02

      Level - LEVEL
    ABP_Player
    BP_GameMode
    BF_Helper
    IDamage
     
    AdvancedMagicFX12
    Materials  
    Meshes  
    Particles  
    Textures  
    Character Animation Bow
    Common
    Fist
    Hammer
    Parkour
    Sword
    Unarmed
    Wizard
    BlendSpaces BS_Bow
    BS_Fist
    BS_Hammer
    BS_Sword

    BS_Unarmed
    BS_Wizard
    Materials

    MaterialLayers
    M_UE4Man_Body
    M_UE4Man_ChestLogo
    Mesh SK_Mannequin
    SK_MAnnequin_PhysicsAsset
    Skel_Mannequin

    Montages
    Around Around_Montage
    Bow AR_DrawBow_Montage
    AR_ShootAndDraw_Montage
    Common HitReaction_Move_Montage
    HitReaction_Stop_Montage
    Fist Fist_Attack_1_Montage
    Fist_Attack_2_Montage
    Fist_Attack_3_Montage
    Fist_Hitted_Montage
    Hammer Frank_RPG_2Hand_Combo01_1_Montage
    Frank_RPG_2Hand_Combo01_2_Montage
    Frank_RPG_2Hand_Combo01_3_Montage
    Frank_RPG_2Hand_Combo01_4_Montage
    Parkour Run_Climb_Montage
    Sword Draw_Sword_Montage
    Sword_Attack_1_Montage
    Sword_Attack_2_Montage
    Sword_Attack_3_Montage
    Warp Warp_Montage
    Enemy_DeadFall_Montage
    HitReaction_Montage
     
    Textures UE4_LOGO_CARD
    UE4_Mannequin__normals
    UE4_Mannequin_MAT_MASKA
    UE4Man_Logo_N
    Weapons Elven Bow
    Greate Hammer
    Sword
    Component EStateType
    MovingComponent
    StateComponent
    WeaponComponent
    FeetComponent
    TargetComponent
       
    Effects P_Cube_Mesh_Test
    P_Genno_Weapon_Lightning_01
       
    Enemies Basic BP_AIController_Basic
    BP_Enemy_AI_Basic
    BT_Basic
    BT_Move
     
    Melee BP_AIController_Melee
    BP_Enemy_AI_Melee
    BP_PatrolPath

    BT_Melee
    BTService_Melee
    BTTask_Patrol
    PatrolComponent
     
    Tasks BTTask_Speed
    BTTask_Equip
     
    BB_AI
    BP_Enemy
    BP_Enemy_AI
       
    Environment
    Materials Textures  
    Meshes    
    Obstacle    
    InfinityBladeEffects
    Effects
    FX_Combat_Base  
    FX_Materials  
    FX_Meshes  
    FX_Monsters  
    FX_Textures  
    FX_Textures_IB  
    Masters  
    Materials M_Mesh
    M_White_Inst
    M_Red_Inst
    M_Green_Inst
    M_Blue_Inst
    M_UE4Man_Body_Inst
    M_UE4Man_ChesLogo_Inst
       
    Meshes Cone_2
    Cube_2
    Cylinder_2
    Sphere_2
       
    Notifies ANS_Equip
    ANS_Combo
    ANS_Collision
    AN_BeginAction
    AN_EndAction
    AN_CameraShake
    AN_End_BowString
    AN_EndParkour
       
    Parkour EParkourArrowType
    EParkourType
    FParkourData
    ParkourComponent
    ParkourData
       
    Player BP_Player
    FZoomData
       
    Sounds S_BGM
    S_HitPunch
    S_OneHand_Hit
       
    Textures Crosshair
    T_Around
    T_Black
    T_Bow
    T_Fireball
    T_Fist
    T_Hammer
    T_Sword
    T_Warp
       

     
    Weapons
    Around Around_FireBall
    Around_FireBall1
    Around_IceBall
    Around_IceBall1
    DT_DoAction_Around
    DT_Equip_Around
    DT_HitData_Around
    Skill_Around
    Weapon_Around
     
    Bow AO_Aim
    Curve_Aim
    DT_DoAction_Bow

    DT_Equip_Bow
    DT_HitData_Bow
    FAimData
    Skill_Aim
    Skill_Arrow
    Weapon_Bow

     
    FireBall DT_DoAction_FireBall
    DT_Equip_FireBall
    DT_HitData_FireBall

    Skill_FireBall
    Weapon_FireBall
     
    Fist Combo_Fist - Blueprint Class Actor Weapon_Combo 상속
    CS_Fist
    DT_DoAction_Fist

    DT_Equip_Fist
    DT_HitData_Fist
     
    Hammer Combo_Fist - Blueprint Class Actor Weapon_Combo 상속
    CS_Hammer
    DT_DoAction_Hammer
    DT_Equip_Hammer
    DT_HitData_Hammer

     
    Sword Combo_Sword - Blueprint Class Actor Weapon_Combo 상속
    CS_Sword
    DT_DoAction_Sword
    DT_Equip_Sword
    DT_HitData_Sword
     
    Warp Weapon_Warp -  Blueprint Class Actor Weapon 상속
    DT_DoAction_Warp

    DT_Equip_Warp
     
    EWeaponType
    FDoActionData
    FEquipData
    FHitData
    Weapon - Blueprint Class Actor
    Weapon_Combo - Blueprint Class Actor Weapon 상속
    M_Weapon
    Skill
       
    Widget WB_CrossHair
    WB_Menu
    WB_MenuButton
    WB_Name