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

Relative Damage Accumulation???

Archive: 19 posts


I'm currently working on a 4-player cooperative top down rpg in the vein of Diablo. It features four distinct character classes (Warrior, Ranger, Paladin, and Wizard) all with their own unique powers and abilities. So far, everything is going great as far as character models, animations, environments, etc. However, I have run into a rather puzzling conundrum.

Allow me to explain...

Let's say an enemy orc has 20 HP. So naturally I would put a counter on him, set it to 20, and then have it decrement every time he is attacked. Now this works fine for the wizard, cause his weaksauce mel?e attack only does 1 damage. However, I run into problems with someone like the beefy warrior, who's mel?e attack does 5 damage.

So my question is, how can I make 1 swing = 5 damage? Or, more specifically, how do I make a single input decrement a counter by 5 instead of one?

I originally thought to use separate counters on a single enemy, and scale them according to the damage they were receiving (ie the wizard specific counter would be 20, but the warrior counter would only be set to 4). But I would like the damage to be relative but accumulative at the same time, where 1 warrior hit + 1 wizard hit would equal 6 ticks on the counter. I've been racking my brain for quite some time now, but I am no means a logic guru, so now I am turning the problem over to the greater lbp community. Any takers?
2011-02-11 03:53:00

Author:
bloomchild
Posts: 74


Depends on how you are registering hits. But I will go with an assumption of an impact sensor with a a tag on it.

