Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Help!
#1
how to make A.I. for a top down enemy character
Archive: 7 posts
can anyone suggest how to make a top down view enemy character follow the player and avoid walls and obstacles on the way. Im using a mover, follow rotator and player sensor to make the enemy characters follow the player within a certain range but if the player moves behind a wall the enemy unit can easily become stuck trying to get to the player. Can anyone help? | 2011-02-05 14:08:00 Author: Unknown User |
LBP2 specific questions belong into the Help! (http://www.lbpcentral.com/forums/forumdisplay.php?126-LBP2-Help!) section of the LBP2 forums, not the tutorial section. About your little problem... maybe attach a marker sensor thing to the wall and a follower (Set to 'flee&apos to the enemy unit. If the enemy is too close to the marker sensor thing, the follower should (not sure, but it should) make him move away from there. Hope that helps! | 2011-02-05 14:19:00 Author: iArekusu Posts: 402 |
Sorry about putting my question in the wrong section, i realised just as i posted it and couldnt figure out how to move or delete it. My bad. Could using two different movers set to follow and flee result in a loop where the enemy character moves back and forth (moving away from the wall until its 'clear' and then turning around to continue following player, moving back within range of the wall and then repeating the process) I had replicated a similar function to this during my original testing phase. I used tags embedded in the walls to stop a unit when it comes in range of a wall, the unit points towards the player whenever the player is in range so if the player moved to a position where the wall was blocking the unit that is facing it, the unit will stop. once the unit is not facing a wall and the player is in range it will follow the player again. This worked ok but had major glitches when 2 units were in close proximity. So i had to put the same key i had in the walls into each unit so that they would not bump into eachother. This however did not solve my problem of requiring an enemy pursue the player in an intelligent way. Im trying to make it so that the unit will take the shortest pathway to the player and when it is not obstructed it will engage the player. | 2011-02-06 04:59:00 Author: Unknown User |
maybe try putting tags along the wall like you have done, except make a circle of holo, attach a one shot pulser to a follower unit thats set (for examples sake) at 3 o'clock, set the follower unit to maximum speed, wire the output of the sensor sensing the tag into the one shot pulser that triggers the follower. Set a second follower sensing a different tag label on the direct center of the enemy and place that at the direct center of the circular holo. This should (i'll explain why this behavior is important further down) 'swing' the holo round its center axis (the center follower following the tag on the enemy) as the follower unit on the edge comes into range of the tag, so that tag is then pointing directly towards the wall. Now, at 90 degrees to that follower tag (12 or 6 o'clock) add a mover and set the same sensor thats triggering the outer follower to trigger the mover. Add a follower to the enemy unit set to follow another tag thats set in the same place as the mover, set the follower to be triggered by the same sensor thats triggering all the other stuff. Do this in a cross formation for all outermost points of the circular holo (with grid on) with the movers at 90 degrees to the corresponding outer followers, set to be triggered by their sensors. This way (hopefully, i'm only theorising here) as the enemy comes into proximity to the wall, the holo swings, triggers the mover and follower, the enemy follows the tag thats moving with the mover which is moving at 90 degrees to the wall, or, in other words, the enemy will turn and move along the wall, until the point the outer follower comes out of proximity with the wall and this bit of logic is turned off so the enemy begins its normal follow routine. You might also want to play around with having rotators set to extremely slow an alternate spin directions that trigger in cerespondence to which sensor has been triggered to slowly pull the enemy out of proximity of the wall. Again though, i'm only theorising. hope this helped. Its not tried and tested but i'm sure it will get your inspiration juices flowing. good luck! | 2011-02-06 08:10:00 Author: Epicurean Dreamer Posts: 224 |
I posted something like this on Ungreth's Pacman help thing. Since there's 8 directions: North - Blue South - Red East - Green West - Yellow North East - Purple North West - Pink South East - Light Green South West - Dark Blue Use combined directions on controllinator. If you go North East it'll lay down a pink tag and when the enemy comes across the tag it will go North East as that's the way you went. Your player lays down invisible markers with tags that correspond to a direction. I thought up this theory a while ago. This seems simple yet effective but could be glitchy. If you use this please give credit. | 2011-02-06 17:02:00 Author: mutant_red_peas Posts: 516 |
this is how I do obstacle. I place tags with (wrongly spelled obstacle) obstical : I then add a tag sensor to my enemy, along with a timer set to 0.1 and 2 movers set to - and + (left and right speed) I then use a randomiser to pick between the two, that way they dont go the same way every time. here is an image of my logic for obstacles. (will upload a short video of my top down shooter showing basic obstacle movement) http://img546.imageshack.us/img546/7682/img0681.jpg Youtube video. http://www.youtube.com/watch?v=ucdvUWYw6iM | 2011-02-06 17:25:00 Author: Unknown User |
I've built you a working prototype of a logic system that makes enemies detect walls and walk along side them while still following you, it works intelligently for all possible directions, so it knows to walk left if your down/up and to the left behind a corner, or knows to walk right if your up/down to the right and behind a corner, or knows to walk up if your up and left/right behind a corner e.t.c. I've tried to get it as smooth as i can but sometimes there is a very small 'bump' in the movement of the enemy as it turns a corner, this is to do with acute angles and sensor ranges, its entirely aesthetic though. I've bug tested it and got it to a point it works pretty seamlessly, i haven't tried it at much larger ranges though, i don't know if the logic will fail at higher ranges than what i have set to, though i have built it to work from fairly comfortably outside normal camera range (120 range units). I won't go into too much depth about the logic behind it on here as its fairly complicated. If you want the logic please contact me in game and i'll pass it over to you and explain to you properly how it works. Its easier that way, and besides i did make it for you after all here's a picture of it: http://i6.lbp.me/img/ft/d76e6232dc214a06dbbbf90befe1aee7b1431081.jpg if you still need help on this please feel free tp come grab this from me and use it anyway you see fit, alter it an any way you want e.t.c. I'm not looking for any credibility either, you don't have to state you've used anything iv'e made in level descriptions or anything. Just helping a fellow creator in need search for Epicurean Dream on PSN or in LBP2, note, thats not Epicurean Dreamer, theres no 'er' on dream on my psn account. | 2011-02-07 12:21:00 Author: Epicurean Dreamer Posts: 224 |
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.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.