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

Rolling Dice.

Archive: 2 posts


So I just finished up some dice rolling logic. It rolls two six-sided dice, and interprets the result. What I have is accurate, but I'm wondering if there's a more efficient way.

I have both dice set up using teal tags, labeled 1 through 6, and only the last one to be activated by the randomizer is used, enabling the appropriate tag. On the reader chip, I'm using tag sensors, one set that requires 2, for when you roll doubles, and one set that just needs one. And then there's a bunch of AND gate, and some OR gates. The AND gates are basically saying "If one die is 2, and the other is 5, then the total is 7". The OR gates have their inputs as the AND gates from every possible way to get a particular outcome, and the output to some sticker panel. When rolling doubles, the Requires 2 tag sensors go directly into the proper OR gate.

It works, but I want to know if there's a better way, especially since I was hoping to be able to expand this for any number of dice. Hopefully I explained things well enough.
2012-03-23 09:07:00

Author:
SuddenEnigma
Posts: 70


I have helped a friend with a blackjack setup a while ago, with cards of different values, using analog signal addition instead of his initial idea of writing out all possible combinations. I think that goes perfectly for dice as well. I'd also make the generation+calculation versus the presentation two different things. You can use tags alright to tell the die objects which side to show when finished 'rolling'; a tag for die #1 and another for #2.

I'd use two separate but nearly identical schemes of logic (one for each die) centered around a randomizer that picks one of 6 AND gates; each AND gate has a different battery wired to it as well containing an analog value ranging from 1% to 6%; you wire all AND gates to an OR gate. So you end up with analog values from two OR gates that you have to add up; CompherMC wrote a tutorial on that (if you are not familiar with the method, it is not hard) and the Creator Toolkit also contains math logic. From that you can derive the total value of the dice.

You can wire the results from each OR gate to a tag "Dice1" and "Dice2". Each dice can pick up this signal through a tag sensor set to Signal Strength; wire it to a positional sequencer and put batteries on its canvas. Or, use 6 separate tags for each die instead that you have wired up from their respective AND gate and use separate tag sensors on each die set to Closeness.
2012-03-23 13:19:00

Author:
Antikris
Posts: 1340


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.