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

Score giver and latency trouble

Archive: 3 posts


I'm working on a vs. level where a player must score two consecutive hits with a melee weapon on another player to achieve a kill. One hit will earn the player 10 points and that's working fine... mostly. A second hit within the allotted time frame will kill the other player and earn the killer 50 points. That part isn't working consistently.

The way I'm doing this is with a timer for a health gauge: a hit will fill it about 3/4 full (so it has to drain to less than 1/4 before the player regains his health) or a sustained hit will fill the gauge after around 3/4 of a second or so. The 50 point score giver is on a microchip that gets enabled when the timer is full. Unfortunately, there's a bit of latency between the hit and the microchip turning on due to using a timer for the health. The 50 points are rarely awarded, and it seems it only happens with a good solid hit, so I'm guessing that the signal has already ceased to the point giver before the timer fills and enables the microchip (we're talking a delay of probably 1/30 of a second but it's enough to mess it up).

Is there a better way to do this? There needs to be a connection from the hit detector logic (impact sensor) to the score giver so that the points are awarded to the right player, but it can't be a straight connection because the points should only be awarded on the second hit. I could set it so that any time the timer is even a little full, the microchip with the scoregiver is on, but there's room for error there since I'm not using precise math on the timer or the pulses sent to it, meaning that it would be possible to get the 50 points without actually getting a kill (like if the timer were 10% full or something). I really want the scoregiver to be triggered on death but I can't seem to get around the latency issue without rigging some sort of complicated signal storage device which seems like overkill for this situation.

On another note, sometimes the score givers just don't seem to work at all. I'm not sure what's causing it, but when I turned on a second controller, they started working. Pretty sure it's a separate issue, but it's another case of those score givers giving me trouble. I thought I knew the ins and outs of score givers, but there seems to be something about them I don't get.
2013-03-31 02:42:00

Author:
Sehven
Posts: 2188


instead of using a timer for health, you could use a counter set to 2, then have a timer that resets it if another hit is not registered within a certain time limit.
also there is 1 frame of latency when using the "activate microchip" input of microchips, so it's best to avoid using it, you can replace it with either an AND gate (player id must be going to the top most port) or a 3 port XOR gate

EDIT: did this on vita but works the same on lbp2.
top one is counter set to 2, bottom is timer with default settings and both target time and current time set to the time u want the second hit to be within for the kill. timer is reset with the first hit and will clear the counter if a second hit isnt quick enough.
http://if.api.vita.lbp.me/img/ft/9dff44402db60f7aa7ef42c201c93bc37bb25a6b.jpg
2013-03-31 05:32:00

Author:
evret
Posts: 612


Thanks so much Evret. I guess I got kind of hung up on the way I was doing it and couldn't see any other way, but it looks like your method will solve most of my problems and I'm pretty sure I can fix the other score giver problem by simply creating separate score givers for each attacking player instead of hooking them all through an OR gate (which I also thought of from looking at the pic you posted). I'll start from scratch on the health system and see how it works, but I'm pretty confident your solution will be ideal.

[edit] Works great! Thanks again!
2013-03-31 08:28: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.