Home    LittleBigPlanet 1 - PSP - Tearaway -Run Sackboy Run    LittleBigPlanet 1    [LBP1] Help! [Archive]
#1

Randomizer help!

Archive: 45 posts


Okay, I've got a challenge for all you clever logic people!

Lets say I have a 4x4 grid of 16 lights. I need a randomiser that can turn on 3 random lights every 10 seconds, without turning the same light on twice in a row.

So, for example, for the first 10 seconds lights 4, 8 and 15 might be on. The next 10 seconds lights 16, 2 and 3 might be on (see what I did there? ). But the next time lights 2, 9 and 7 shouldn't happen, because obviously light 2 would be on twice in a row and so would have the appearance of staying on for 20 seconds, which isn't what I want.

To make things slightly more interesting, after a while I also need to be able to change it to just 2 lights at a time, and then eventually to just 1 light on at once.


Anyone got any ideas?!?
2010-07-19 22:21:00

Author:
Nuclearfish
Posts: 927


Game on!

*Racks brain*
2010-07-19 22:29:00

Author:
comphermc
Posts: 5338


Well I know how to start. Get ready because it's gonna take a lot of space.

- You need a triple OR switch and a randomizer.
- Place one OR switch for every light.
- Place 3 randomizers.
- Connect the first randomizer to every OR switch.
- Repeat the step above with the other 2 randomizers.
- In the end it will be:


http://www.lbpcentral.com/forums/attachment.php?attachmentid=19573


without turning the same light on twice in a row.


Now you got me... Also, if you do that, it may sometimes turn on 2 or only 1 light at a time.
2010-07-19 22:58:00

Author:
gdn001
Posts: 5891


@gdn, you've missed the "exactly three" outputs - yours will give up to three outputs active at any given time

does the time definitely stick at 10s? Nevermind, I've got a system now, it should do variable speed too
2010-07-19 23:08:00

Author:
rtm223
Posts: 6497


You can get 3 randomniziser to trigger 3 different emmiters emmiting a solid circle magnetic key at the same time. Perhaps store the commands for each in a switch that will trigger after every 10 seconds to make them go at the same time.

Have them fall into a wobbling pit (or some fan disk thing, whatever makes them roll in a random fashion) above the magnectic key switches where it could activate any of the 16 magnetic key switches to choose which light will come on.

Set the emmitters to only be able to emit two at once, so it can't roll into the same hole using the same light. To prevent the light from staying on, connect that switch to an emmiter to emit another magnetic key set to once only, and connect it to the lights (this is going to take alot of thermo, lol) and make it dissolve after 10 seconds.

And finally, make some logic to disable each of the 3 randomnizers one by one to your prefered time to make it go down to 2 lights at a time to 1. And viola!

Hope that made sense! I have it in my head, but I can't really explain it well. Perhaps that's why i find maths easy and languages hard.
2010-07-19 23:17:00

Author:
AgentBanana
Posts: 511


@gdn, you've missed the "exactly three" outputs - yours will give up to three outputs active at any given time

I'm aware of that:


Also, if you do that, it may sometimes turn on 2 or only 1 light at a time.

EDIT: only if we cramp three randomizers into one, so it won't select the same light two times. I have no idea on how to do that.
2010-07-19 23:19:00

Author:
gdn001
Posts: 5891


I've got a system too. I'm scared that rtm is gonna beat me. I think it's gonna work, I just have to wire it all up tediously.

Conclusion: I miss LBP2.


EDIT: only if we cramp three randomizers into one, so it won't select the same light two times. I have no idea on how to do that.

You've got the right idea, but the execution is a pain. I think I figured it out.
2010-07-19 23:39:00

Author:
comphermc
Posts: 5338


I have a really slick system all worked out, but I've got to add an extra stage into the randomiser to make it work, and I really can't be bothered. On the plus side, I can make all three lights come on instantaneously, with no delay between them. If comphy is doing what I think he is, then it's liable to have a brief (almost negligible) delay on Or maybe he isn't....2010-07-19 23:49:00

Author:
rtm223
Posts: 6497


Hey! You know the LBPC logic pack randomizer emmits mag keys in different positions in order to "randomize". So we could expand that and make it possible to emmit all the possible combinations of 3 mag keys . (instead of emmiting one mag key at once it emmits 3). It's still a pain, but it is something.2010-07-20 00:04:00

