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

Analog signals from rate of activation.

Archive: 22 posts


I am currently thinking about a level idea which I will probably not be working on until later (due to my assistance in another project), which is a sort of level where you are sackbots rolling across a landscape in a race, and how fast you press a button determines how fast you roll. The idea is that some sack who presses the button the fastest will roll the fastest and win the race. The problem is, I want to generate an analog signal based on how fast you press the button. If you press the button slowly, say, it would only generate a value of 20%. If you press it quickly, it would generate a value of 80%, and etc. The thing is, I don't know how to do this. So far, I can only come up with systems that only decide whether to increase or decrease the signal based on how fast I press the button, but I want to make the analog signal to actually decide how strong it is based on how fast I'm pressing the button, and not just to get larger or smaller. Help, please?

EDIT:
Crud! I forgot my quote!


I miss the good old pre-war LBP days when we didn't have to dodge all these stupid bombs.
2012-03-06 23:20:00

Author:
Kalawishis
Posts: 928


So far, I can only come up with systems that only decide whether to increase or decrease the signal based on how fast I press the button, but I want to make the analog signal to actually decide how strong it is based on how fast I'm pressing the button, and not just to get larger or smaller.

There's probably a simpler way, but here's one possibility...

http://ib.lbp.me/img/ft/7eb7965fcce5a284b2475348eb61a70f9ff7a9e0.png

...which measures the number of times you pressed the button in the last second, where 0 is 0%, and 15 is 100% - 15 being the maximum number of presses the game can detect in one second - best I could manage was 14.

'A' is a self-resetting timer set to one second, which toggles the selector to switch between two parallel circuits. The active circuit counts the number of times the blue input wire is activated using counter 'B' set to max 15, and the inactive circuit's counter is sent to the output of the OR gate, and displayed on the speed-scale timer 'C' set to max 0.1s.

You can actually just take the output directly from the OR gate, but if you instead take the output from timer 'C', you can smooth the output to avoid jerky speed transitions by increasing its max value.
2012-03-07 17:43:00

Author:
Aya042
Posts: 2870


That's actually quite ingenious. It's not perfect, though, but I guess you can't really make it perfect, with the game's limitations. Still, I think this will work! Thanks!2012-03-09 00:41:00

Author:
Kalawishis
Posts: 928


It's not perfect, though, but I guess you can't really make it perfect, with the game's limitations.

Well, I don't think you can detect faster than 15Hz (given a 30Hz framerate), but there might be a sneaky way that hasn't occurred to me.

The other problem with this is that the signal is only updated every second, so you might get better results by measuring the time elapsed between the last two button presses.
2012-03-09 21:03:00

Author:
Aya042
Posts: 2870


Here's one that measures the time between each button press so the signal produced is more instantaneous.

http://oi39.tinypic.com/25k1krn.jpg

sorry if it looks a bit cluttered, but the way I organize my chips is to make them as compact as possible w/o hiding or crossing too many wires. Here's the breakdown

http://oi40.tinypic.com/23u4m4x.jpg

Starting from the top left, every time you press the button, it resets the memory and stores the new time simultaneously into the feedback. The bottom left latency is so that the timer only resets after the signal has been stored. If you stop pressing the button, the memory slowly gets subtracted with a 5% battery. The short delay before it starts subtracting is so that the final signal is more stable.

Tell me if you find anything wrong
2012-03-09 23:03:00

Author:
Unknown User


Wow...I'll build it and tell you if I find anything wrong.2012-03-11 23:47:00

Author:
Kalawishis
Posts: 928


I would just do a feedback loop system. Place a OR gate and connect it to a combiner's positive input. Take the combiner's output and run it back through the OR gate. This way the signal is stored. Place a AND gate and wire a 1 pulser to it (1-frame self-reset counter). Trigger the pulser with the button you have to press fast. Take a battery and plug it in the AND gate. The AND gate's output goes in the OR gate. Now pressing the button will add the battery's signal to the loop stored. Then take another battery and plug it in the combiner's negative. Now every frame the signal goes down, every time you press it goes up. Ajust the signals so that you have to press very fast to make the signal go up. Now there's one problem here. If you stop pressing, the signal is negative, we don't want that. Place a splitter and wire the signal from the combiner. Then plug the positive output in the OR gate, instead of the combiner's signal. Now you discarded the negative signal. This way, every time you press the button, it gives a small boost to the speed. Now that may not be what you want, it's just how I would do it.2012-03-12 02:43:00

Author:
Unknown User


I do not have anything to add to the excellent logic presented here, except that if the maximum detection frequency is deemed to easy to achieve (making the game a challengeless faceroll), consider adding obstacles in the course that try to disrupt your concentration or accuracy; i.e. you will need to use another button to jump over pits. Or you could demand that a player not hits one button but two different ones consecutively. Or the left and right direction of an analog stick; that is how most of the oldschool Konami sports games worked.

