Does AI & Behavior Trees works with 2D sprites???

Hello… i am about to start AI & Behavior tree section but just wanted to ask does this support 2D (sprite)… like animation blueprint doesn’t support to create 2D animation states so had this doubt if is this AI & Behavior Tree supports 2D sprite or not??? currently I am using 4.7.3 and downloading 4.8.1 gonna work in it don’t know yet that 4.8 animation and AI behavior tree supports 2D sprites yet or not…

Yes. Neither are tied to the visual representation of things and should work for any type of game. Note: Navmesh in particular is designed around XY traversal, while the default for Paper2D is XZ, but you can rotate sprites if you want to use navmesh in a top down game, or create jump links if you want to use it for a 2d side scroller.

Cheers,
Michael Noland

Hello thank you for reply…but also wanted to ask does animation blueprint supports 2D sprites to blend animation like we do for 3D characters animation states??? cause in documents and also Alan noon saying that Animation BP doesn’t supports 2D sprites. right now I am using UE 4.8.

is this true for animgraph’s state machine system too?
o’d like to use them for other things too.

I guess documents haven’t updated yet

Animation Blueprints are not usable for flipbook based animations, and there is no way to build a skeleton from scratch in the editor right now. You can use the animation system for 2D characters, but you would have to author them as either visible or invisible skeletal meshes in an external art package like Max/Maya/Blender. With the visible one, you’d make a 3D character that happens to be flat. With the invisible approach, you’d just build and animate the bones of the character externally, but then attach the sprites to the bones in the engine.

Cheers,
Michael Noland

What about Spine animation software which provides skeletal base animation (sprites with bones) instead using Maya, Max or Blender if UE4 Animation BP supports spine bone system too it will be really great for 2D games.

You can use Spine, Spriter, Flash, and other similar software by exporting as sprite sheets, but they are not currently natively supported in UE4. I’ve talked with the Esoteric software guys in the past and they’re interested in adding support for UE4 at some point, I’d suggest pinging them to see if/when they’ll be working on it.

Cheers,
Michael Noland

Hi Noland, first I want to say, i changed my all pipeline from unity to unreal engine, for a steam greenlit game, I start from scratch again for unreal engine, and my game is sprite based pixel art action platformer. Your help will be most appreciated.

I build behaviour tree for 2d character and it works very well, except some stuff;

  1. how can we avoid character to turn on z axis? I used planar movement to lock movement on “y” axis and it works good but couldnt find a way to lock rotation?

  2. behaviour tree “move to” task tool turns my character(I guess it is the one turns my enemy character) well but most of times we can see the flipping movement. So its very bad for 2d pixel game where my sprite turning around 180 degree. To avoid that I try to use flipping manually depending on velocity of character;

  3. But in this case; how can we flipping the sprite depend on movement which is working together with ai behaviour “move to” task tool. Because; if I set my flipping according to negative or positive velocity(on event tick), it works ok but this time enemy cant see my player because actually enemy is looking its back. There should be a communication between flipping sprite and behavior tree, or there is another way?

  4. my character wont jump on navmesh if jumping point will be higher than its own place. So it only works for lower places?

5)Finally about your comment, can you explain more if you have time about how can we implement navmesh xy axis on xz sprite? I didnt understand why should we turn our sprite?

Thank you.

edit: my nav mesh is very small thin area on platform sprites

Try setting movement acceptance radius to something not 0, like 10 or 30. AI wanting to rotate may also be result of AI trying to look at something, like move goal or “target” - this is controlled via AI’s “focus”.

Again, AcceptanceRadius should help here. If not please share a video so that I can see the buggy behavior.

If you really want to manually control AI’s facing do it via pawn’s or controller’s rotation. Flipping the visual representation does nothing for AI.

There’s no out-of-the-box support for AI “jumping” (as in deliberate upward motion) in UE4. You’ll need to mess around with code or try using smart navlinks that send out notification when AI is about to traverse it and you can do your own jum

Cheers,
–mieszko

RE: (2), one thing you can also try is to decouple the sprite from the actor rotation (set rotation to world rotation on the sprite component), and then manually flip the sprite orientation when you want to face the opposite direction (or switch frames if you have unique left/right facing anims).

Cheers,
Michael Noland

Thank you very much Mieszko,

I made these solutions, I dont know is it expensive or not;

  1. in every tick I made character y axis rotation=0 to avoid any rotation error
  2. I deactivate “controller rotation yaw” from pawn menu. So; move to ai node no more control facing.
  3. I made flipping the sprite depending on velocity negative or positive, in that case character turn according to its velocity.
  4. Maybe very stupid way but I put some triggers at the end of the corners of platforms, so when enemy pass from them they will launch him.

I thought using behaviour tree on 2d platformer game is so much complicated because of most of stuff build up for 3d space. Or its hard for me as a beginner to understand how it works excatly. For now I am using standart functions and blueprints.

Whenever you say “every tick” a yellow light should light up :wink: Setting rotation shouldn’t be expensive though, so if it works for you fine. But do you need that, with all the other changes?

Perfectly acceptable game-specific solution :slight_smile:

BehaviorTrees don’t care if the game is 1D or 4D, it’s just a structure for picking “next behavior”. Specific BT tasks may be 3d-specific, but I can’t think of any right now. You should be able to use BTs without a problem. And if you run into any please ask a question on the AnswerHub. If you tag it with AI tags I’ll get a notify :wink: I’m a rare guest at the forums (thank Michael for bringing me here :wink: ).

–mieszko

thank you guys your support is great. With this support I will try again, see you later:)