Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Tutorials
#1

Priority behaviors of selector and how to make cool AI logic out of it

Archive: 4 posts


Heres tutorial of priority behaviors of selectors and how to use it to count objects or make cool priotirzed AI


http://www.youtube.com/watch?v=51BzBa99B6M

http://www.youtube.com/watch?v=f55lHmwRMjY

So since my tutorials is a mess as always, here text summery on what im doing there:

So selector is a one of state gadget hat can have only one state that you can set using inputs. But what happens if 2 of them gets the signal and selector can only have one state? It setting to state that have signal inputed to closest input to cycle input and not react on signal receive as most gadgets do, it check input all the time and set state to one that receive the signal. In other words selector got priority behaviors that we can use for coll stuff

First example i show in video is most basic use, how to use it to count object and out send only one output signal depending on how many tags or players are in area, same thing like "hidden counters" by comph but without ton of XOR gates. So each sensor got increasing count and highest one got top priority, if there 3 tags around, sensor with count 3 will react and as top priority other sensors with count 2 and 1 will be ignored until ther 3 tags active. Example i used also shows how to count how many buttons are pressed ;]

2nd example shows how to make prioritized AI that divide conditions in to priorities and change to behavior that currrently got top priority. In video i used sackbot as example that patrols specific spot and attack if you go near it, but coming back to base if he gets too far. So we placed selector to devide behaviors in to modes (which i recommended if you making AI with multiple behaviors) that have priority:

1. Lowest priority is to patrol the base, so battery feeds farest from cycle input,so it will return to patrol if there nothign happening around
2. 2nd from last priority is to follow player to attack if he come near, se we player player sensor to next input, so it will switch to follow player mode, if player run away battery wil take over and bot will be back to patroling.
3. next priority (which actually didnt need to make seperate mode for it) is to make sackbot burn and kill the sackboy if he will be very close. Again, if player run away enoth bot will be back to normal player following
4.Top priority is return to base if sackbot got too faraway, so i place tag marking the base and use inverted tag sensor to detect if bot is outside the base range, if that happens, sicne it's top priority he will ignore enything else and got back to base by following base tag and if player is not around he will go back to patroling, if player is still around he will go follow him but if its got feather he will return to base and follow playr again.... so you need to watch out how you se ranges ;]

I know this example could be done better but i just wanted to show you an example of priority AI Keep in mind that you don't need to use sackbot at all, this should work with anything

Enjoy!
2011-05-29 13:59:00

Author:
Shadowriver
Posts: 3991


This is exactly what I am using to make my unit AI in my rts. Selector with powered inputs.

Selectors are infinitely useful, problem is I forget to consider them when making logic.
2011-06-06 00:17:00

Author:
SSTAGG1
Posts: 1136


Yea i selector is most magical gadgets of them all, it has ton of other uses then just.... selecting other gadget like that is Timer, Sequencer and Directional Combiner/Splitter2011-06-06 13:01:00

Author:
Shadowriver
Posts: 3991


I went back through some of my messy logic and cleaned it up with selectors. Definitely a nice tool.2011-06-26 10:04:00

Author:
sp0ngyraver
Posts: 407


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.