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

Proximity Follower

Archive: 23 posts


Okay, I made a logic thing I can't explain because it is part of a super-secret level, but I need help on one part so here's what I want it to do.

Lets say I have 3 ships and a boss shooting homing missiles. I want missiles to lock on to the closest ship and then follow it. I can't just use a follower set to follow tag AnyShip, because if the closest chip moves away the missile might change path, which would be weird (don't try to make me change my mind, I'm saying half the truth to hide the level's system).

So I know how to get which signal is the nearest. I made all the logic with a selector which prevents being changed after activated once. Now the big problem is : the game zone is big. The missile needs a detection radius of 100. If the missile is equally close to two ships, it stops moving. With a smaller radius, it would be hard to be at the same distance, but detection is not precise with tag sensors set to large radius. I can't make one player override others, because if i have this (okay, pretend A and B are at the same distance from BOSS)

BOSS

A B


C

It would be weird to see the boss shoot the C. But I can't make it work. I just am tired of restarting. Is there a genius here? Anyone? For now I have this chip :
If 1 is closer AND NOT ((1 AND 2) OR (1 AND 3) OR (2 AND 3)) then aim on 1
So it aims on 1 if there is no equal signals between ships and boss.
(keep in mind all these are digital signals, and if analog detection signals are equal, the "closer" is on for both.
2011-07-15 00:08:00

Author:
Unknown User


Send me a psn request first. Then I can help if you copy the logic and I can help program it on a blank level. That way you don't show me the level and I can tell what the logic looks like. Psn is fly_4_a_jedi

Ok I have a model working just join me sometime and I can explain it. It was complicated but now all you need to do is tag the ships. I can upgrade it to support 4 ships but all you mentioned was 3 so I have that.
2011-07-15 00:23:00

Author:
fly_4_a_jedi
Posts: 151


there is actually a pretty simple setup that would work for this, when the homing missile is emitted, you have it compare the distances to all the ships, activate the follower for the closest ship and disable the rest (selector)
using this method (quoted from another thread) it's highly unlikely 2 ships will be exactly the same distance as it detects even 0.0001% difference


to find which is greater of 2 signals, just connect straight from the source to the combiner, combiner to a splitter then a positional sequencer on each output with a battery filling each sequencer.
to check which is greater of more than 2 signals, imo the best way would be to wire all signals into an OR gate (OR will output the highest signal) then compare each signal to the output of the OR to see which matches. to see if 2 signals match you wire them to a combiner, then a positional sequencer with a battery filling the whole thing, then wire the battery into a NOT gate.

or if you want the boss to aim at the closest ship first you could have that logic on the boss and replace followers with look at rotators then either emitt a diff missiles for each ship depending on which is closest or still use the above logic on the missile aswell
2011-07-15 07:16:00

Author:
evret
Posts: 612


You could just make a different missile that follows each player, and depending on who's closest, have the boss fire a different missile.2011-07-15 12:10:00

Author:
Brannayen
Posts: 438


@evret: but a missile can follow a trajectory that leads him closer to another ship than the one it was tracking, making it switch targets. This is a problem, if I understand OP correctly. AFAIK the only reliable way is to have each ship individually tagged (there is a good discussion going in the projects forum about uniquely tagging emitted objects) and make that the basis of your system.

Determin which of all those tags is closest and then shut down all further decision making; for each individual tag there is an individual follower (or rotator, whatever) that is activated if that tag is the closest.

EDIT: alternatively, following Brannayen's suggestion, if the missile logic is so complex that you'd rather not make unique copies just to have unique tags, think of having one missile: the missile follows a block of holo that has a tag "enableMissileFollowing". Then you have 3 of those blocks, emitted with the missile; each block will go after another player tag, but they will all self destruct practically immediately after being emitted unless the tag it is going after is the closest of all. The remaining block will then activate its "enableMissileFollowing" tag.
2011-07-15 12:52:00

Author:
Antikris
Posts: 1340


@evret: but a missile can follow a trajectory that leads him closer to another ship than the one it was tracking, making it switch targets. This is a problem, if I understand OP correctly. AFAIK the only reliable way is to have each ship individually tagged (there is a good discussion going in the projects forum about uniquely tagging emitted objects) and make that the basis of your system.




there is actually a pretty simple setup that would work for this, when the homing missile is emitted, you have it compare the distances to all the ships, activate the follower for the closest ship and disable the rest (selector)


i meant permanently disable the rest, could be done by placing all the compare logic in a chip and disabling it after it has selected one, as you pointed out in that other thread it can be done by adding an extra output on the selector with the wire going to the compare chip (selector state should have this output on at start) then as soon as another state is chosen it will disable the compare chip

EDIT: my method would require the ships have different tags, but i was assuming pivottt already had it like that
2011-07-15 13:32:00

Author:
evret
Posts: 612


I have a model doing exactly what evret said, if you raise the tag sensors too high there is a huge zone that the ships can be in and be counted as the same. The difference in my model is I have a selector to prioritise which one if two are the same distence. I have built this because I don't like to provide bad info it is tested and works.

35585

This is the problem it reads these tags the same distance from that rocket, when they obviously are not. He wants it to be more accurate, but it to do that you have to drop the sensor range.
2011-07-15 15:04:00

Author:
fly_4_a_jedi
Posts: 151


in the first post he mentioned his sensor range needs to be 100, with my setup it still works perfectly set to 500 so you must not be doing it the same as i described.
and please don't assume it's bad info just coz you can't get it to work.
i knew it would work without testing, then i just tested it and proved it works
i can slowly move one tag past another (while set to 500) and it's pretty much impossible to get both close enough to be sensed as being the same distance

http://i8.lbp.me/img/ft/6a83a1caa399b1b752b41c863fae294581349a28.jpg
2011-07-15 17:02:00

Author:
evret
Posts: 612


Oh I didn't see that I have mine set to 5000 so it is really inaccurate I had it working perfect at lower settings. Thanks for pointing that out I thought he needed the area to be huge.

I didn't. Use the way you described I had it built last night then you described it mine looks slightly different, but the basis are the same.

35587
It is slightly different.
2011-07-15 17:09:00

Author:
fly_4_a_jedi
Posts: 151


this would be the full setup i described earlier (note you would have to set the selector to the bottom state while in pause mode or the chip disabled)

http://if.lbp.me/img/ft/9af31e878a78aed60efe9ddbdb86492f1adf49db.jpg
2011-07-15 17:25:00

Author:
evret
Posts: 612


We have very similar setups. I think they will do the exact same thing. I didn't think of using the selector to turn the chip on and off, but the toggle is used in the same way.2011-07-15 17:32:00

Author:
fly_4_a_jedi
Posts: 151


Thanks for help, but I already did what you told me, and with my 100 range it is not precise enough.2011-07-15 18:01:00

Author:
Unknown User


whats not precise about it? with my setup no two were ever on at the same time, even with a sensor radius as high as 500, i dont understand the issue as i have tested it and it works perfectly for what you have described

edit: even if for some reason the 2 closest ships manage to be at exactly the same distance (highly unlikely) the fact there is a selector there will mean it will chose one of the closest depending on which is lower on the selector, this setup will never select 2 ships, this setup will never select a ship further away than another ship.
2011-07-15 19:18:00

Author:
evret
Posts: 612


This is where YOU are wrong. The EQUAL chip sends 100% signals when equal. So if it thinks all 3 ships are at the same distance from the boss because it is not precise enough, it will send 3 100% signals, and will activate the bottom input of the selector. But it is a big problem as it is NOT PRECISE ENOUGH.

I met fly_4_jedi (whatever if that's the username) - lol, I still remember his true name but he told it once only - and he had just like I had and you had. Just take a tag sensor set to radius 500 (which was what I tried first). Then place a tag close to it. Hook the sensor's output to a logic probe (see in the creator's toolkit, it is a device which tells the % of a signal, even as small as 0.01% signals). It should show +1.000 (100%) Now move the tag away and place it. Do that untill the number changes. See? Not precise at all. Now place it reasonably close to the sensor (pretend the sensor is the boss and the tag is a ship), and shrink the range down untill it is not 100%. Even at 100 range, it tends to have a weak zone close to it. my ships are small, so yes, it is important. Yes, it makes everything fail.

Why not use the selector's override even if it fails a bit ? Read my posts. Read.
Thanks for trying to help me, but I really can't find any way. Perhaps creating a system which says A overrides B, B overrides C, C overrides A.
2011-07-19 02:36:00

Author:
Unknown User


For the overriding couldent you just hook selectors with 2 input together? I will try and build it and show you but do you want the order like you listed?

And I thought of a way to have a equality chip that will read the signal it is fed if that will help.
2011-07-19 02:43:00

Author:
fly_4_a_jedi
Posts: 151


I have tried to read through all these posts (but admittedly not every word) and have come up with something that seems to work.

I'll try to explain it and maybe then something will click...

http://i0.lbp.me/img/ft/a405ddb8110663f1ca70bf204a89db18f9f1fe87.jpg

Each sequencer has a battery that detects a signal from the AND gate. So if there's a signal on top, A is closest. If the signal is on the bottom, C is closest. If neither the top or bottom is active, then B is closest. Basically, A and C have to win both arguments to be the closest ship. If they both fail, then ship B must be closer, so you don't need the middle sequencer. It's not as complicated since you don't have 4 players. I feel like there's a geometry postulate that explains why this logic works, but I'm not sure what it is.

Whichever one wins, the output should go to a permanent switch connected to a follower on a microchip and turn off the microchips that contain the other two followers.

This worked no matter how I shuffled the three ships around. The positional sequencers picked up even the slightest signal. Worst case scenario is that all three ships are actually an equal distance from the missile when it is fired, in which case it would default to B. I can't see that happening.

The only other time it would be a problem is if A and C are an equal distance away with B trailing in the distance. The way I have this configured, the middle splitters are set so that if A > B and C > B, the AND gate will activate. I have it wired to a sequencer in the picture, which should then be wired to a NOT gate. If the battery on that sequencer activates, then the logic will NOT be able to target B. As long as everything is still moving around when the missile is fired, then this delay will only last a frame or two.

I realize this is similar to your original design, just thought I'd take a stab at it. Like I said, it seems to be working. I saved it so if you want to try it let me know.

@Antikris - could this be an application for your simultaneous event buffer? The two ships being in the same location could be the event, in which case the logic would flow to default to one or the other (situational)... rather than a default option C... right?

edit: also, ignore the gap on the sequencers that are visible on screen.. i was playing around with something when i took the picture. those batteries should start at the beginning.
2011-07-19 07:49:00

Author:
shane_danger
Posts: 283


This is where YOU are wrong. The EQUAL chip sends 100% signals when equal. So if it thinks all 3 ships are at the same distance from the boss because it is not precise enough, it will send 3 100% signals, and will activate the bottom input of the selector. But it is a big problem as it is NOT PRECISE ENOUGH.

I met fly_4_jedi (whatever if that's the username) - lol, I still remember his true name but he told it once only - and he had just like I had and you had. Just take a tag sensor set to radius 500 (which was what I tried first). Then place a tag close to it. Hook the sensor's output to a logic probe (see in the creator's toolkit, it is a device which tells the % of a signal, even as small as 0.01% signals). It should show +1.000 (100%) Now move the tag away and place it. Do that untill the number changes. See? Not precise at all. Now place it reasonably close to the sensor (pretend the sensor is the boss and the tag is a ship), and shrink the range down untill it is not 100%. Even at 100 range, it tends to have a weak zone close to it. my ships are small, so yes, it is important. Yes, it makes everything fail.

Why not use the selector's override even if it fails a bit ? Read my posts. Read.
Thanks for trying to help me, but I really can't find any way. Perhaps creating a system which says A overrides B, B overrides C, C overrides A.

ok, so your saying your issue is the dead zone on the sensor, you could have just said that to begin with instead of talking about lack of precision in the setup, if you had been clear from the start i could have solved your problem at the start.
all you have to do to fix the dead zone issue is raise the minimum detection range from 0.0 to 0.1
ask the right question and you may get the right answer
2011-07-19 08:23:00

Author:
evret
Posts: 612


YESSSSS ! THANKS !!!
Finally someone who understands.

detection is not precise with tag sensors set to large radius

my 100 range it is not precise enough

at 100 range, it tends to have a weak zone close to it
I thought I were clear with the first sentence : DETECTION. SENSORS are not precise. Whatever what logic you build, if the sensors are not precise, it won't work.
Sorry if I were unclear. I didn't know how to explain it better than that, well in English (I speak French).

I looked back at everyone's logic and found out another problem. If all ships are dead, 0=0 right ? So it will shoot missiles towards ship3.
The thing is, the emitted logic is off for 1 frame. So as soon as the missile appears, it doesn't detect the ships for one frame, so it has 0=0 for each ship, so it sends 3 100% signals. Because of this, the boss shot the wrong ship. How to fix it ?

http://i1.lbp.me/img/ft/9d15051249733704d045053999b1c064dced2ead.jpg
(EDIT : picture fixed)

This makes sure signals are not sent when they are all equal. I couldn't do it before, because they were equal too often, but with the 0.1 thing it should work. Thanks all, I'll finish my logic now!
2011-07-19 16:59:00

Author:
Unknown User


If all ships are dead, 0=0 right ? So it will shoot missiles towards ship3.
The thing is, the emitted logic is off for 1 frame. So as soon as the missile appears, it doesn't detect the ships for one frame, so it has 0=0 for each ship, so it sends 3 100% signals. Because of this, the boss shot the wrong ship.

If all ships are dead and 0 = 0, then why would it shoot at ship 3? There is no ship 3, there's no ship at all, right?

Also what if you reversed the output of the tag sensors so that the weakest signal was closest to the ship? Then if A > B and B > C, then C is the closest ship. The tag sensors seem to work better with the smaller output since the only way to get to 0 is to overlap the tag and sensor.

Sounds like you got it figured out, though. I'd like to play this level when you finally publish it.
2011-07-19 18:09:00

Author:
shane_danger
Posts: 283


this is just the same as you did to fix the problem, but with less gates (assuming your still using the selector)
http://ib.lbp.me/img/ft/93b9819af1874508d355db6044a8fcb3441e9e30.jpg
2011-07-19 20:51:00

Author:
evret
Posts: 612


Yes, sure! Thanks all guys. I'll be happy to show you the level when it's done.
And shane, I know it looks weird like I said "if there is no ship it would shoot at ship3" but I meant it would lock on to ship3 because ship3 is the down one on the selector. So since it takes a frame to detect ships, it locks on to ship3 even before trying to know if there are any ships. I'll do it tomorrow - or the day after (god I'm gonna have to hurry before the end of LBPC2) cause it is late. Or tonight ? Blah
2011-07-20 03:13:00

Author:
Unknown User


Oh, I see. Well you could have a 4th output that is blank and wire all the signals to an and gate. If they are all true it will go to that port.2011-07-20 04:47:00

Author:
shane_danger
Posts: 283


Erm, that is just what evret did, and I answered yes, but after thinking no it wouldn't work. Cause the missile must never unlock from its... oooo nevermind, you can cause the AND gate and the logic is on the chip getting disabled. K.

Btw, I tested it with others, and it works. Fixed couples of errors and now I'm ready to make the level itself. And I have less than 10 days. Great.
2011-07-21 17:49: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.