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

How to make a bot dodge ?

Archive: 10 posts


I'm working on a top down fighting level. Players fight against waves of monsters and travel a bit across the map. Some enemies also shoot projectiles.

Now I would like to be able to dodge danger by pressing L1. Press it and your bot will quickly move away from anything dangerous, such as a projectile or an enemy which would be too close.

There are multiple difficulties
1) Using a follower set to escape instead of follow doesn't work. If the bot gets between two dangers, it will just bounce between them.
2) The bot is moved with the left stick and aimed with the right stick. If the player doesn't aim, the bot looks towards the movement using a rocket rotator - though it could be changed to use the L-stick inputs instead. I have to make sure the bot keeps looking the same way he was before dodging, so that it seems like the bot just jumped away, surprised.
3) I have to make sure the bot doesn't run inside a wall when I perform this, or at least stop the action if I hit a wall. I guess I'll use a glitched solid hologram so the player hits the walls.

If anyone has ideas about how to do this, or a simpler but as good movement that I could make instead, that would be great.
2012-03-01 04:13:00

Author:
Unknown User


I would rig the dodge inputs (R2 and L2 for example) to short duration sequencers with basic directional movers on them (the ones with a single arrow icon), and set positive/negative values for left/right, and the up/down values left at zero. You'd have to make sure the input signals can only reset/restart the sequencers once the sequence is complete, else players will be able to spam the dodge button.2012-03-01 04:52:00

Author:
Ungreth
Posts: 2130


The first way that comes to mind is to use directional tag sensors. I'd say four of them, each set for 90 degrees, and all turned to face different directions. Have them go into a Selector, and each Selector output starts a short sequencer that moves them in the opposite direction from where the tag is detected. The good part about using this is it won't have problems with multiple danger zones being detected, but it also leaves the chance that the player would be moved into something they shouldn't be. So, one thing you could add on top of this, is a bunch of AND gates to detect multiple. Let's say there's danger to the left and right. You could set this one to move forward or back in this case.

Another option would be to require L Stick input and the L1 button, making the bot dodge in the direction from the L Stick. That's likely the easiest, but depends on how much automation you want.
2012-03-01 06:46:00

Author:
SuddenEnigma
Posts: 70


Umm... although what i should go if i was shooting for a proffesional way will be what SuddenEnigma proposed, i think tweaking that, could get way too complex so an alternative that came to mind now.... why not simply have him invincible for that short period of time while doing a barrel roll (or 360o) and move fast randomly (or joystickly) left or right (up or down)?


EDIT:
Just to complete the picture, obviously disabling projectile collision (wich sounds easy to setup) during the roll, will make more sense visually.

Sure he may also randomly collide with a bullet at the end of the animation (move) but i think that could happen in a real world situation and most gamers could go with it except the proffesional booers lol.
2012-03-01 11:06:00

Author:
zupaton
Posts: 167


Since you mentioned top-down I am assuming here that actual sackbots are not really involved, except perhaps seated in a DCS.

How about this idea? Tag your threats. Have a piece of invisible holo with logic on it stuck to the main object by a wire of a certain length (set to how far you want the player to dodge); the logic on that bit follows the player object unless a threat is within range (tag sensor). Then it switches to flee mode and tries to outrun the threat using a fleeing follower. When during that mode the player presses L1, the fleeing bit gets frozen in place and the player object automatically moves to the fleeing object using a follower.

Of course that doesn't mean the player can never be hit when dodging. He certainly can. And dodging into an obstacle is also still possible; I wouldn't make the fleeing object contain any solid materials else the risk exists that it will act like an anchor when it accidentally gets stuck behind an object.

You can lock an object's current rotation firmly in place by activating a rotator set to 0 speed and 100% deceleration. You can then still move the object horizontally and vertically using other mover logic.

EDIT: there is a good chance that when the player faces a threat heads-on, dodging will cause him to just take a step back and still get hit by the approaching threat.
2012-03-01 12:26:00

Author:
Antikris
Posts: 1340


Just of the top of my head, how about this:

On the press of L1, emit some Tagged hollow where you stand, the same time triggering a chip on the DCS which has in it the Tag sensor connected to a mover (set this to local space) or maybe a follower set to flee, so in theory at least you could set the range of dodge based on the Tag sensors range, in other words only move while your emitted/tagged hollow is within range. Of course you would have to disable spamming as Ungreth mentioned.

If the mover is set to local space then the bot would dodge or strafe perpendicular to the way its facing, of course you would need some way to determine a positive or negative direction. (left/down=negative,right/up=positive), maybe use two movers and a randomiser for this.

I know this doesn't necessarily solve everything but I hope it's a start!!
2012-03-01 13:36:00

Author:
CloaknBlagger
Posts: 78


I've just been experimenting in create mode, and in all honesty I don't see why you need a separate button to dodge when the advanced mover will allow you to dodge out of the way anyway, just by pushing the left stick quickly away from whatever hazard is coming at you.

I'm assuming of course that you would have your characters movement rigged as follows...

Controlinator Output: Left Stick Up/Down to Advanced Mover Input: Up/Down Speed

Controlinator Ouput: Left Stick Left/Right to Advanced Mover Input: Left/Right Speed

Controlinator Ouput: Right Stick Left/Right to Advanced Rotator Input: Rotation Speed

And ideally a game cam set to local space, to avoid inverted controls when rotating past 180 degrees
2012-03-01 16:15:00

Author:
Ungreth
Posts: 2130


Thanks to all, I like SuddenEnigma's solution, and zupaton's one is fine but that's not what I want. I just want the player to move way quicker compared to normally when I dodge, that's why I give this move to the players. However, I think I'll go with Antikris' idea. It's okay if the player bounces in something, or backward when getting shot in the face, since that's just what a human would do: reflexes makes you move directly away, even if it's safer to move to the side.

I repeat, I'm using a joystick rotator for aiming, and a rocket rotator when your aren't using the right stick. Mover isn't related to position, so there's no trouble when upside down. Also note that the logic is placed upwards when the bot is facing downwards. It just means that I need to invert any related to position logic. Though I could make the sackbot facing up now that the logic isn't on the controlinator but on a hologram hitbox.
2012-03-01 23:58:00

Author:
Unknown User


Could you use the L3 button instead of L1, Left stick + L3 wired to and gate triggers a start count down timer which powers a faster advanced mover. You can have directional inputs to the avanced mover from left stick or automated by danger sensors. (4 sensors set to 180 degrees, with overlapping fields and direction combiners might do it.)2012-03-03 16:59:00

Author:
one-mad-bunny
Posts: 334


Using L3 combined with the stick isn't really easy to do, and I don't want it to take the player's input for direction - my problem was just automating the "bounce away from danger". And with your setup, being surrounded by danger would make it lag terribly, just as it is currently. I think I'll just use sensors to detect any danger source - projectiles and enemies - and make the player move away from the closest one, but only scan for proximity at the start of the animation - so the player will end up bouncing in another danger if he does something stupid. Anyways, it's not a key feature of my level. Thanks all guys!2012-03-03 18:02:00

Author:
Unknown User


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.