BG1, PRELOAD BG2, PRELOAD

Results 1 to 15 of 15
  1. #1

    Default Zero Latency Ana.logue Logic Toolset



    Equals
    - Compares two analogue values, outputs 100% if they are the same, 0% otherwise
    - Works with signed values
    - Most likely won't work with super-normal signals
    - Zero latency, outputs the value in the same frame it was input, gives it greater applications when dealing with continuously changing values



    Equals with Tolerance
    - Works as equals but has 3 inputs - x, y and t
    - 3rd input controls tolerance for x and y to be considered "equal"
    - Symbolically, outputs 100% if |x-y|<=|t| and 0% otherwise
    - Works with signed values, though t is taken as modulus
    - Zero latency




    Less Than (Less Than or Equals To)
    - Compares 2 values x and y, outputs 100% if x - Works with signed values
    - Less Than is just a Less Than or Equals To with the inputs swapped and the output inverted, but I've made both chips for convenience
    - Zero latency



    Addition (Subtraction)
    - Adds (subtracts) two values x and y
    - Works with signed values
    - Results that overflow are truncated at -100%/100%
    - Thanks go out to rtm223, this is basically his implementation optimized
    - Zero latency



    Multiplication
    - Approximates multiplication of two values x and y, treating 100% as 1.0
    - Works with signed values
    - Accuracy is around 1%, for specific values it is slightly higher
    - Surprisingly low thermo (less than half a notch)
    - And yes, zero latency - the multiplication is calculated within the same frame that the input is.




  2. #2
    Patch of Cloth septamus112's Avatar
    Points: 11,956, Level: 33
    Level completed: 1%, Points required for next Level: 694
    Overall activity: 0%
    7 days registered 30 days registered Created Album pictures 100 Experience Points 250 Experience Points
    PSN
    septamus112
    Join Date
    Jun 2010
    Location
    Kansas City, MO, US
    Posts
    82

    Default

    the logic is very good it looks like, and i only skimmed the post, but what could this be used for

  3. #3

    Default

    Quote Originally Posted by septamus112 View Post
    the logic is very good it looks like, and i only skimmed the post, but what could this be used for
    All kinds of things, someone just asked "how can I add some kind of dead zone for the sixaxis" and the solution is quite simple when you have these tools:


    Generally people want to compare analogue signals all the time, like "I only want this to start spinning when the light is at 50% brightness" or "I want both the left stick AND the d-pad to control movement, how do I add their signals?" or "which counter is further along in terms of percentage complete?" These tools are actually more useful than some others like XOR because they're very hard to make simply and quickly (whereas XOR is simply made from other gates). Being zero latency means you don't have to worry about frame-delay caused by sequencers either. So you can know precisely if your timer has reached 50% yet or not. Now I'm not sure if multiplication has much use - but I'm sure there's one somewhere.

  4. #4
    Sack No. 10,000 Shadowriver's Avatar
    Points: 54,313, Level: 72
    Level completed: 18%, Points required for next Level: 1,237
    Overall activity: 0%
    7 days registered 30 days registered 100 Experience Points 250 Experience Points 500 Experience Points
    PSN
    ShadowriverUB
    Join Date
    May 2010
    Location
    Wrocław, Poland
    Posts
    4,985
    Blog Entries
    1

    Default

    Multiplication can be used for scaleing since it's inversion of divination, thru it might be too big for massive particle system or something, where thermo counts on lot of same objects
    Last edited by Shadowriver; 04-01-2011 at 02:34 AM.
    Tired of answering same questions from people.... answer them down on LBPWiki where everyone can see them!
    |LEVELS: TETRIS
    |OBJECTS: Numeral logic components
    |TUTORIALS: BCD calculator
    |Next project: Paaaaaaarrrrty!... in LBP2

  5. #5
    Can I haz bamboo? Ungreth's Avatar
    Points: 52,447, Level: 70
    Level completed: 93%, Points required for next Level: 103
    Overall activity: 0%
    7 days registered 5000 Experience Points 1000 Experience Points 500 Experience Points 250 Experience Points
    PSN
    Ungreth
    Join Date
    Apr 2009
    Location
    Shropshire, UK
    Posts
    2,112

    Default

    Ok, Thor...could you possibly make a list of the potential practical applications of this system in laymens terms, because although I'm sure it's all highly impressive, the description in the original post makes absolutely no sense to me whatsoever. I'm sure that guys like Aya, comph and rtm know exactly what you're talking about, but for people like me who don't speak geek, it might as well be posted in Japanese. The dead zone for six axis is a good start, but what else can this be used for?

  6. #6

    Default

    Quote Originally Posted by Ungreth View Post
    Ok, Thor...could you possibly make a list of the potential practical applications of this system in laymens terms, because although I'm sure it's all highly impressive, the description in the original post makes absolutely no sense to me whatsoever. I'm sure that guys like Aya, comph and rtm know exactly what you're talking about, but for people like me who don't speak geek, it might as well be posted in Japanese. The dead zone for six axis is a good start, but what else can this be used for?
    Hmm well here are some ideas off the top of my head:

    See who's winning
    Each time someone scores in a multiplayer game, they increment their own personal counter. OK so by looking at it, you can see that player 1 has scored 5/10 and player 2 has scored 7/10. But how can you light up a sign to show who is currently winning? Well you want to light up player 1's sign if player 2's score is less than player 1's score, and vice versa for player 2.

    Note: Lights must be set to "dimmer" mode

    Stepped brightness
    You want a light to get brighter over time, but you only want a fixed number of brightness levels. Here's an example for getting brighter when the timer reaches 50% and 100%.


    Convert a one-directional signal into a bi-directional signal
    I want an object to move left and right, according to a timer. The timer moves left and right (it is set to forwards/backwards and inverted, and connected to itself), but when I connect it to a mover on the object via "speed scale" it only moves in one direction.


    Stealth Detector
    Detect if the player moves the analogue stick too fast and sound an alarm if they do.


  7. #7
    Can I haz bamboo? Ungreth's Avatar
    Points: 52,447, Level: 70
    Level completed: 93%, Points required for next Level: 103
    Overall activity: 0%
    7 days registered 5000 Experience Points 1000 Experience Points 500 Experience Points 250 Experience Points
    PSN
    Ungreth
    Join Date
    Apr 2009
    Location
    Shropshire, UK
    Posts
    2,112

    Default

    Thanks Thor. That post made it so much clearer for me to understand the applications of your logic tool. It actually sounds like a pretty nifty piece of kit!

    I built a stealth detector system for Tenement, implemented in the room where you encounter the ghost with the box on her head. If you run through the room she attacks, but if you creep slowly then she won't detect your presence. I'm not sure how I did it because I take a trial and error approach to logic....ie: I blindly mess around with stuff until it does what I want it to do. I wonder if the logic I used there might actually have been similar to the analogue system showcased here.

    Anyway...good stuff. Very useful.

  8. #8

    Default

    I'm not going to have a chance to try this out for the next few days: would you mind giving an explanation of how the multiplication works? Like are you decoding the signal to binary and implementing multiplication with logic, or what?

  9. #9
    Tarsier Level Designer comphermc's Avatar
    Points: 80,225, Level: 88
    Level completed: 5%, Points required for next Level: 1,725
    Overall activity: 0%
    Recommendation Second Class 25000 Experience Points 10000 Experience Points 5000 Experience Points 1000 Experience Points
    PSN
    comphermc
    Join Date
    Jun 2009
    Location
    US
    Posts
    7,739
    Blog Entries
    5

    Default

    Hey, I just checked it out. Neat stuff. It's too bad your multiplication wasn't more accurate.

    Anyways, I noticed the lack of division in your toolset, which makes me sort of happy. I drove myself nuts over the past two days creating my own multiplication and division systems. They aren't without latency, but they work very well. I can do multiplication of any unsigned signals with two digits to perfect accuracy. I didn't bother with sign, but implementation would be easy. XOR anyone?

    At any rate, the reason that I even bothered with multiplication was because I came up with a solution to division. It's so simple it's not even fair (the X is my multiplication chip):



    Dividend is on top, divisor is on bottom. Currently it can only display answers less than or equal to 1.000 (by virtue of the signals that can go into my multiplication system). What happens is that the timer acts as a feedback loop. It's sort of a stupid system based on checking the timer's current state to see if it's correct answer. It multiplies the timer's signal value by the divisor and checks (using subtraction) against the dividend.

    If the result is too low, the timer counts up. If the result is too high, the timer counts down. Thus, it's a recursive system that takes a little but of time to find an equilibrium (3 seconds max).

    On the plus side, both it and my multiplication are dynamic, so it can be constantly working. In addition, they are both very low thermo. I hope I'm not the only one who is interested in this sort of thing...

    N.B. - interesting choice going with binary on the multiplication. I went a different route, and it's working well: place value. Multiplication by 10 is simple enough. Division by ten takes a little bit more work (hence the latency issues). I basically used the distributive property of multiplication in conjunction with multiplication as repeated addition to get it to work. I broke everything down into single digit multiplication (e.g. 6 x 7), and then interpreted the results, applied the correct place value, summed where necessary, and displayed the result. I'm proud of the result, even if it's not instantaneous.



    Edit: I'm sure I'll find a way to share my multiplication chip at some point.
    Last edited by comphermc; 04-09-2011 at 12:14 PM.
    Mm Picks: Roller INC 2 | Wizard: Chapter 1 | LittleBigPrius
    Levels: New! -The Button | The Fourth Wall | The Heist: Making a Withdrawal | Rubik's Tube
    Lbp.me profile: comphermc | LittleBigplanet 2 Create Tutorials: LBPlanetorials

  10. #10

    Default

    Quote Originally Posted by tetsujin View Post
    I'm not going to have a chance to try this out for the next few days: would you mind giving an explanation of how the multiplication works? Like are you decoding the signal to binary and implementing multiplication with logic, or what?
    Quote Originally Posted by comphermc View Post
    Hey, I just checked it out. Neat stuff. It's too bad your multiplication wasn't more accurate.

    N.B. - interesting choice going with binary on the multiplication. I went a different route, and it's working well: place value. Multiplication by 10 is simple enough. Division by ten takes a little bit more work (hence the latency issues). I basically used the distributive property of multiplication in conjunction with multiplication as repeated addition to get it to work. I broke everything down into single digit multiplication (e.g. 6 x 7), and then interpreted the results, applied the correct place value, summed where necessary, and displayed the result. I'm proud of the result, even if it's not instantaneous.

    Well I went for a binary multiplier because I was able to find optimized circuit diagrams online for such a thing. I think I found a good trade-off between thermo/accuracy but the real reason I went for 6-bit accuracy was because I could simply copy the circuit diagram for the "Dadda multiplier" that I found and it worked straight away (rather than having to follow the algorithm for constructing the circuit). So yes here's how it works entirely:

    First the two values are converted into 6-bit binary, multiplied bitwise and then combined with a dadda multiplier, and finally converted back into analogue. The dadda multiplier is a clever way of combining the 36 values you get from bitwise multiplication into the full multiplication by arranging adders in just the right way.

    I realised that it is simple to prove that the partial derivative of the output of any zero-latency microchip with respect to one of its inputs is a constant integer (or else is undefined). This is because you're effectively limited to using direction splitters, direction combiners and OR gates in series along with fixed constants (disregarding weird digital behaviour of other gates such as the AND gate, they can all be built from these 3 gates). This means you have to discretize your input space and give each section a constant integer partial derivative. In the case of multiplication, the partial derivative wrt one variable should be the other variable, meaning it's in the range 0-1. So effectively I just rounded the partial derivative to the nearest integer, meaning when one value is over 0.5, I add on a linear term from the other variable (it's actually the remainder from the analogue-to-binary conversion). This actually gives quite a bit of extra accuracy.

    Sign is handled separately and is put in at the end.

    At any rate, the reason that I even bothered with multiplication was because I came up with a solution to division. It's so simple it's not even fair (the X is my multiplication chip):

    Dividend is on top, divisor is on bottom. Currently it can only divide if the dividend is larger, and it only has two digits of accuracy (by virtue of the signals that can go into my multiplication system). What happens is that the timer acts as a feedback loop. It's sort of a stupid system based on checking the timer's current state to see if it's correct answer. It multiplies the timer's signal value by the divisor and checks (using subtraction) against the dividend.

    If the result is too low, the timer counts up. If the result is too high, the timer counts down. Thus, it's a recursive system that takes a little but of time to find an equilibrium (3 seconds max).

    On the plus side, both it and my multiplication are dynamic, so it can be constantly working. In addition, they are both very low thermo. I hope I'm not the only one who is interested in this sort of thing...
    Looks very good... I think you've beaten my attempt because mine suffered a bit from the limitations of the joystick rotator. Mine is probably lower thermo though owing to not having to use a multiplication chip. Your solution is very elegant actually. What's its behaviour when the result should be >1?

  11. #11
    Tarsier Level Designer comphermc's Avatar
    Points: 80,225, Level: 88
    Level completed: 5%, Points required for next Level: 1,725
    Overall activity: 0%
    Recommendation Second Class 25000 Experience Points 10000 Experience Points 5000 Experience Points 1000 Experience Points
    PSN
    comphermc
    Join Date
    Jun 2009
    Location
    US
    Posts
    7,739
    Blog Entries
    5

    Default

    Quote Originally Posted by thor View Post
    What's its behaviour when the result should be >1?
    Kerplosion.

    Nah, it just displays 1.000, currently. Since it checks using multiplication, it just starts counting up, and when it reaches 1.000 is can't count any higher (timer limitations). Admittedly division is very slow since when it gets close to the answer, the value of the subtractive difference that drives the timer gets small, and the increment speed drops significantly. There are theoretical ways of speeding up the calculation, which can be as simple as multiplying the subtraction result by 10 (or some other constant).

    Hell, I could make a system that is a bit more dynamic, but I'm not really sure at this point what would be effective and/or accurate.

    Lastly, I noticed last night that division is really only an approximation. It's not a bad approximation, but something like 2/10 will output .195x, which is close enough for me. Because of the recursive/feedback nature of the system, the last 1 or 2 digits flicker between values (and I was just using phorts 4-digit probe). My motivations for sorting out division is that a friend of mine is planning to make an RPG that makes use of a chance to hit formula. I don't recall what it was, but it uses both multiplication and division. Thus, an approximation is fine, since the player never actually sees the calculations.
    Mm Picks: Roller INC 2 | Wizard: Chapter 1 | LittleBigPrius
    Levels: New! -The Button | The Fourth Wall | The Heist: Making a Withdrawal | Rubik's Tube
    Lbp.me profile: comphermc | LittleBigplanet 2 Create Tutorials: LBPlanetorials

  12. #12

    Default

    I like the way you check if it's equal! It's kinda ingenious..

    I've modified your less-than-equal switch a bit.. Since I don't care about signed values for my project.

    (Please forgive my extremely quick sketch )

    Quote Originally Posted by comphermc View Post
    ... My motivations for sorting out division is that a friend of mine is planning to make an RPG that makes use of a chance to hit formula. I don't recall what it was, but it uses both multiplication and division. Thus, an approximation is fine, since the player never actually sees the calculations.
    Well nowadays, it only needs divison.. Though I might add an extra step to bring the player with the higher level a small advantage. And that requires multiplication with variables.
    The complete formula for "chance to hit" is: (ATT/(ATT + DEF)(2ALVL/(ALVL + DLVL)
    Which might bring some difficulties because your solution only divides with a smaller divisor than the divident.

    BTW: This is a quite known formula for "chance to hit" and I've only modified it slightly... I think it is the one that's used in Diablo II.

    Hmm, I might revisit "my" solution.. and make it faster, by putting in some optimization. Should be able to make it calculate with just a few frames..
    Last edited by Tamland; 04-11-2011 at 11:33 AM.

  13. #13
    TigerTechnic
    Guest

    Default

    For some reason, the equals chip wasn't working for me. I hooked up a 1% battery and a 2% battery and it said that they were equal.

  14. #14

    Default

    I am so very completely and utterly ****ing confused lol. Like, off the charts scale mind blown followed by wtf are all of you saying?...

    But awesome work, I think :P

    You just lost me from the start. I'll just stick with "ooh, cool pictures!" and then go cry about how hard I failed at programming.

  15. Thanks!


  16. #15

    Default

    This would help me so much with my level! Espcially with my factor system like happiness XD

    Also working on 2 levels - Citizens, a level where you can build your own city.
    And a co-op level set in The Factory of a Better Tommorow

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •