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

Working with latency

Archive: 7 posts


This tutorial will give a brief explanation of what latency is, how to induce it, and how to avoid it

What is latency: Latency is when instead of being "instantaneous" (by that I mean it completes all operations in a logic function in one tick and outputs in the same tick) it takes two or more ticks for calculation, and display (or transfer of data in some way)

How to induce latency: There are several ways to induce latency, some with different purposes then others
Option 1) You can make the data enter into a loop for one loop cycle (like a microchip that has a wire that loops from the output back to the input to make a loop from the original input). The reason that this works is because it takes time for any logic to calculate in a loop, to avoid logic doing infinite calculations in one tick cycle, so it does one operation per tick in a logic piece, so you can utilize this with logic to extend delay in logic.

Option 2) You can use any logic that takes analogue values and can convert to a digital value
Like sequencers that detect a percent with it's positional settings (every time you detect a percent with a digital detector, a delay of one tick is induced). The reason this works is because it takes one tick in the coding to convert a logic value into another (strictly analogue, to digital), which means that any detector using sequencers will induce a one tick latency per calculation. The other way to induce latency with this option is to use tag sensors because they have to incorporate digital values as well, so detecting any tag will induce a one tick latency (I found this out when messing around with modularity in logic probes) so be careful when you use these things and need your logic to be latency specific.

How to avoid latency in logic:
Option 1) Use analogue values
When using analogue values, the whole conversion of digital values is skipped, so latency is avoided in calculation, but that also means that digital values will be ambiguous when using this method to calculate. How do you calculate in analogue values? Seku (http://www.lbpcentral.com/forums/member.php?23190-Seku) has a great tutorial on how to calculate with analogue values here (http://www.lbpcentral.com/forums/entry.php?10684-Zero-Latency-Logic)

Option 2) Just don't calculate (I know those two options don't sound great, but if used correctly you can achieve almost anything with no latency, or one tick latency for the logic in its whole, instead of "per calculation" situation)

Tip in avoiding latency: If you need a digital value, but don't want latency then what you could do is do the calculations in analogue, but display with an analogue to digital sensor, which will give one tick overall, instead of per calculation, and should be good for whatever uses you have (the latency will also be uniform when used this way)

Remember leave feedback on how I should improve these tutorials, and what I could add onto this post individually, thank you for reading, and feel free to ask any questions that you feel you need to ask about this tutorial, I will try my best to clear up/answer whatever you need
2014-04-13 21:47:00

Author:
amiel445566
Posts: 664


Hi amiel,

thanks a lot for your tutorial, I'm not so fit in logic and all the things you are describing above, nevertheless I have the feeling that I can imagine, a little bit at least, what you are talking about! To me it would be great, if you could add some examples to describe the practical importance! Or how I could use the effects in a level concretely. Your tutorial has a clear structure, but I personally would need some more information about the practical relevance.

Many greetings, Jürgen^^
2014-06-13 17:11:00

Author:
CuriousSack
Posts: 3981


Well, I can give you an example now, a signal probe, or currency system, just anything with a lot of linear calculations, because normally without non-latency calculation what you get is a one tick latency per calculation, which is usually negligable, but if you are doing a tick per digit in a probe, or doing constant checks with currency, the amounts can be astonishing (an example would be if you had a 15 digit probe, what you would get is a half a second waiting period till the digit at the end is actually accurate, not to mention calculation would look funky)

This stuff is just good for polishing systems with lots of checks *in a nutshell*
2014-06-14 04:23:00

Author:
amiel445566
Posts: 664


Tip in avoiding latency: If you need a digital value, but don't want latency then what you could do is do the calculations in analogue, but display with an analogue to digital sensor, which will give one tick overall, instead of per calculation, and should be good for whatever uses you have (the latency will also be uniform when used this way)


I'm a little confused by this. Could you elaborate on what scenarios this would apply to? I've found digital/binary to be MUCH faster in several applications. I built a binary setup for a banking system in a tower defense level I never finished that I have performing up to four calculations in one tick (calculating cash for multiple enemy destructions, purchases, and upgrades). It can actually handle many more, but that's all I need.

Granted, analog makes certain things easier to do, and often uses less thermo, but under what conditions does it have less latency?
2014-06-21 01:43:00

Author:
tdarb
Posts: 689


I'm a little confused by this. Could you elaborate on what scenarios this would apply to? I've found digital/binary to be MUCH faster in several applications.

Analogue or digital values by themselves have no latency, but conversion from analogue to digital values, for whatever reason induces latency (if you want an off wire to turn on if it has a percentage in it, then the output is going to carry a one tick of latency)

But digital values arent worse, just used in different occasions (and can still work without latency, but never in a loop due to recursion (http://en.wikipedia.org/wiki/Recursion#Recursion_in_computer_science))

Also you cant calculate multiple variable calculations with digital libraries as easily as you can with analogue values, in LBP at least (like health systems, or versatile algorithms)
2014-06-22 07:14:00

Author:
amiel445566
Posts: 664


I'm a little confused by this. Could you elaborate on what scenarios this would apply to? I've found digital/binary to be MUCH faster in several applications. I built a binary setup for a banking system in a tower defense level I never finished that I have performing up to four calculations in one tick (calculating cash for multiple enemy destructions, purchases, and upgrades). It can actually handle many more, but that's all I need.

Granted, analog makes certain things easier to do, and often uses less thermo, but under what conditions does it have less latency?


I have a level sacks off dance off, because of latency with very careful timing you will be able to get double points from an object before it destroys itself. learned it was latency after me and foofles went theu it with a comb. almost went into it to add latency points between the logiks to even things out, but didnt wanna bother cause it was very minute occurences and didnt break the game.
2014-06-23 18:35:00

Author:
L-I-M-I
Posts: 611


I think I see what you mean now. You're talking about adding digital on top of an analog system.


Also you cant calculate multiple variable calculations with digital libraries as easily as you can with analogue values, in LBP at least (like health systems, or versatile algorithms)

In the level I am working on now I have a digital system that is performing loads of calculations. I have one section that is performing 36 calculations simultaneously (30 external readings, 5 of which may be active at any given time). This happens within a tick or two, depending mostly on the sensors. That's just one of 20 or so systems of varying complexity in the level.

It's actually surprisingly versatile, and has very little latency, but yeah...have to be careful switching back and forth.



I have a level sacks off dance off, because of latency with very careful timing you will be able to get double points from an object before it destroys itself. learned it was latency after me and foofles went theu it with a comb. almost went into it to add latency points between the logiks to even things out, but didnt wanna bother cause it was very minute occurences and didnt break the game.

I know exactly what you mean. I spent hours last night chasing down a race condition in my level. Best I can figure, jumping between chips seems to add a tiny bit of latency. Both parts of a single AND gate were firing a tiny fraction of a second apart and not triggering the AND properly. If I placed everything on one chip it worked fine, but looked like hell.

I just didn't get why he was saying digital adds latency, but now I see that he was talking about adding it over an existing analog system. Makes sense in that context. I'm just so used to building with digital/binary values that I hadn't thought much about that.
2014-06-23 20:31:00

Author:
tdarb
Posts: 689


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.