CP2: Chase and Flee AI – Simulation in p5.js
Автор: Jeff Thompson
Загружено: 2021-03-30
Просмотров: 1316
Описание:
While there is a ton of really cool work on games and AI, the tech is really complicated and mathy. This example shows a VERY basic chase and flee behavior. The p5.js vector object simplifies a lot of this math for us. We can calculate the direction an entity should move towards another by subtracting their positions, calculate the distance between two vectors, and even use those values to move an entity in a particular direction! For more ideas, see Valentino Braitenberg's "vehicles", which do things like seek light and hide from each other: http://en.wikipedia.org/wiki/Braitenb...
👩💻 https://editor.p5js.org/jeffThompson/...
ALL THE VIDEOS IN THIS UNIT
🎥 • CP2: Week 08 (Simulation)
SEE ALSO
💡 https://gamedevelopment.tutsplus.com/...
steering-behaviors--gamedev-12732
💡 https://www.gamasutra.com/blogs/JuanB...
💡 https://natureofcode.com/book/chapter...
CHALLENGES
❓ Our chase ball bounces around when it hits you. Can you stop that behavior by checking if it's position is within the player's circle, and not updating if that's true?
❓ Can you make the chase ball turn to face the player? Use a shape like a triangle and vector's angleBetween() function. Hint: you'll need to use push/pop() too.
❓ Can you make the fleeing ball move faster or slower the close we get to it?
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: