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

Remembering Dead Enemies EASILY (kind of)

Archive: 2 posts


HELLO AND WELCOME! You will learn how to keep those dang minions IN THE GROUND when you replay your level

Now when you attempt this, on paper it sounds easy, then you realize

"OH DANG, I need to wire each one individually, this is kind of messed up, THERE HAS GOT TO AN EASIER WAY"
*cue infomercial, and 90's extreme infomercial music*

WELL NOW YOU CAN (with a little wiring trickery)

So you all know what compression is right? hmm, you DONT D:
well, its basically, you take accuracy, and turn it into lots of on and off signals
thanks to seku, here you are! (http://www.lbpcentral.com/forums/entry.php?10735-Memorizer-Efficiency-Binary-Data-Compression)

Here we will do something like that

So, first thing you have to do is make a system that multiplies previous largest value by 2 so that you can establish a form of compression for later
Do this with testing last % from a tag and multiplying it by 2 (just make sure to have a base value like 1, somewhere so that its not just 0*2, 0*2, 0*2 (this method was made clear to me by seku, cause hes just awesome at math, lbp, and life, so check out his blog full of amazing things like this function here)

Hopefully what this will do is be able to establish binary amounts so that we can re-compare later and figure out which enemies are missing

of course this means you are limited due to 23 bits of accuracy in mantissa, so you will have to change out the tag in the enemy every 23 enemies

YAY WE'RE DONE, no, not really, you see, what if an enemy can respawn.... that brings a lot more problems to the table.. like it will keep multiplying by 2, BUT THE LIMIT IS REACHED AND THE SMALLEST % WILL BECOME IRRELEVENT IN ACCURACY, geez, so what do we do now?

Well, you apply a sensor that uses the same counting technique as the previous enemies, but this time, your enemy is the EMMITER!!!!, because why would you want to verify an enemy dying if it can respawn, UNLESS IT HAS SET LIVES

So you just put a pulse to make sure that the emmiter loses lives, instead of the enemies.

"Wait, amiel445566, what the heck are you saying, I understood NONE OF THAT"

OK time to get all mathy in here

so, when you have 5 things, lets call them fred

when you have 5 freds and you kill fred 1, 3 and 4, you need a way to catalog that with one number, so what you do is you use binary to ensure that if you are missing one binary, you can unravel the whole value and find out

EXAMPLE
fred(1) = 1
fred(2) = 2
fred(3) = 4
fred(4) = 8
fred(5) = 16

so we offed 1, 3 and 4, so the last remaining are 2, and 5. Their values together are 18

Now if we check backwards

IS 18 BIGGER THAN OR EQUAL TO 16, yep so you subtract 16 from 18, and keep repeating down the line till you get 0

you will find out that you are left with 2 after, and 2 turns on

if you go in reverse, you can find which ones died in the same way

"poor fred, it's ok, it's all for science"

so you just apply math checks to each enemy and you make them check if they died previously

"STILL GIBBERISH AMIEL, YOU MAKE NO SENSE... EVER!'

gahhhh, ok so in binary, each value can only be represented by one setting per digit, no other way to represent a number, so what we do is, instead of digits, we have fred, and we count the freds, and see which ones died

so lets say by default you have 00000, all alive, but OH NO 2 and 5, dont walk there BOOM 01001, then you have a unique number you can check with checks, and you can make sure there are no fred zombies when you replay the level

If you aren't sure how to keep that fred from coming back, please post any questions you have of this tutorial, I hope I helped you all understand how to modulate a trans-level death sensor!
2014-09-24 05:14:00

Author:
amiel445566
Posts: 664


Hmm...interesting. I've got some hyper-realistic action games cooking in the back of my head.2014-09-28 17:16:00

Author:
ShadowArcticWolf
Posts: 131


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.