Yuka Game AI + Babylon.js Examples - the 1st Release

ok, my bad, messed up the path. Its all good :slight_smile:

1 Like

Hey! I was more than two weeks off. So is it working for you?

1 Like

yes it works fine as you said. No need to even pass the babylon mesh.
I have some other questions but I will create a separate thread for it.

4 Likes

@labris @roland When I say good job, I really, really mean it. There was so much stuff that I wanted to add to my awesome-babylonjs list that I had trouble not adding every single demo. I had to rework some of the structure to accommodate all the new links. Your work will be very helpful to many developers.

This is the kind of work I think is needed to take Babylon beyond simple rectangles and asset loading into creating real and engaging games.

2 Likes

Thanks dude! :slight_smile: There should be more coming, but I am completely busy these weeks, barelly have time to sleep lol…

2 Likes

I played with yuka for a while and I am quite happy about it. Managed to use it to move my aircraft carrier following path and for bird flock I can now chase with my plane. Post with video here
Few comments on yuka:
-I think its not fully 3D as its meant mostly for FPS games. For example wander behavior is only x,y (there are others only 2D). I suppose its fine when combined with follow path. Fortunately its easy to extend.
-I had to add a behavior for limit sphere/box otherwise birds would just wander away.
-Not sure what is the physics aspect doing in there. For birds I added functions to adjust the speed based on up vector so it looks like it speeds up/down on climb/decent.

Amazing works !! Does Yuka Game AI include behaviour tree and Markov System ? :slight_smile:

@roland

What you might want to do is to update the positions/velocities of your YUKA vehicles before you call entityManager.update() then you update the velocities on your physics bodies with the values from the YUKA vehicles and after these two steps you make a physicsEngine.step() call. I suggest you to not to use the BabylonJS physics impostors but use the physics engine directly so you can fully control it. This is just theory at the moment and I didn’t try it out, but should work.

I just saw this post. The date you posted this is roughly the same date I was hesitating if it makes sense to use ammo.js for collision detection and use YUKA for steering. :smiley:

I used similar approach and it worked quite well. The physics engine simulate the world and the time ticks forward. The position info is sync back to YUKA world at every frame. YUKA computes the velocities for next tick and sends the new velocities to the physics engine. I also implemented flowfield path finding as a Steering Behavior in YUKA so it can be seamlessly combined with other build-in steering behaviors in YUKA: My first babylon.js hobby project - work in progress - #3 by slin

4 Likes

I added as example NavMesh with ReadyPlayer avatars walking - Yuka | Navmesh with Spatial Index and Tasks

9 Likes

NICELY done !!!

2 Likes

So cool! But how do you pick good values for the spatial indexing?

Cool buddy! :wink:

2 Likes

The babylon examples page is down right now @labris

Thanks, seems it works for me at the moment - Yuka | Examples with Babylon.js

weird I just stay pending on this request but will try when home :slight_smile: have seen weird network things here before

Not sure if this is the correct thread to ask, but does Yuka have some documentation other than the API?

I’m looking for a step-by-step on how to get some basic things going and explanations of what things do, like the BabylonJS documentation has for the recast plugin:
https://doc.babylonjs.com/features/featuresDeepDive/crowdNavigation

I’d like to try and play around with Yuka, but I’m pretty new to these things. The link above provides some simple code examples I can quickly change some parameters of and see what they do, and adds some complexity with each next step.

Yuka itself is mainly based on the brilliant book “Programming Game AI by Example” by Mat Backlund (but uses Javascript instead of C++).
This book stands out from the pack by providing industrial-strength solutions to difficult problems, like steering and goal-oriented behavior. Mat guides the reader toward building a foundation robust enough for real games. This book is a must-have for anyone new to the field, and has tips for the seasoned professional as well.

Here is the link - Programming Game AI by Example.pdf - Google Drive

“Using easy-to-follow and well-described examples, this book shows you how to use most of the techniques professional AI programmers use. A great introduction for the beginner and an excellent reference for the more experienced!”
— Eric Martel, AI programmer, Ubisoft, Far Cry

3 Likes

Thank you! That’s a great starting point. Is the best place to ask questions about Yuka the discord by the way?

@censor

When I was programming the examples for BabylonJS with YUKA I found the API very selfexplaining and easy to understand. I bet you will easily follow the examples code and understand how things are working in majority of the cases.

I think, @labris will agree as well :wink:

2 Likes

Hi Yuka fans.
Im just starting to play with Yuka and wondering how to set a loaded GLB as a Yuka entity. I’m using this example as my base and loading a glb into it via asset container, duplicating it, and surrounding it with a bounding box.

Ideally, I’d set the bounding box as the Yuka entity - but that doesn’t seem to work (and the caution around using TransformNodes doesn’t apply, right, since it’s just a box mesh?).

See lines 145 - 160. Three cases there - only the one that pops the asset out of its bounding box works (but posrotscale is then tweaked - and i’m not sure how i would programmatically know what to select in any case in a complex mesh). Ideas?

@oriongu thought you might know offhand?

-----update----
Instead of trying to attach the loaded GLB itself as target, i am creating a separate target mesh (simple box) and then setting its location to the location of the GLB in registerBeforeRender. that’s seeming to work pretty well.