Wire a button on a controlinator to a self-resetting 1-shot counter in order to force the player to release the button and press it again.
2012-03-12 14:16:00

Author:
Antikris
Posts: 1340


...if the maximum detection frequency is deemed to easy to achieve...

I tried it out a bit. I wouldn't say it was difficult, more like physically painful. So I guess the winner will always be the player least concerned about RSI (http://en.wikipedia.org/wiki/Repetitive_strain_injury).
2012-03-12 14:27:00

Author:
Aya042
Posts: 2870


I tried it out a bit. I wouldn't say it was difficult, more like physically painful. So I guess the winner will always be the player least concerned about RSI (http://en.wikipedia.org/wiki/Repetitive_strain_injury).

I think a more enjoyable and less repetitive challenge would be to demand different keystrokes for different segments of the level / different manoeuvres. I.e. XXXXX to build up speed, OOOOO to slow down faster, etcetera.
2012-03-12 14:32:00

Author:
Antikris
Posts: 1340


There's probably a simpler way, but here's one possibility...
http://ib.lbp.me/img/ft/7eb7965fcce5a284b2475348eb61a70f9ff7a9e0.png


Hmm.. Nothing to add either, just a question...
Considering i am not a XOR lover (neither genius) myself could you care to explain (or anyone else), with the simplest words possible, the use of 3 input XOR and whats the purpose of the 2 of the same signals on it? Mainly what's the purpose/use in general and not in the specific circuit (because obviously i wont get it). lol
Thanks in advance. : )
2012-03-12 15:02:00

Author:
zupaton
Posts: 167


the use of 3 input XOR and whats the purpose of the 2 of the same signals on it? Mainly what's the purpose/use in general and not in the specific circuit (because obviously i wont get it). lol

Evret showed this to me a while back and I didn't get it at first either. A 2-gate XOR gate will behave like this: 1+0=1, 0+1=1, 0+0=0, 1+1=0. Right?

A XOR gate with more than one input will behave likewise: 1+0+0=1, 0+0+1=1, 1+1+1=0, 0+0+0=0... and then 1+1+0=0

So the duplicate line there is to deactivate the XOR gate. When the XOR gate is active, it will allow an analog signal to freely pass. Why? Because the alternative would have been an AND gate. That in itself is no problem - an AND passes on the lowest of its analog values - however, this gets very hairy with signed values (negative values).

I don't even know what gets passed through an AND gate in the following examples... 100% + 50% + -25% = ?, 100% + -100% + -50% = ?

So I guess this is a very save way to control analog signal throughput without disturbing its value.
2012-03-12 15:41:00

Author:
Antikris
Posts: 1340


Thank you very much.
So, its kinda like a chip relay type of circuit where the signal passes through it when the chip is activated if i am getting it right?
Dam. There are so much undocumented features (or featured glitches) in this game (i am not sure we talking about a game even) that drives you... em...me, nuts. lol

Thanks again. : )
2012-03-12 16:25:00

Author:
zupaton
Posts: 167


So, its kinda like a chip relay type of circuit where the signal passes through it when the chip is activated

When the duplicate input on port #2 and #3 contains NO signal, the signal on port #1 is allowed through unaltered. When port #2 and #3 do receive a signal, the XOR gate shuts down.
2012-03-12 17:09:00

Author:
Antikris
Posts: 1340


...could you care to explain (or anyone else), with the simplest words possible, the use of 3 input XOR and whats the purpose of the 2 of the same signals on it?

It's a generic signal relay that's generally more thermo-efficient than the traditional "enable a microchip containing a circuit node" design, and generally more reliable than a two-input AND gate. There's a thread all about it here (https://lbpcentral.lbp-hub.com/index.php?t=58316-Mini-tutorial-Applying-different-analogue-signals-to-a-single-input).

TBH, in that particular circuit, it's unnecessary - a two-input AND gate would've sufficed. I just tend to use it by default.



...an AND passes on the lowest of its analog values - however, this gets very hairy with signed values (negative values).

Not quite. A two-input AND gate can work as an effective signal relay for negative values in many cases, but where it becomes problematic is when you have a signal where the digital sign doesn't match the analog sign, which is pretty common with some controlinator outputs.

From the same thread as above...


Despite what rtm's blog (http://www.lbpcentral.com/forums/entry.php?2069-Analogue-Logic-1-Fundamentals) claims...



Inputs | AND / | OR /
a | b | min() | max()
------------------------------------
100 | 35 | 35 | 100
50 | 65 | 50 | 65
50 | -10 | -10 | 50
-50 | 30 | 30 | -50
-45 | -60 | -45 | -60
0 | 100 | 0 | 100
0 | -100 | 0 | -100


...that is, that the sign of the output from an AND gate matches the sign of the lowest (absolute) input, it seems instead that the sign of the analog output is equal to the product of the two signs of the digital inputs, such that...