Author:
gdn001
Posts: 5891


Yeah, I dunno what you are referring to, rtm... but I'm taking the Logic Pack idea and beefing it up with steroids. I, too, have to go rework it all in order to make it actually work with lights, but I think it works.

I'll do it after dinner.
2010-07-20 00:06:00

Author:
comphermc
Posts: 5338


'It's the eye of the tiger, it's the thrill of the fight..'2010-07-20 00:13:00

Author:
AgentBanana
Posts: 511


I assumed you would be emitting a stack of three pieces of dissolve, rather than just one? It would take time to settle is the issue. Easily fixed with two randomisers working alternately. Edit, actually, it would take more than that.

I had a more unique system that really is quite interesting, but I've broken it, and at midnight, recapturing all of the objects is just not appealing
2010-07-20 00:14:00

Author:
rtm223
Posts: 6497


Yeah, I dunno what you are referring to, rtm... but I'm taking the Logic Pack idea and beefing it up with steroids. I, too, have to go rework it all in order to make it actually work with lights, but I think it works.

I'll do it after dinner.

Drug use is an automatic disqualification.
2010-07-20 00:14:00

Author:
Infernox
Posts: 93


That wasn't exactly what I was doing, I don't think, Rich... but you gave me an idea.

Based on your excitement, mine was probably going to be second best anyways... Thus, I'm going to go in a different direction. If I can get it to work, it will be wild.

My original plan was a hybrid of a randomizer and your Mutual Exclusion switch. I had three randomizers running, where each would block out the "bad" inputs until a new one activated... it's kinda hard to explain. Basically, each emitter emitted blockers for all randomizers.

Edit: Nah. I'm gonna stick with my original. Eating apparently added some clairvoyance.
2010-07-20 00:21:00

Author:
comphermc
Posts: 5338


Thanks everyone so far! To encourage you a bit more, there's a cookie up for grabs for whoever comes up with the best solution!11!!1



Hey! You know the LBPC logic pack randomizer emmits mag keys in different positions in order to "randomize". So we could expand that and make it possible to emmit all the possible combinations of 3 mag keys . (instead of emmiting one mag key at once it emmits 3). It's still a pain, but it is something.

With 3,360 possible combinations, that may take a while.
2010-07-20 00:30:00

Author:
Nuclearfish
Posts: 927


With 3,360 possible combinations, that may take a while.

lol. "Small" calculation error
2010-07-20 00:35:00

Author:
gdn001
Posts: 5891


Eurika! What about using emited lights? The best bit is there's no need for a randomizer, just sync 'em as you see fit. It may be tough syncing them to emit 3 lights every ten seconds though, but you could programe it so no light goes on for more then 10 seconds.

And then just use pistons connected to the emmiters to make it emmit a certain light out of sight, if you only wanted 2 to shine. Simple!

It'd be like programming a cut scene.

Edit: Got it now, use a timer (piston, key switch), to emit your choice of lights every 10 seconds. Voila! I'll be taking that cookie.
2010-07-20 01:02:00

Author:
AgentBanana
Posts: 511


Well, I finished my model... I think I kinda failed. In theory it should work, but it has issues. It sort of stutters, and when it does that, you sometimes get a repeat. In all, though, it's not so bad.

Video time:


http://www.youtube.com/watch?v=2huhspYy1i0

Edit: made a few changes... seems more reliable now. It's also set up fall off to two and then one lights cycling through. These are done on input.
2010-07-20 02:56:00

Author:
comphermc
Posts: 5338


Interesting work fellas. Wish I wasn't so logic impaired. I almost feel like you gotta be like a complete math geek to understand any of it

You guys should be programmers tho, thats where that kind of logical thinking comes in handy.
2010-07-20 03:19:00

Author:
Enlong3
Posts: 357


Who's to say rtm isn't a programmer? ...or at least has programming experience. 2010-07-20 03:32:00

Author:
comphermc
Posts: 5338


Yeah, I dabble a bit, lol

So you didn't get rid of the delays on light activation then?
2010-07-20 09:13:00

Author:
rtm223
Posts: 6497


