fbpx
Back to Top
 

Blog

AI! IK! Ok…?

A few weeks ago while testing the game, I had to face the fact the AI (the artificial intelligence driving the enemies) was simply not good enough. It had become extremely bloated in terms of code complexity and yet was not quite delivering the quality I wanted.

So I decided to redo the entire game’s AI system from scratch, this time using a different behavior-tree technique.

It was a scary decision as during a few days the game wasn’t even playable; first I had to unplug all the actors’ “brains” and then I started again, slowly building up their new behaviors, piece by piece. I knew exactly what I wanted so I was able to get to the point rather quickly. But this time while I worked I hid away all the models, the animation, etc… and only used capsules.

Capsules are simple shapes that roughly represent the volume and orientation of the actors. Here’s an example with Tilo as you’ve probably never seen him before: he’s turned into a mix of a minion, a fire hydrant and a cucumber! 😀

 

(On the video you can see the capsule changing color depending on whether or not it’s in contact with the ground)

The result of this huge endeavor is in the span of 2 weeks I was able to redo and greatly improve the AI that had taken me more than a year to get into a flimsy “mostly-working” state. Except this time it is much more robust and I know exactly WHY it works the way it does.

So although the decision to redo the AI was a frightening one it ended up paying off BIG time:

  • The AI asset I use is quite visual (it’s called “Node Canvas”), so I can see exactly what’s happening in real-time
  • I was able to get rid of hundreds (if not more) of lines of codes, making the maintenance and expansion on the system much more manageable
  • The capsule approach allowed me to focus on the behavior itself without animation clouding the potential issues
  • The AI is now far richer than it’s ever been before and allows for really neat tricks

Here’s a bird’s eye view of what a behavior tree looks like. All the branches light up and change colors according to their state (as you can see in the inset picture).

ScreenShot 2015_08_20 11;43;59001s1

I have also finally come around to implementing IKs for the actors. What this means is the character’s feet are now actually hugging the ground instead of remaining up in mid-air on a virtual flat-plane.

It wasn’t too difficult to implement thanks to a great asset I found called “Final IK”. Integrating the system into the game’s pipeline was painless and it yields very satisfying results! Here’s a quick test video:

 

(Don’t mind the red cube, it’s just a debug visual for the AI’s target position)

You’ll notice the Rat is really pushing on his legs as he climbs up the slope, contrasting a lot with Tilo who is a much lighter and nimbler character. Your speed (and the ability to sneak) is your main asset in the game; believe me, you don’t want to let these guys get their hands on you, especially without wearing any protections!!

Anyway, that concludes this update. I hope you liked it! Please don’t hesitate leaving your thoughts and questions below… 🙂

blank
Seith