a | b | a AND b
------+-----+---------
+ve | +ve | +ve
+ve | -ve | -ve
-ve | +ve | -ve
-ve | -ve | +ve


...so the two figures highlighted in red in the first table both have the wrong sign, assuming the digital sign matches the analog sign, where digital zero counts as positive.




I don't even know what gets passed through an AND gate in the following examples... 100% + 50% + -25% = ?, 100% + -100% + -50% = ?

IIRC the magnitude is always the lowest of all absolute magnitudes, and the sign is the product of all digital signs, so assuming the digital sign matches the analog sign for your examples, it should be -25% and +50% respectively.
2012-03-12 17:19:00

Author:
Aya042
Posts: 2870


When the duplicate input on port #2 and #3 contains NO signal, the signal on port #1 is allowed through unaltered. When port #2 and #3 do receive a signal, the XOR gate shuts down.
Actualy those were the simplest words that can make more sense to me. lol
Like a chip relay with inverted activation input then. Yep saw it in practice and got it.

Thanks again for your time. ; )
2012-03-12 17:20:00

Author:
zupaton
Posts: 167


Actualy those were the simplest words that can make more sense to me. lol
Like a chip relay with inverted activation input then. Yep saw it in practice and got it.

An alternative would be an inverted activation signal powering a chip. The analog signal streams through a node on that chip. This is a setup that is easier to understand for most creators, but it comes at the cost, I think, of a 1 frame delay.
2012-03-12 17:43:00

Author:
Antikris
Posts: 1340


If you run a -100 signal through an AND gate with a positive signal in the other input, the result will be positive only if the incoming signal is 100. Somehow the game gives priority to positive. Aya said that the direction is the product of the digital directions. I have +100(+1) AND -100(-1) = +100(+1). Seems like it isn't the product of digital, and that rtm was right. This tool was shown to me by evret - very good idea, no idea if he built it himself but so great. This way you can test if an analogue signal is equal to 100 or to 0 (invert the signal before). You just have to place a splitter to test if the signal is positive. evret used it to make a signal probe instead of using a sequencer. This way, there's no delay. Then he made me a round up tool using the same logic. It is instantaneous - it doesn't take a single frame to work since it uses and gates, or gates, combiners and splitters.2012-03-12 18:05:00

Author:
Unknown User


I have +100(+1) AND -100(-1) = +100(+1). Seems like it isn't the product of digital, and that rtm was right.

Strange, cos I get this...

http://i4.lbp.me/img/ft/fe4a9290da55e46556f908fdf2bd047eb354621c.png

...and I rechecked the output with a direction splitter to make sure there probe wasn't lying.



evret used it to make a signal probe instead of using a sequencer.

I'm not sure I get this. Do you simply mean a signal probe which avoids the sequencer by using the "Dimmer" input action on the hologram (or sticker panel), or some other implementation of a generic ADC?
2012-03-12 19:24:00

Author:
Aya042
Posts: 2870


I'm not sure I get this. Do you simply mean a signal probe which avoids the sequencer by using the "Dimmer" input action on the hologram (or sticker panel), or some other implementation of a generic ADC?

yes, i use the dimmer input. but i use OR gate priority, not AND gate priority.
OR gates give sign priority to the input closest to top if 2 inputs are the same strength, i dont think the same is true for AND gates though
the setup in the following picture will output +100 when the analog input is not 0 (battery is set to -100)
http://i1.lbp.me/img/ft/ce18be602edf68a1a41ee9c174aa3e866997fbd3.jpg
2012-03-12 20:50:00

Author:
evret
Posts: 612


the setup in the following picture will output +100 when the analog input is not 0 (battery is set to -100)

That is smart. And fast.
2012-03-12 22:02:00

Author:
Antikris
Posts: 1340


OR gates give sign priority to the input closest to top if 2 inputs are the same strength...

Weird. I'd never noticed that before.



...i dont think the same is true for AND gates though

Yeah. I'd done fairly extensive testing of AND gates, and as far as I could tell, they were completely symmetrical.



http://i1.lbp.me/img/ft/ce18be602edf68a1a41ee9c174aa3e866997fbd3.jpg

Ah. Looks like the same 'trick' used in some of these gizmos (http://lbp.me/v/zjrzp3) - I'll have to take another look. Still, I've never been keen on completely avoiding ADC, otherwise you lose the ability to use things like the selector, but I s'pose this sort of thing still has quite a few applications, like the dimmer-based logic probe.



That is smart. And fast.

You could alternatively do it like this...

http://i9.lbp.me/img/ft/04953ef8ef34a65e765c7b739c3ecf5f2b8b8702.png

...which is also zero-latency, and has a similar thermo cost, but additionally gives you the digital 1 you might need to influence a selector. The drawback is that you need at least one sackbot in the level for it to work, but that might be preferable in some cases.
2012-03-12 23:06:00

Author:
Aya042
Posts: 2870


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.