I came up with the idea of storing the old values of the output, then use a randomizer to store a provisional output; if there are no lights in common with the ones that are already lit and the number of output is the one I want, wait until the 10 seconds arrive and make the provisional output become the current one, otherwise start from the beginning. This method would work, but it would need 32 set-reset switches for the caching, 16 ANDs for the outputs comparison, a randomizer and some other logic parts, so I guess it's not very thermo friendly2010-07-20 09:29:00

Author:
Shadowheaven
Posts: 378


Mine had a similar idea, where you "look ahead" and queue up the next set of symbols, but with a slightly more elegant solution.

Rather than just try to generate 3 new random values in advance and reset the system, the current values actually block themselves from occuring on the next output, so you would never have to do a reset.

It's not in the slightest bit easy to explain
2010-07-20 09:35:00

Author:
rtm223
Posts: 6497


Do you do that using 2 randomizers? or....
Also, doesn't using this method alter the percentage of the values of the randomizer?
2010-07-20 09:54:00

Author:
Shadowheaven
Posts: 378


Single randomiser either moving up the screen, or with little stacks of blocks that fall down.

It would affect the percentage values of the randomiser in the sense that each iteration would be ever-so-slightly dependent on the previous so potentially if could lead to a pattern over time (i.e. if 3 came out one time, 4 would be more likely to come out the next). It's unlikely to hit a problem, although now I think about it, if you were to end up with 3 consecutive lights on, then the system actually might naturally lock itself into a pattern (because you actually have 6 outputs with dependencies). Maybe it wasn't such a good idea afterall


The skewwing of percentage values is technically true of most systems like this, due to the concept of having 3 outputs active at once. To truly avoid that, you would have to independently randomise them each of the three- for example: have a 16 output randomiser, a 15 output randomiser and a 14 output randomiser, then manipulate values to accomodate for the inevitable duplicates and shift the values. Depends how random you would need.
2010-07-20 10:12:00

Author:
rtm223
Posts: 6497


I'm at work now, I'll try it when I get home. Nuclearfish, are you satisfied so far? 2010-07-20 10:41:00

Author:
Shadowheaven
Posts: 378


Well, I finished my model... I think I kinda failed. In theory it should work, but it has issues. It sort of stutters, and when it does that, you sometimes get a repeat. In all, though, it's not so bad.

Edit: made a few changes... seems more reliable now. It's also set up fall off to two and then one lights cycling through. These are done on input.

Looks pretty good though!! How much thermo does that take up?


Single randomiser either moving up the screen, or with little stacks of blocks that fall down.

It would affect the percentage values of the randomiser in the sense that each iteration would be ever-so-slightly dependent on the previous so potentially if could lead to a pattern over time (i.e. if 3 came out one time, 4 would be more likely to come out the next). It's unlikely to hit a problem, although now I think about it, if you were to end up with 3 consecutive lights on, then the system actually might naturally lock itself into a pattern (because you actually have 6 outputs with dependencies). Maybe it wasn't such a good idea afterall


The skewwing of percentage values is technically true of most systems like this, due to the concept of having 3 outputs active at once. To truly avoid that, you would have to independently randomise them each of the three- for example: have a 16 output randomiser, a 15 output randomiser and a 14 output randomiser, then manipulate values to accomodate for the inevitable duplicates and shift the values. Depends how random you would need.

It really doesn't matter too much if patterns emerge or if it isn't completely random. What I need for is a bit more interesting than a grid of lights. It's actually for bubble machines, and they'll be moving around a LOT. The gameplay idea is that you swim to bubble machines to refill your air supply, but you've got to do it quickly before the active bubble machines change.

I did a quick test using the 4-ouput notched wheel logic thing in the Logic Pack connected to just four of the bubble machines, and when everything starts moving around even that looks like its random. As long as its only random enough so that every time you play the level it won't be the same as last time, that's fine.


I'm at work now, I'll try it when I get home. Nuclearfish, are you satisfied so far?

I am indeed, but keep going! Pretty impressed that everyone is so eager to find the best solution.
2010-07-20 11:12:00

Author:
Nuclearfish
Posts: 927


I never completely removed the stutter, but the repeats have decreased. I can work with it some more, but based on what you described, mine would likely do the job. It takes up 2-3 notches of thermo, but I think that's deceptive, as it just has a large number of switches.

I guess hold off and wait to see what rtm comes up with.

---

My second idea sounds similar to what he is working on, but I just haven't figured out how to make it work yet.