Each of the melee attacks would get its own unique tag and logic on your chip for the target (the orc, in this case). If the registered hit is to decrement by 5 (for instance), send the signal to a resettable perm switch (a counter set to 1) and that output to a pulser (a timer set to 0.1 with it's output also routed back into its own reset). The output of the pulser goes to decrementing the actual enemy hit counter (see note below on this) as well as to a counter set to Max=5. This counter's output needs to reset everything, so it will be routed back into itself to reset as well as back to the original resettable perm switch.

Now the output (from the pulser) needs to be routed into an XOR gate with all the other melee attack outputs (other pulsers) before actually triggering the decrementor.

Simultaneous hits may (and likely will) get overlapped with this set-up, and any overflow logic would get complex, but I'd be willing to give it a go if you really want it.

Also... someone else may have a much more elegant solution... this is just how I'd do it if it were me.
2011-02-11 04:57:00

Author:
v0rtex
Posts: 1878


@ v0rtex - Ha! Sounds brilliant! And also complex

But I will give it a go, and see if I can wrap my meager intellect around this and prototype it. Thanks for your input
2011-02-11 05:06:00

Author:
bloomchild
Posts: 74


You can also try using a timer with speed scale input, and depending on which impact is received, pulse a battery once. (putting it on a microchip and activating the chip). Make sure it's a negative percent to take away from the timer, and adjust the % of the battery and speed of the timer to balance damage to your tastes.

You could also be able to get a faster pulse than using a 0.1 timer using XOR gates that plug into themselves and increment a counter that represents N pulses.
2011-02-11 13:45:00

Author:
Foofles
Posts: 2278


O.o that sounds simple! I guess I need to mess around with batteries more. I almost never use them in my logic.2011-02-11 15:38:00

Author:
bloomchild
Posts: 74


You can also try using a timer with speed scale input, and depending on which impact is received, pulse a battery once. (putting it on a microchip and activating the chip). Make sure it's a negative percent to take away from the timer, and adjust the % of the battery and speed of the timer to balance damage to your tastes.

You could also be able to get a faster pulse than using a 0.1 timer using XOR gates that plug into themselves and increment a counter that represents N pulses.

The battery/timer method sounds nice I'll experiment with this and maybe redesign some parts of my enemy logic.
2011-02-11 17:21:00

Author:
Unknown User


i made a pretty quick acting counter system using a similar pulse method.
i have a two channel selector.
my input chooses channel one that runs to an AND gate that runs into a NOT gate and then back into itself and also into a counter and the output.
the counter resets itself and switched the selector to channel two.
using this method, when the trigger occurs it pulses the counter up to full and triggers the output that number of times and then stops...

This might be exactly what was talked about up there but i only 1/2 understood all of that lol.
Either way it makes for some quick and responsive incremental pulsing.
2011-02-11 18:34:00

Author:
Deftmute
Posts: 730


Have 1 counter to acumulate the damage. Thats all you need. The imprtant thing to have is something that triggers different amounts to the counter depending on different inputs.

Theres a really simple way of doing this. You need to make a little bit of logic that repeats a single input aset number of times, then have different sensors linked to the inital input of each repeat cycle set to cycle the amount of damage you want to set for that attack. Have a tag emitted when a specific attack is done that triggers the coresponding repeat cycle that adds 'x' count to the enemies HP counter.

To make the repeating cycle you will need 2 counters and a timer. Like so:

http://i5.lbp.me/img/ft/3255a2356820524b4f6d86ff195005b23fdd1f93.jpg

The very far left is a counter set to 1, the input of this would be a sensor waiting for a tag to appear when an attack is done.

The 1 shot counter is linked into a timer set to 0.1, this is the 'repeater'. The output of the timer links out of the chip, input this into the enemies HP counter in your logic network. The output of the timer is also feeding into a second counter. the number this counter is set to is how many times the output will repeat.

Once the bottom right counter reaches its last count, it sends input into the first counters reset which stops the input to the circuit ending the repetition cycle. It also resets itself setting the whole network back into an initial state ready for the next input.

To create what you want to, you will need 1 of these for each type of attack. Have the input for each repetition cycle a sensor set to trigger when a certain tag is emitted. (You could have an AND gate input, linked with the tag sensor AND an impact sensor, so the actual attack has to hit the enemy, during which time the characters logic has emited the correct tag for the second input on the and gate to trigger, of course though, i'm digressing)

Have the output of each repetition cycle system linked through an OR gate into the enemies HP counter. This way you can have the wizards melee attack only deal 2 damage (repeat counter set to 2 in repeat cycle), while the mighty warriors melee attack deals 5 damage (repeat counter set to output 5 times). Each attack (specific count) triggering from a seperate tag emitted when the actual attack is triggered by the correct character, all linked neatly up through a simple OR gate into 1 basic counter for the enemy HP.

Doing it this way you can customize how each attack effects different enemies by simply altering the repetition count for each repetition cycle linked to a specific tag (attack) for different enemies.

hope this helped.
2011-02-11 19:52:00

Author:
Epicurean Dreamer
Posts: 224


I don't use a counter for my hp bar. Instead i use a selector. this way i can use a directional combiner (and a couple counters to act as stop gates) to cycle the selector back and forth allowing me to not only have incremental damage but healing as well.2011-02-11 20:40:00

Author:
Deftmute
Posts: 730


@ Epicurian Dreamer - how long does that logic take to complete a full cycle for a high damage attack (like the bottom right counter set to 10 or more?)

@ Deftmute - your method intrigues me but I cant visualize what you said. Can you post a pic?
2011-02-11 21:14:00

Author:
bloomchild
Posts: 74


I'll see what i can put together when i get home this evening. I'll post a pic of my selector set up too in case your interested.2011-02-11 22:13:00

Author:
Deftmute
Posts: 730


@ Epicurian Dreamer - how long does that logic take to complete a full cycle for a high damage attack (like the bottom right counter set to 10 or more?)


As the output is a .1 second pulse, a 10 hit count would take 1 second [.1*10] yyh latency would be an issue in real time, for some reason i presumed the fighting would be turn based....

An instant count dependent hit system would take a bit more work. Considering a selector is used to switch health states, possibly some kind of initial selector before the HP selector in the logic would work. Where each input would correspond to a number of hits, 1st gate 1 hit, 5th gate 5 hits e.t.c.. They could output instantly into the counters inputting into either side of the drection combiner going into the cycle input into the main HP selector.

But that would still incure latency from the counters going into the direction combiner.... hmmmm.

Deftmute, could you explain a little more about how your HP logic works?

Are you needing an instant number dependent hit count on the selector?
2011-02-12 00:15:00

Author:
Epicurean Dreamer
Posts: 224


Deftmute, could you explain a little more about how your HP logic works?

Sounds like the same idea, but cycling a selector rather than a counter. Both solutions will require two frames per HP, although if you're dealing with relatively small numbers, this may not be a problem.

The one I built uses an 8-bit register and an 8-bit adder in a feedback configuration, and allows you to change the HP value by any amount in a single frame - neat thing about that is that it's capable of being updated at 15Hz, which is as fast as any sensor would be capable of registering a hit.
2011-02-12 01:20:00

Author:
Aya042
Posts: 2870


ok i was able to get some screens.
I'm not the best at this so dont be surprised if your able to find improvements to be made.

http://www.lbpcentral.com/forums/attachment.php?attachmentid=30486

This is my main selector board. Selector is hooked to a bunch of inverted OR gates (incremented from (2-11) and a single not gate.
Each output goes to a bar of my holo health bar.
The last channel will also be hooked to a destroyer but i havent done that yet.

http://www.lbpcentral.com/forums/attachment.php?attachmentid=30484

The is the selector cycle control.input into the top AND gate increment up and the lower one increments down.
Counters prevent the selector from looping.
The tag sensor just pick up radio signal from my sackbot to register impact, sine all this logic is attached to a separate piece of holo.
the chips there are in the next picture.

http://www.lbpcentral.com/forums/attachment.php?attachmentid=30485

This is the incremental pulser that i use. its pretty fast, but someone else will have to tell you how fast cuz i dont know those kinds of details.
i know it takes less than a second to count off ten hits.

anyways, if aya's does all of it instantly, thats the better system.
2011-02-12 15:48:00

Author:
Deftmute
Posts: 730


Thanks for all your ideas, guys. I'm still toying with a selector based system. It's not working QUITE how I want it to, but I feel I am getting closer to a solution.2011-02-12 23:56:00

Author:
bloomchild
Posts: 74


I need a much more in depth look at that selector logic. Since I'm working on my own HP logic that uses selectors.2011-02-22 09:32:00

Author:
Firemac
Posts: 13


I'd stick with timers set to speed scale using pulses (100% battery at one pulse = 1/3 of 0.1 seconds). Combiners take all damage into a single signal, which increases (or decreases) timer. Healing could then do the opposite.

The selector method looks interesting, but combiners are easy to use. Another explanation of the selector may help.
Here's some ideas:
Could convert health bar into actual numbers using a sequencer to set position.
Also, damage 'numbers' could be measured by putting combiner through a sequencer. Sequencer has logic to display certain values based on position.
2011-02-22 09:59:00

Author:
SSTAGG1
Posts: 1136


This might be a simpler and inferior method compared to others but I would use multiple impact switches set to detect damage tags linked to a corresponding timer for each of them that then increments the health counter. Each attack used would have tags on them like "damage1", "damage2", etc. When the enemy is impacted with these attacks only the impact switches which correspond with these tags would activate. Each timer linked to its impact switch would have a 0.1 difference in time with each other to prevent them from activating at the same time, which would only increment one damage.

So a weak 1 damage melee attack (only "damage1" tag) would only trip off a single damage switch, while a strong 5 damage melee attack would trip off five damage switches.

Of course there are flaws with this system. Latency would become a problem for high damaging attacks (there must be a 0.5 delay between 5 damage attacks) and attacks that occur at the same time won't add up their damage. If a 1 damage attack and a 5 damage attack hit at the same time the damage incurred won't be 6, but 5.
2011-02-23 04:55:00

Author:
Unknown User


I'll post a pic of the speed scale timer damage system tomorrow. It has no (or very few) latency issues, as damage is done all at once to the system. Batteries (or other analog output devices) are used to adjust the strength of the signal, while an impact or tag sensor (or something else) sets off the pulse for the damage.

It uses some fairly complex logic concepts, like a 100% pulse increments the timer by 1/3 of 0.1 seconds. From this, you can realize that 0.1 seconds could mean 30 (or 300) health, and that 100% = 10 (or 100) damage. Thus, if you want 5 (or 50) damage, cut the battery strength by half and use 50%. For 4 (or 40), use 40%, etc...

This allows a great deal of precision in how much damage an attack does. Also, by converting the analog signal using a sequencer, you can display the damage values using some display logic (it's been made by people already), or even using an analog signal display system like this (https://lbpcentral.lbp-hub.com/index.php?t=48523-Analog-Signal-Display&p=780750#post780750), which is very precise in how much damage is being done (would require some modification to retain analog display value for a couple seconds).

A counter based system is okay, but IMO, speed scale timers are much, much better at adjusting damages.

Using combiners, you can set whether or not signals increment or decrement the timer, and you could combine all the damage done (up to 100), or delay signals to retain each individual strength, so that multiple 'damages' at the same time work correctly.

Read this (https://lbpcentral.lbp-hub.com/index.php?t=44386-HOW-TO-Convert-Timer-into-Health-Bar) if you really want to use a damage system for your level.
2011-02-23 05:55:00

Author:
SSTAGG1
Posts: 1136


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.