If you are interested in learning AI and how it can be used in #gamedev, you should start with BEHAVIOUR TREES! 🌲🧠

As the cornerstone of game AI, BTs are used in:

• Halo 2 🪖
• Bioshock 💉
• GTA V 🚗
• Façade 🍈
• Alien: Isolation 👽

Let's see how they work! 👇

🧵 A screenshot of "owl-bt", an editor for Behaviour An example of Behaviour Trees in Unreal Engine.An example of Behaviour Trees in Unity, with an asset called
Many of you are familiar with FINITE STATE MACHINES: the most popular pattern for character controllers.

While FSMs are graphs, BTs are (unsurprisingly!) trees. 🌲Their leaves are the ACTIONS 🦾 and PERCEPTIONS 👁️ your agents can perform and sense.
Each node in a BT can be in any of the three following states:

• ✔️ SUCCESS: the node was executed successfully
• ❌ FAILURE: the node could not be completed
• ⏳ RUNNING: the node is still being executed
The nodes that are not leaves (=composites) control the "flow of execution", deciding which ACTIONS and PERCEPTION are going to be be executed.

There are two main types of nodes:
• SEQUENCE: succeeds if all of its nodes succeeded
• SELECTOR: fails if all of its nodes failed
Let's see how the SEQUENCE node works, with a simple example.

Let's built a BT to control WALL-E. The robot keeps searching, collecting and disposing of any rubbish it could find.

As long as all three actions succeed, the SEQUENCE is successful. ✔️
On the other hand, even if only just one of those actions fail, then the entire SEQUENCE fails... ❌
The SELECTOR node works in a "complimentary" way. The children nodes are executed until one succeeds. ✔️

SELETORS are used to provide a series of alternatives for a specific task.
For a SELECTOR to fail, all of its children nodes must fail. ❌

This means that the task the SELECTOR wanted to achieve could not be executed.
SELECTOR and SEQUENCE nodes can be used to build complex BTs.

This, for instance, shows how to build an AI that can open doors and move into rooms. 🚪🔑

The SEQUENCE contains all of the "steps" necessary, while the SELECTOR provides alternative a series of ways to open a door.
There is so much more to BEHAVIOUR TREES than just what I have shown here! In the next few days I will be posting more, including some code! 👨‍💻

In the meantime, @AIandGames has made a gentle—yet comprehensive—video about BTs that is worth watching!

✨ 𝘁𝗵𝗮𝗻𝗸 𝘆𝗼𝘂 𝗳𝗼𝗿 𝗰𝗼𝗺𝗶𝗻𝗴 𝘁𝗼 𝗺𝘆 𝘁𝗲𝗱 𝘁𝗮𝗹𝗸 ✨

If you enjoy content about gamedev, shader coding and artificial intelligence, feel free to retweet & follow me for more! 😎

And stay tuned for the next part about BT! 🌲🧠

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Alan Zucconi

Alan Zucconi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @AlanZucconi

8 Jan
Most #gamedev are familiar with A*, the most used pathfinding algorithm in games.

⚠️ But did you know that there's a very common scenario in which A* DOES NOT find the shortest path? 😱

Let's see why A* won't work in "Portal", and how we can fix it!

🧵
All pathfinding algorithms work by iteratively exploring nearby cells in the grid.

⬅️ Breadth First Search explores them in the order in which they are discovered.

➡️ Dijkstra's Algorithm, instead, keeps exploring the SHORTEST PATH FIRST.

(gif by @redblobgames)
That is also why Dijkstra's algorithm is sometimes referred to as the SHORTEST PATH FIRST algorithm.

Ultimately, it is that property that ensures its OPTIMALITY (= it will always find the shortest path between any two points).
Read 12 tweets
24 Nov 20
One of the best ways to improve your creativity is—paradoxically—to design with constraints.

Perhaps this is why the #pico8 community never failed to amaze me with their tiny creations.

So, here's a list of PICO-8 DEMAKES, starting with possibly the best one ever made...

/🧵👇
"FUZ", a #pico8 demake of @Polytron's "FEZ" by Henry Stadolnik (@Jusiv_).

jusiv.itch.io/fuz
"Low Mem Sky", a #pico8 demake of @hellogames's "No Man's Sky" by Paul Nicholas (@Liquidream).

liquidream.itch.io/low-mem-sky-ja…
Read 7 tweets
27 Sep 20
Turns out 2020 was—for many of us—one of the worst years on record.

If you are feeling stressed and need somewhere to escape for a little bit, this is a thread about some short, calming games that I hope will help you relax.

Starting with...

👇👇👇 🧵
"A Short Hike" is without any doubt the best indie title of the year. 🏔️🐦

@adamgryu has truly crafted something that can soothe your soul for a good few hours.

store.steampowered.com/app/1055540/A_…
"Kind Words" is a game like no other. 💌🤗

You can write about your own issues, and read anonymous replies from other players.

It's warming and empowering. @popcannibal created one of the few experiments on empathy that actually worked.

store.steampowered.com/app/1070710/Ki…
Read 10 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!