........ On second thought. If it doesn't need to be completely random or can have patterns, then the solution is much easier. Just three randomizers, each taking care of a range of outputs.

Randomizer 1 ---> Outputs 1-5
Randomizer 2 ---> Outputs 6-10
Randomizer 3 ---> Outputs 11-16

Each of the lights in randomizer 3's domain will be slightly less likely to occur, but if I presume correctly, you don't care. In addition, you mix up which outputs go to which bubble machines for a seemingly "more random" experience.
2010-07-20 11:42:00

Author:
comphermc
Posts: 5338


........ On second thought. If it doesn't need to be completely random or can have patterns, then the solution is much easier. Just three randomizers, each taking care of a range of outputs.

Randomizer 1 ---> Outputs 1-5
Randomizer 2 ---> Outputs 6-10
Randomizer 3 ---> Outputs 11-16

Each of the lights in randomizer 3's domain will be slightly less likely to occur, but if I presume correctly, you don't care. In addition, you mix up which outputs go to which bubble machines for a seemingly "more random" experience.

I did think of doing that, but then when I cut off randomizers 1 and 2, it'll be the same 6 bubble machines for the remaining one. Most players probably wouldn't realise that, but..... well, better way of explaining it - it's kind of like an underwater version of the Spirlaizer or Tumblerizer. There's a spinning maze made up of 5 rings, each rotating at different speeds. The bubble machines are on those rings - 1 on the first ring, 2 ond the second, 3 on the third, 4 on the fourth and 6 on the fifth, making 16 in total. So, they are moving around a lot, but, when it gets down to one bubble machine at a time, I want it to feel like any of the other 15 could activate next. If there's only a choice of 5 others, if you've played the level a lot you may know which rings it's likely to appear on, or which it won't. So when it's at the last stage I'd still like all 16 to be a possiblity, although it doesn't matter too much if some are more likely.

But yeah, I'l wait and see what everyone comes up with.
2010-07-20 12:04:00

Author:
Nuclearfish
Posts: 927


Then just make sure that when you deactivate a randomizer, the next ones inherit its outputs, like
Randomizer 1 ---> Outputs 1-5
Randomizer 2 ---> Outputs 6-10
Randomizer 3 ---> Outputs 11-16
then
Randomizer 1 ---> Outputs 1-5 + 11-13
Randomizer 2 ---> Outputs 6-10 + 14-16
and lastly
Randomizer 1 ---> Outputs 1-16

You could use different colors for the magnetic keys of the randomizers, so when you have to make them inherit the outputs, you only need to add a mag key - Man, it's hard to explain...
2010-07-20 12:12:00

Author:
Shadowheaven
Posts: 378


Ah, fair point. I just got another idea which should be much more thermo-fficient. I'm wondering how close it is to rtm or shadowheaven's design. It should only require one randomizer, and the transition should be smoother. We'll see how it goes.2010-07-20 12:16:00

Author:
comphermc
Posts: 5338


I have another idea, I don't know if thas has been said.. but i'll say it anyway.