37 Comments

  • blank
    lucky
    September 8, 2015 at 8:35 pm

    Wow really impressive, the rat looks that scary! Thanks for the update.

    • blank
      Keenan
      September 9, 2015 at 4:14 pm

      Does this mean you had to redo the player system as well as the enemies/NPCs?

  • blank
    CesRo
    September 9, 2015 at 2:06 am

    Very interesting!

    That rat definitively has a “weight” feel in his movement. Way better animation than a lot of games out there.

  • blank
    evilkinggumby
    September 9, 2015 at 2:43 am

    Beautiful! Will the big ol rats ever pick up their pace and move faster than that slow walk? reminds me of Jason Voohee’s. hehehe… I do like that their large size and gait allows them to cover ground effectively, but it strikes me as odd to see him lag behind Tilo and NOT break into a light jog even…

  • blank
    Hayden
    September 9, 2015 at 5:32 am

    Great update, Seith! Nice to see your attention went into the game’s finer details – that huge rat looked like it was really struggling! If Tilo remains stationary do his feet adjust to the different slopes (e.g.: standing on two different steps) – similar to Guild Wars 2?

    Cheers and well done!

  • blank
    Emanuele
    September 9, 2015 at 7:11 am

    Can’t wait anymore to play this game!! 🙂 It’s growing always much better.

  • blank
    Marc
    September 9, 2015 at 7:27 am

    Wow that animation looks really sweet! And props to replacing such a core part in the middle of development. Was the previous solution an asset or written by yourself?
    Also I noticed this in some of your earlier posts: your setup scene already looks great with lighting, baked lights/shadows, DOF, probably color grading properly setup. Any tips for a Unity noob on how you achieved that cinematic look? Also are you using pro builder? Cheers 🙂

  • blank
    Chris
    September 9, 2015 at 10:36 am

    Looking might fine!

    What takes longer for you, the coding or the 3D/animation aspect of the game?

    Very impressive none the less 🙂

  • blank
    Stephen
    September 10, 2015 at 1:03 am

    Looking fantastic as usual, really looking forward to this game. Does the rat’s actual speed slow down when going up a slope?

      • blank
        lucky
        September 10, 2015 at 10:59 am

        Maybe you have your reasons, but shouldn’t he slowdown? It should add realism and make a more noticable difference on higher slopes…?

  • blank
    king_yoshi
    September 12, 2015 at 12:25 am

    Wow this is looking Amazing so far! It is always astounding at how great of a game a couple person team can make, compared to the huge gaming companies. 🙂

    Your doing a great job!!! All that hard work really shows.

  • blank
    Dragonhead
    September 12, 2015 at 2:08 am

    Really feeling the weight on the feet there. Nice!

    And I had no idea there was a node-based system for Unity. I’ll have to look more into it.

  • blank
    MundM
    September 14, 2015 at 11:04 am

    Amazing! I guess 99% of people uploading submissions to greenlight would never, even if the game would be released on steam, redo the entire AI to ensure and improve the quality of their product. I can’t wait to play this, I never seen a developer making me trust into a game like you with all the details you give us about your work (it’s also very impressive, I’m glad I only have to buy it ;-).

  • blank
    Happy
    September 15, 2015 at 5:22 am

    I find it amazing that not only are you such a skilled artist, you’re also a clear-headed programmer with such high standards! What I know about code could probably fit on a small napkin, but I have heard how tempting it is, to keep applying bandaids to bad foundations 😛 An entire overhaul like this takes not just effort, but real dedication to the quality of your product. The fact it pays off is no coincidence! That’s what comes out of hard work and a great ethic! 🙂 Keep it up, I love every little peek at the game we get!

    Also, liking this post’s title! 😉

  • blank
    Catie
    September 22, 2015 at 3:31 pm

    Tant de talents et de savoir faire. Je suis impressionnée et admirative. C’est un très beau travail. Je pense que cela devrait faire réfléchir de plus gros studios, incapables de mettre autant de passion à l’ouvrage. Je guette dans l’ombre l’évolution, et il me tarde de pouvoir mettre la main dessus, même si je ne sais pas encore si je dois le prendre sur Xbox ou sur Pc (choix cornélien). En attendant, je ne peux que vous souhaiter une très bonne continuation et de la persévérance.

  • blank
    Clois
    September 26, 2015 at 3:06 pm

    Hi Seith !
    I’ve been following the development of Ghost of a Tale for quite some time now. I’m really fascinated by this game, and I can’t wait until it’s release 🙂 It seem really unique and really detailed (as you show it here with the moving of Tilo compared to the moving of the big rat). When I was reading this update, my girlfriend (who is also interested in this game) was just next to me with her pet mouse, and she observed,that Tilo’s tail was a bit shorter than that of a real mouse. I don’t know if it’s intentional due to clipping issues or something else, or there are mice with shorter tails ( I’m not an expert 🙂 ) ,it’s just a small observation which I wanted to share with you. Still, I’m really excited about this game, especially it’s story. It’s really creative to make a fantasy-like world with mice and rats. Keep up the good work!
    Cheers! 🙂

  • blank
    Ryan
    October 1, 2015 at 7:23 am

    My gosh that IK asset is amazing, thanks for sharing that one!
    I’m currently learning Unity, and seeing this game as it progresses is simply bliss, it’s so awesome! 🙂

  • blank
    Stine
    October 1, 2015 at 1:13 pm

    Hi!
    The game looks great! I was wondering if there will be a demo sometime in the future? Can’t wait to try it!

  • blank
    Basil
    October 2, 2015 at 5:59 am

    The game looks like pure magic. Godspeed! Looking forward to the Steam release.

  • blank
    Steven
    December 20, 2015 at 5:13 am

    Hey Seith, sorry to pop an old thread, but I still hope old comments ding the inbox.

    If you are willing and able, just wondering a little bit about your character controller set up.
    It doesn’t look to be the CharacterController, and it too precises to be entirely physics based, but I have found that manually controlling an object throws collisions out the window. I would really appreciate a few words on the set up, or even how you conceptualized what you have going.

    Either way, your game and blog are very inspiring, I love pouring over images and videos trying to figure out how you did things 😛 One of very few games i am looking forward to.

    Cheers, Steven.

  • blank

    This article will help the internet people for setting up new weblog or even a blog from start to end.

  • blank
    Zerebokep
    August 29, 2016 at 7:42 pm

    Hi Seith,

    your character controller really looks awesome. Do you use root-motion?

    As Steven I would also be glad if you could share some insights to your character controller setup. 🙂

Add Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dress-a-mouse!
Reality Check