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

Lock on?

Archive: 12 posts


I have a level that can have multiple emitted enemies, and multiple emitted support bots. I was using look at rotators to make the bots target the enemies, but that has the problem of switching targets when another enemy gets closer even if your current target is still in range.

I would like to be able to target the same enemy until it goes out of range or is destroyed, then switch to the next closest.

I know how I can do this with tags and tag sensors to sort the enemies by range, but his would require unique tags on each one. And would require a semi complex targeting/sorting system on each of my bots. Since the enemies are emitted, that creates an issue.

Does anyone know an easier way to do this?
2011-03-04 18:43:00

Author:
tdarb
Posts: 689


emit a piece of holo with a chip with a tag along the lines of "lock on" and a follower for your enemy, have the turret look at the "lock on" tag2011-03-04 18:50:00

Author:
Foofles
Posts: 2278


interesting. I hadn't thought of that.

I won't be directly controlling a cursor to emit the follower, so sow would i get the bot to emit it over the appropriate enemy? They can each be targeting a different enemy.

That still leaves the issue of my bots having to have the sorting/targeting algorithm on them. I think that's going to be the case either way though. This can be a huge pain when I may have 15-20 enemies and 5 bots on the level at once.

It seems like there would be a simple way for each bot to pick the closest enemy to it and stay with that until its tag is out of range (i.e. destroyed or moved away).
2011-03-04 19:03:00

Author:
tdarb
Posts: 689


It could be activated or emitted by the bots themselves. Are you going to have a predefined limit on how many bots there will be in the level?

There is no need for a sorting algorithm. One approach would be to give each bot's targetting reticle a unique tag so each bot would only care about its own targetting reticle. This works if you have a pre-defined limit of only a few bots at any given time.
2011-03-04 19:12:00

Author:
Foofles
Posts: 2278


Worst case scenario a bot changes target to the lock of another bot. That will look as if he is helping his friend after which both of them will target the original target. Sounds like a limitation that turns out to look pretty sweet really.2011-03-04 19:29:00

Author:
Antikris
Posts: 1340


Theoretically there will be a limit on how many, i haven't decided what that will be yet. i would like to keep the bots as identical as possible as they too will be emitted, so using different tags would be an issue.

I'm liking the idea of a targeting reticle though. If I can find a way to make that jump to the closest enemy, I may be able to get that to work using invisible targeting reticles. The other issue would be making each bot only recognize their own reticle.

It would need some form of sorting to know which one is closest wouldn't it?
2011-03-04 19:31:00

Author:
tdarb
Posts: 689


Why would that matter? Followers and rotators automatically seek the closest tag. Plus, the bot's target may not be the closest available target to him at all times so just sorting it by closest reticle to make sure you're following only its own wouldn't work well.

Also, I agree with Antikris
2011-03-04 19:38:00

Author:
Foofles
Posts: 2278


Yes. If I only wanted the closest to be targeted I could use a "look at" rotator and be done with it. That's not what i want though.

Say I have two enemies (A and B). Enemy A is 4 grid squares away, and B is 6. I want my bot to target enemy A.

If A stays where it is, and B comes within 3 squares away, I do not want to retarget to enemy B. I want it to stay with A until it falls back out of range completely or is destroyed.

Unless I am missing something, to do this I would need to sort out the enemies in range to find the closest, and then use some form of logic to remain locked on that one until it is gone. The target tag going away frees up the target lock to find a new target. It's simple enough to do with a couple of known tags. The issue is that with upwards of 20 enemies at any given time, and multiple bots, this method seems to present a substantial hit to the thermo.

Your targeting reticle could be the answer if there is a way to get it to retarget on the closest enemy when it has no target, and be associated only with its bot.


Worst case scenario a bot changes target to the lock of another bot. That will look as if he is helping his friend after which both of them will target the original target. Sounds like a limitation that turns out to look pretty sweet really.

That would look really cool, but I don't think it will work for what I am trying.
2011-03-04 19:50:00

Author:
tdarb
Posts: 689


Oooohhhh, I have the perfect system for this, lol. First thing I made.

Each unit has a tag
Each enemy has a tag sensor to detect units which activates another tag
The 'aimer' holo piece goes towards the enemy tag. When it arrives, it starts a timer, which then activates another tag, which makes the 'lock on'

Thus, NPC units can auto aim at targets, and then activate the 'lock' after sufficient time (or instantly). Depending on how you want it to work, this could either disable the aimer (now select option to now follow locked target) or still let the aimer roam, following all units that enter the range of the unit.

Thus, the aimer only aims at enemies within range of the unit (from the tag / sensor combo), and will stay locked onto a target until dead (or you disengage the lock yourself).

EDIT: just finished reading posts. This setup doesn't work with multiple units, like what was requested, so nvm. I do have another system that is completely isolated from the outside (no tags), but its a little more complex, which you want to avoid, so not much help there.
2011-03-04 20:45:00

Author:
SSTAGG1
Posts: 1136


that's a neat approach sstagg.

I think i have sorted it out by sort of combining what you guys all have said.

Basically my bots look at something and fire (and sometimes move, but that's not the important thing here). So the hard part is getting them to look at the right thing.

I've taken a holo piece with the follower like you guys said. Since it is automatically attracted to the closest item, I can easily get the right one targeted. I attached this to a piston that is 0 strength.

Now my bot is bolted to another piece of material that controls the location of the bot. Whenever my holo follower detects an enemy it jumps out to it and stays with it until it dies or is destroyed. then I've another tag sensor with a very small radius to detect when the enemy goes away, and a toggle switch to turn the follower on and off, so I can retract it back over the bot before activating it again to target the next enemy.

It's not as nice as being able to just target a tag and be done, but it allows for a great deal of flexibility when using variable numbers of emitted bots/enemies. I'm still looking for better ideas
2011-03-04 22:07:00

Author:
tdarb
Posts: 689


Once I sort out the one I am currently using, I'll be able to help you. It stopped working just now, no idea why. Must have meddled with it while making some other stuff.2011-03-04 23:18:00

Author:
SSTAGG1
Posts: 1136


Your targeting reticle could be the answer if there is a way to get it to retarget on the closest enemy when it has no target, and be associated only with its bot.

That is the point of it. You could have it persistent and use a tag sensor with a small radius to see if the enemy is destroyed, and then if it is, activate a follower on the reticle to find the next one. Similar approach can also be used with emitted reticles.

The point in my post was that I don't see why you'd need a sorting algorithm if you're using a reticle, it handles that for you.

I just read down a little and I was just about to recommend using a physical restraint on the reticle. It's kind of LBP1-eque but I think it is your best approach.

If you're going to do that you might want to limit its reach or the reticle could potentially drag the bot around. You could use a tag sensor to look for the bot but then presents the problem again of being confused between bots if they are close and have the same tag. Though I suppose you could bolt the bot to a hologram base and if the bot is to be stationary just activate a full dampening on that base with an anti-grav, the bot itself would still turn freely.
2011-03-05 11:02:00

Author:
Foofles
Posts: 2278


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.