Using a randomizer with 4 different outputs, you can then select up to 3 of the 4 of the outputs and make it stop after 3 are chosen with some magical voodoo logic. (Don't worry, I got that bit sorted). I can also make the number go down to 2, an then to 1.

The 3 switches it chooses will activate 3 of 4 other different randomizers. Each one will concentrate on one plane of lights, so 4 lights each to every randomizer. After choosing one output, it will stop. And again with some magical voodoo logic, I can make it permenant for no more then 10 seconds and the 3 random lights will go on at the same time. I got it in my head.

Then, to make it go down to 2 lights on instead of 3, I can just make a sort of 3 piston switch majiger that will be activated by a timer.

It's hard to explain, but i think it may work if the theory is anything to go by. I'll let you know if I can manage to create it.
2010-07-20 13:21:00

Author:
AgentBanana
Posts: 511


That is a solution, but it would exclude more than half of the combinations, because you wouldn't be able to have more than 1 light lit from the same randomizer2010-07-20 13:32:00

Author:
Shadowheaven
Posts: 378


I thinks I gots it! There's a bit of a delay sometimes but apart from that, it's all good.

I just might adjust it a little, and I just have to add the 3 to 2, to 1 lights on. I should be done soon. I could send it to you if you want. It's pretty big.
2010-07-20 17:02:00

Author:
AgentBanana
Posts: 511


Well, I've done it.

I literally started over, and it's now perfect....ish. There's no studder, no repeats, and can very easily drop off to two and one inputs. AND making it start at 4 and work down to one only requires a single winch (via perm switch).

In all, it comes in just under a bar of thermo and uses a single randomizer. I'm trying to get a video up, but youtube is being dumb.

It all came down to "building the three outputs" and then activating them all. This boiled down to putting emmitters and the mag key switches on pistons and toggling them between two locations. So, it went something like this:

1. Move emitters up.
2. Destroy any keys that are currently on the top.
3. Emit a set of three mag keys in randomized locations.
4. Move mag key switches up over top of the set, thereby triggering your outputs.
5. Move emitters down.
6. Destroy any keys that are currently on the bottom.
7. Emit another set of three mag keys in randomized locations.
8. Move mag key switches down over the new set, thereby triggering the next set of outputs.
9. Repeat 1-8.

There was a bit of finagling to ensure that the keys in steps 3 and step 7 didn't occur in the same "location", but I did it, so there are no repeats. It should be pretty clear why, but I used a sequencer-of-sorts to run that whole cycle constantly, again and again.

By restricting how many mag keys can be emitted in either location at once allows you to control how many outputs will be activated at once. It's really quite clever when you see how it works.

2010-07-20 22:42:00

Author:
comphermc
Posts: 5338


Can't wait to see it!!

What ever would I do without you clever logic people?
2010-07-20 23:15:00

Author:
Nuclearfish
Posts: 927


Finally! I had to use Internet Explorer to upload my videos... *shudder* I feel dirty.

At any rate, here is what it looks like in action. Sorry for not getting much of the logic, but there's really not much to see... it's just emitting things creatively. You'll notice on the second "Chomp" sound, it will only display two randomized lights, and it will only display one on the third "Chomp."


http://www.youtube.com/watch?v=11I6BYnBh4w

2010-07-20 23:23:00

Author:
comphermc
Posts: 5338


That is perfect!! Awesome job comph!!
Now all I need is to steal it and stick it into my level.
2010-07-20 23:36:00

Author:
Nuclearfish
Posts: 927


By restricting how many mag keys can be emitted in either location at once allows you to control how many outputs will be activated at once. It's really quite clever when you see how it works.



Gah, that sounds much better then mine. It sounds like your describing a Windows 8 to my 50's computer.

Mine took up quarter if the thermo, and if I remember correctly, I used a randomizer to select 3 of 4 random emmited mag keys, and then pushed them with a piston to start the other 3 of 4 randomizers which came up with 3 different outputs, triggered at the same time using a piston, emmiter, and some silky, sexy glass. (Couldn't resist).

It was easy getting the lights to not repeat, but I think that's what made the thermometer so big! I just used 16 emmiters triggered by the outputs from the randomizers to get rid of them while the emmited block also made the light shine.

Well done. I'm pretty jealous.
2010-07-20 23:37:00

Author:
AgentBanana
Posts: 511


Wonderful... I shall delete someone and add you next time I'm online.

I hope you have a lot of physical space in your level. It takes up a lot of horizontal and vertical space. You should just be able to tuck it in a corner somewhere, but it must be above water. It has a slight gravity component to it.

2010-07-20 23:42:00

Author:
comphermc
Posts: 5338


Nice. I went to see toy story instead of trying this. However, I'd like to think that my heckling from the sidelines was around 95% of the work involved in getting this achieved though.

Now make it better Nah, it really is a very nice solution
2010-07-20 23:48:00

Author:
rtm223
Posts: 6497


You must enter the code every 108 minutes2010-07-29 14:25:00

Author:
OmegaSlayer
Posts: 5112


aww i love logic and i missed this one D=2010-07-29 15:33:00

Author:
slidedrum
Posts: 189


**** I'm late to this party.... is it over yet? has the cookie been eaten/gone stale? I just found this thread and thought "ooh now I have a use for my randomiser!" I just made a really nice one too.2010-07-30 08:59:00

Author:
Strangepom
Posts: 445


Out of curiosity, how would this play a part in your level? Or is this just a challenge?2010-07-30 09:38:00

Author:
Jwei44
Posts: 46


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.