#1
How to: Multi-Pulsers and Pulse detection?
Archive: 22 posts
So, as most of you shurely know a Pulser is a Counter set to maximum 1 with it's own output wired back to it's reset. 1. Multipulsers? Now when I want to send more than one pulse in a row, how to accieve that? I shurely can use a method with a 0.1 Timer that sends a signal to the pulser, which creates a pulse then, but that 0.1s delay totally destroys the meaning of the Pulser itself. The fastest method I can think of is putting 3 batteries on a 0.1 sequencer and OR the outputs. This lets the sequencer send 3 pulses in 0.1s, but when I need like 20 pulses I have to create a appropriate complex sequencer with (and thats even worse) a OR with all 20 inputs wired in. Any methods usign a counter did fail for me. 2. Pulse detection? This question reffers to this thread (https://lbpcentral.lbp-hub.com/index.php?t=44386-HOW-TO-Convert-Timer-into-Health-Bar) , reading it might help you understand what my problem is. I am openeing a new Thread here sicne I fear the people willingly to help, rather check the [LBP2] Help! section than the [LBP2] Tutorials one ![]() When I AND a Pulse with a percentual signal like a batery set to 50% or a half filled counter I get some kind of "reduced Pulse". If i wire that pulse into ANY other logical device but a Timer set to 0.1 and "speed" as input action it will not react at all. Now for my Health bar I got 12 different pulses of different strengh, but I want them ALL to do one same thing, change the sackbots emotion additionaly to reducing the health dependign on signal strenght. My current solution is to OR all 12 inputs togeter before they go into the pulser. This means additionaly to 12 differnetly strong Pulses in a OR gate I also got another 12 slot or gate that receives the signal bevore it gets "pulsed". IfI could somehow grab the singnal after it got "pulsed" I could spare that second OR. Illustration of my situation: http://i7.lbp.me/img/ft/637c1fe24cf7603831abd614adf7b59afb3a8d9c.jpg The down left Chip is the second OR Someone must have encoutered this before me. I can barely continue my Project without a working Health system. Any help is much appreciated! Regards 1st of The5 | 2011-02-09 15:38:00 Author: The5 ![]() Posts: 51 |
Multiple pulses (sending an ON signal for a certain number of ticks repeatedly) can be achieved using a selector. You can loop any pattern by using just one selector switch. Let's say I want to send two ON's then an OFF and repeat. Drop a selector into a microchip and set the selector to have three ports. Wire your input to the second port. Wire the output of the second port to the input of the third port, then wire the output of the third port to the first port. Now wire the outputs from the second and third ports through an OR gate to your output. It works like this (just so you know the timing of it). On the first clock cycle, the second port is activated and your OR gate is fed a pulse. On the second clock cycle, the third port is activated and your OR gate is fed a pulse On the third clock cycle, the first port is activated and you get no pulse. Now that it's done, it starts all over. So your output is 110110110110110..... Then you may ask so how do I just do the pattern once? Well, you'll need to create a single pulse generator to feed your pattern generator selector. That's a whole different creature but still uses selectors. So why do I use selectors? Because they have no initial latency. | 2011-02-09 16:11:00 Author: Shanghaidilly ![]() Posts: 153 |
A more effective method of creating a pulsar that emits a set number of pulses is: Create a counter With target value of however many pulses you want, reset when full set to NO, and output set to inverted wire the output of the counter to a 2 slot AND gate Wire the output of the AND gate to a NOT gate Wire the output of the NOT gate to both the AND gate, and the 'increment' of the counter Finally, wire the 'pulsar activation sensor' to the 'reset' of the counter. This method doesnt allow percent values, however it is much faster at pulsing Be aware that upon completion of the set number of pulses, the signal will remain on, if that is undesirable, just stick another NOT gate on the final output. | 2011-02-09 16:16:00 Author: Ticklemeemo101 ![]() Posts: 22 |
Thanks guys! @ Shanghaidilly Your method seems to work with Percentages. But when activating with a collision detector. the input remains for some time. When I tried triggering 3 Pulses, it gave me 13 due to the contact beeing for more than one pulse. However, putting a simple one pulse Pulser infront of the input solved that problem ![]() The only drawback I see is when I want more than 10 Pulses, the cosntruction gets quite big. @ Ticklemeemo101 This method would certainly be perfect, but it does not support percentages. Unless I want to change to a counter based health system this can not help me in this Situation. I am currently trying to work on the concept you suggested maybe I can get it to accept Percentages. Aggain, big thanks to you two! Hope more people can help me, especialy with my second question ![]() EDIT: @ Ticklemeemo101 I wired a Pulser behind the AND Gate and used that as the Output, it now accepts percentages! Another problem I have, is that the Multi-Pulser is triggeret one time instatly in play mode due to the inverted output of the counter. | 2011-02-09 17:16:00 Author: The5 ![]() Posts: 51 |
In order to prevent the initial firing of the pulsar, simply force it to activate in create mode, before connecting the final output. As I have found that modifying the 'current value' of a counter causes the reset function to set the value incorrectly | 2011-02-09 17:26:00 Author: Ticklemeemo101 ![]() Posts: 22 |
EDIT: I see, then this is the sollution I will go with. I will save the Multipulser as a Chip after it was activated once in play mode, I hope it will still remeber that it was already activated once when i place the saved chip. Gonna test this right now. Thanks aggain ![]() Reffer to this thread (https://lbpcentral.lbp-hub.com/index.php?t=44386-HOW-TO-Convert-Timer-into-Health-Bar). The output of a Pulser is taken AND with a percentual Signal, Like a battery set to 50%. The output of that is then sent into a Timer set to maximum 0.1s and "Speed" as input signal. When a Pulse with a 100% signal is sent out, the timer reduces about 33%. So a signal of 3% reduces the Timer about 1% hiving you a "healt bar" with 100 points. If you set the Timers time to 0.2s you get effectvely 200 health points. | 2011-02-09 17:27:00 Author: The5 ![]() Posts: 51 |
It seems like the best solution regarding your second problem is to have each percentual pulse ANDed with a binary signal. As 1 x y% = y%. thus the percent signal should remain intact at it's initial value. Then only the 1 OR gate feeding into your timer should be necessary. EDIT: also, regarding the 'percent input not firing anything apart from the timer set to speed' I believe that if an device is not set to receive an input as a percent: ie on/off or direction etc. It rounds all percentages down to a binary 0. Ie only 100% will trigger it | 2011-02-09 17:33:00 Author: Ticklemeemo101 ![]() Posts: 22 |
I tried this before. Pulse %Signal } AND Battery set to 100% = 1 / But that did not work. Since only a Timer set to Speed seems to react on percentual pulses, I think the sollution must be within them. EDIT: I just tried a sequencer with a battery. The sequencers input set to "position" and length per bar set to 0.1s. The battery is right at the beginning of the sequencer which is only 1 bar long. This seems to work but i need to do some in depth testing first. | 2011-02-09 17:40:00 Author: The5 ![]() Posts: 51 |
Well if the timer solution works then "don't fix what ain't broken" xD | 2011-02-09 17:44:00 Author: Ticklemeemo101 ![]() Posts: 22 |
I have not found a sollution with a timer yet. But see above, I found something with a sequencer ![]() I need to try this with differently strong signals though. | 2011-02-09 17:50:00 Author: The5 ![]() Posts: 51 |
Thanks guys! @ Shanghaidilly The only drawback I see is when I want more than 10 Pulses, the cosntruction gets quite big. You can get around that. Put another OR gate at the end of the chip and feed the original OR gate into it. For the second connection to this new OR gate, create an input node and feed that into the OR gate. Now create a second output from port 1 on the selector. Don't forget that your primary input goes through your single pulse generator that should be on the chip as well that feeds the selector port 2. Now you can hook them up in series and get multiples of how many pulses are defined on the chip. To hook them up properly, hook the output from the last OR gate into the new input you created. Then hook the output from port 1 into the main input (the one that goes to your single pulse generator). You've just doubled the number of pulses. I have multi-pulser chips of 1-5, and then one that consists of two 5's (giving me a 10 pulser). I just use these in combination for whatever value I want. Oh, and it's easy to test these. Since 3 pulses equals a full .1 second timer, a single pulse will fill a .1 sec. timer to 1/3rd. A double will fill it to 2/3rds and so on. 30 pulses will fill a one second timer full. If you have a probe then you can check the value in the timer with the probe (I use Balorn's probe - Thanks Balorn!!) and just do the math remembering that timer's values are based on a percentage full. So a .1 sec. timer filled with one pulse will read 33 on the probe. | 2011-02-09 17:53:00 Author: Shanghaidilly ![]() Posts: 153 |
Well I wish you good luck with the sequencer solution. I'd quite like to know if it works for u tbh. | 2011-02-09 17:53:00 Author: Ticklemeemo101 ![]() Posts: 22 |
I have not found a sollution with a timer yet. But see above, I found something with a sequencer ![]() I need to try this with differently strong signals though. Watch out for sequencers though. From what Aya042 has told me, they introduce one frame of latency. | 2011-02-09 18:04:00 Author: Shanghaidilly ![]() Posts: 153 |
@ Shanghaidilly Right now I like the comftable method with the counter more (since it is working with percentages too now). Neverless, you method seems to be able to create diffent sequences of pulses with ease, I'll shure keep that in mind ![]() Thanks aggain @ Ticklemeemo101 Ok I think got a solid method that works and detects any pulse, no matter how fast they come. A sequencer set to "position" does not take "time per bar" or anything. So I just made it 1 Bar long and put a Batery on it that is aswell 1 bar long (right stick up). So now when a signal comes in, no matter what percentage it is, the sequencer will always place it's pivot somewhere on the battery. The output ofcouse is the batteries signal. EDIT: @ Shanghaidilly I wil lhave a look at this delay aggain, thanks. EDIT2: Yes, it seems feeding multiple pulses directly afer each other does break the sequnecer trick. It wont even return one signal. Ok we need a new pulse detecion method :S | 2011-02-09 18:05:00 Author: The5 ![]() Posts: 51 |
I just realized that we might have different definitions of a pulse. One definition is that it consists of an ON followed by an OFF. This pair is a pulse. So two pulses would consist of the following pattern: 1010 with each number representing a clock tick. The other is a constant ON for the number of clock ticks desired thus a two clock tick would be 11 (it is implied that on the following clock tick a zero occurs as the generator would no longer provide an output.) What made me think of this is that Tickleme's solution provides the first definition since a counter's increment can only be triggered by providing an ON following an OFF (in other words a constant ON doesn't cause the counter to contantly count up). I believe it's the second definition you're after and so I agree that you should use Tickleme's solution. | 2011-02-09 18:53:00 Author: Shanghaidilly ![]() Posts: 153 |
2. Pulse detection? This question reffers to this thread (https://lbpcentral.lbp-hub.com/index.php?t=44386-HOW-TO-Convert-Timer-into-Health-Bar) , reading it might help you understand what my problem is. I am openeing a new Thread here sicne I fear the people willingly to help, rather check the [LBP2] Help! section than the [LBP2] Tutorials one ![]() When I AND a Pulse with a percentual signal like a batery set to 50% or a half filled counter I get some kind of "reduced Pulse". Remember that when dealing with analog signals (you call them percentages), an AND gate works like a min() function and an OR gate works like a max() function. So here's the problem - if your battery is at 50%, it provides a 50 analog signal (with a 1 digital component). If you AND that with an 80 analog signal, the result will be 50. When using analog signals, you have to be careful with your gates, especially if you want to retain the sign of the analog signal. I'm still not clear where the pulse generator comes in. What are you specifically using it for? | 2011-02-09 19:15:00 Author: Shanghaidilly ![]() Posts: 153 |
Dunno if this helps at all, but it seems that if a battery fills the entire sequencer time, then even after the sequencer finishes, the battery still outputs. As such, you would need a gap at the end of the sequencer to allow the battery to 'reset' | 2011-02-09 21:41:00 Author: Ticklemeemo101 ![]() Posts: 22 |
@ Shanghaidilly Thanks for the background info, good to have this in mind aggain. I've certainly learned this stuff at uni before, but yeh, I am a bit rusty ;p But actualy yes, I need a Pulse [1 0] signal To be precise I am shootign on a target with a Machinegun, this gun fires up to 3 rounds in 0.1s also there are up to four players shooting at that target. A impact results in a signal 100%, that is taken AND with a other signal of lower percentage. This way i can define different damages. Now even when i use two 100% signals and AND them. The maximum drain of Health is 33.3% (read the thread I liked to before). If i want a projectile to deal 50% damage to the health bar, i need more than one signal. If i would use a simple 0.1s Timer to create moresignals now, most of the incoming projectiles would be ignored due to the delay. Thats why I need multiple pulses (or just any kind of [ 1 0 ] Signal that is faster than 0.1 second). @Ticklemeemo101 Yeh, I made that observation in previous sequencers too. I would have left this gap at the end, but it seems with a stretched battery the problem won't occur. I could be mistaking on this though, gotta have a look at it. If it realy is like that a 100% signal would not be recognised. It places the pivot of the Sequencer at the verry end and there would be no battery to create a signal then. Maybe the problem did not occur to me (IIRC) because I use the "position" imput, not "play forward" or such. Normaly I never use this. EDIT: Just tested aggain, works fine. Just not for a whole bunch of pulses in a row. A randomiser that sends quick signals between 0.0s and 0.1s is always recognised correctly. | 2011-02-09 21:56:00 Author: The5 ![]() Posts: 51 |
@ Shanghaidilly To be precise I am shootign on a target with a Machinegun, this gun fires up to 3 rounds in 0.1s also there are up to four players shooting at that target. You have a problem here. Your machine gun is doing damage at clock speed (3 bullets per .1 sec which is .033 sec. per bullet = clock speed). But a pulse is two clock ticks (one for the ON and one for the OFF). That's .066 seconds per pulse. This means your damage would lag behind the actual hits or you would "miss" half of them. You'll probably need to slow the machine guns down to .066 sec per round. | 2011-02-09 22:52:00 Author: Shanghaidilly ![]() Posts: 153 |
I kinda skipped over what your problem is, but I do know that the fastest pulse possible in the game is a not gate wired to itself. Hope that helps somehow. ![]() | 2011-02-09 23:45:00 Author: Yofig ![]() Posts: 288 |
You have a problem here. Your machine gun is doing damage at clock speed (3 bullets per .1 sec which is .033 sec. per bullet = clock speed). But a pulse is two clock ticks (one for the ON and one for the OFF). That's .066 seconds per pulse. This means your damage would lag behind the actual hits or you would "miss" half of them. You'll probably need to slow the machine guns down to .066 sec per round. Yeh, I am aware that not all bullets can be recognised correctly (just the minigun fires that fast, all other weapons are at 1 shot per 0.1s and above) But even then multiple players can shoot at one target. A detection that is as fast as possible is necessary, but it does not need to be perfect. From testing so far the Sequencer works quite well. @Yofig Thats good to know for a rapid pulser, will keep it in mind ![]() | 2011-02-10 10:01:00 Author: The5 ![]() Posts: 51 |
Yeh, I am aware that not all bullets can be recognised correctly (just the minigun fires that fast, all other weapons are at 1 shot per 0.1s and above) But even then multiple players can shoot at one target. A detection that is as fast as possible is necessary, but it does not need to be perfect. From testing so far the Sequencer works quite well. Sounds like you're on the right track. Good luck with your project. | 2011-02-10 14:39:00 Author: Shanghaidilly ![]() Posts: 153 |
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.