Home LittleBigPlanet 2 - 3 - Vita - Karting LittleBigPlanet 2 [LBP2] Tutorials
#1
Determining the origin of the strongest analogue signal
Archive: 8 posts
After a bit us musing and brain-work-ery, I managed to create a (surprisingly) simple way to determine the maximum value(s) of multiple inputs AND determine the origin. Usual maximization logic looks something like this: http://i3.lbp.me/img/ft/2834e1c7060bdb191df1983adc322c75b1c62d1b.jpg However, all this does is isolate the maximum signal and send it through to an output. With the addition of a few more pieces of logic, it is fairly easy to come up with a device that determines what the maximum signal is AND then sends an ON signal through one of its outputs that corresponds to the maximum input. (For instance, if you have inputs A, B, and C which correspond to outputs 1, 2, and 3, if B was the largest analogue signal, then output 2 would receive an ON signal.) Here's what it all looks like: http://i7.lbp.me/img/ft/4d7f0573dc6c746dcc88bf2c7ff4a4dd8336d81a.jpg It's still fairly simple, really. But I'll explain how it works, as deciphering a logic chip is not the easiest of tasks... It starts off by taking the three signals and determining the largest one using OR gates. Post sorting, it refers back to the original three signals, and subtracts each one from the maximum value. Any value that is the same as the maximum (thereby determining the origin(s) of the maximum(s)) will output an analogue signal of 0. These then connect to sequencers set to POSITIONAL and are followed by a NOT gate, which essentially says that any signal not equal to 0 will output not signal at all. And that's really the gist of it. Here's a few pictures using some color coded sackbots to prove that it actually works. In this example, the 3 inputs are the inputs from tag sensors (set to detect the CLOSENESS of the tags on the sackbots) on the white piece of dark matter above them, and the outputs are on/off signals to three colored lights. http://i6.lbp.me/img/ft/4d696e0dd28e60057de2e1ad77454bec865de075.jpg http://i9.lbp.me/img/ft/039265663aa980a8ba3fdb57814f0ae76cf121fc.jpg http://i3.lbp.me/img/ft/bd38e5f0528596545dad40c862ae7029d163dc77.jpg A few things to take into consideration with this layout: -The entire systems works based off of the magnitude of the signals, not the sign. For instance, in the case of signals [-60, 0, 35] it would see -60 as the largest value. -The output is NOT equal to the magnitude of the input. As of now, it outputs an analogue signal of 100 and a digital signal of ON. -If there are multiple signals that are equal to the maximum (i.e. [50,0,50] or [-65, 10, 65]) there will be multiple outputs. | 2011-02-25 20:07:00 Author: dr_murk Posts: 239 |
Much simpler than the design I came up with. I had four signals and I set it to so signal two was subtracted from signal one, and four from three. Each of those circuits would pass through the stronger signal and the results would be subtracted from each other. It was complicated and I had to use a few tricks to make it actually work, but this method (I saw this proposed in my help thread, but I'm not sure if it was you that posted it or somebody else) is much simpler and should be easy to scale to any number of inputs. But wouldn't it be simpler to just use an OR with three inputs instead of two with two inputs? | 2011-02-25 21:18:00 Author: Sehven Posts: 2188 |
There has been some question of whether this approach would be entirely reliable. Personally I believe there's no reason it wouldn't be, and I would proceed with that assumption until I find some reason to doubt it... However, for those who might be concerned, I'll explain the issue and the ways around it. The concern arises from the fact that you're taking OR(A, B, C) (that is, max(A, B, C)) and looking for an exact match with one of {A, B, C}. The two most obvious ways this could fail are if there is some latency in the calculation of max(A, B, C) which could cause the equality test to fail if there's a change in that value from one frame to the next - or if the OR gate itself somehow makes a small change to the magnitude of the strongest input signal when calculating its output. You could safeguard against this possibility by making your "equality" test not rely on an exact match (allowing, say, a 1% margin of error by checking that (abs(A - max(A, B, C)) - 0.01) < 0) - of course, then if you have inputs 0.99 and 0.98, they would be considered "equal"... But in most cases this isn't going to be an issue. A difference that small probably won't be obvious to players anyway. The other alternative would be to directly compare each pair of test signals: put direction combiners between A and B, A and C, B and C - And output true for A if (A-B) and (A-C) are non-negative, output true for B if (A-B) is non-positive and (B-C) is non-negative, etc. This approach grows more complicated as you add more inputs, however: (n-1)! direction combiner/direction splitter pairs and 2*(n-1)! sequencers, and (n) AND gates with (n-1) inputs each... | 2011-02-25 21:24:00 Author: tetsujin Posts: 187 |
An OR gate with 3 inputs..... Wow you know, that (amazingly) never occured to me! Haha but YES that would make it a bit simpler! That was NOT me that posted that on your thread, however, I did read your thread (just the first post, really) and then decided to try and make it myself. Also, it is VERY easy to scale this upwards. I made a 4 input one in about a minute after I had the 3 input one. | 2011-02-25 21:25:00 Author: dr_murk Posts: 239 |
Ah!! Many thanks for sharing this great litle 'tool', and although not entirely related it has given me some insight on how to build a device for capuring race data, I.e order of scoring for first, second third etc & also for recording 'player who achieved the fastest lap' so even if they came last overall thay can still be awarded for it. mmm? my mind is ticking over on many such applications for this with a few minor tweaks for additional multi-tasking.......I will keep all posted. Thanks again!! | 2011-02-25 23:11:00 Author: CloaknBlagger Posts: 78 |
This is very neat. What would be some uses for such a thing? Aside from the sackbots and the lights you demonstrated. | 2011-02-25 23:18:00 Author: piggabling Posts: 2979 |
Just from how Sehven used it in his level- you can use it to make the CLOSEST sackbot be targeted by something. Other uses? Hmm..... you could use it so that only the CLOSEST of something (probably a light) to sackboy is turned on. Theres tons of uses for it actually. And this might just be one of those chips that ends up being used INSIDE of other chips a lot more than it does on its own. | 2011-02-25 23:27:00 Author: dr_murk Posts: 239 |
What would be some uses for such a thing? Just from how Sehven used it in his level- you can use it to make the CLOSEST sackbot be targeted by something. Yup. I built a boss fight against Darth Vader in my level and wanted to have him use the force to throw debris at the player like he did with Luke at the end of Empire. Normally it's a simple matter to target the closest player, but in this case, the attacks were coming from elsewhere in the room, not from Vader himself, and they were using followers. With four players, the player who's closest to Vader would have ironically been the safest one, so I needed a system to make the debris target him instead of any of the other players. So Vader has the closeness chip on him and determines which player bot is closest (each has a unique tag) and then sends a wireless signal to the debris pieces to track that tag. You can actually see the debris change course mid-air when one player moves in closer to Vader than the other player. Later I found that I was having problems with Vader's lightning: it used a "look at" rotator which is supposed to look at whichever player is closest, but it didn't work exactly right. Sometimes the lightning would shoot straight into the ground or straight up into the air. So I rigged it to use the same targetting system as the debris and it worked perfectly afterward. As for other uses, it could be used for a myriad of targetting systems. Making a Mario Kart or Wipeout level? Rig a missile to track the player closest to the one who fired it. | 2011-02-26 00:02:00 Author: Sehven Posts: 2188 |
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.