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

Random Sequence/Object Emitter/Generator

Archive: 2 posts


So, as I mentioned in the threads here (https://lbpcentral.lbp-hub.com/index.php?t=47782-Random-Level-Sequence-Generator-Help)and here (https://lbpcentral.lbp-hub.com/index.php?t=47822-fire-randomiser-once&p=763211), I've been working on my first LBP2 level (and my first level in general - wanted to show my little brother I could put something together for once ).

So, the premise for my level is simple. Platformer, set at sunset, with different building heights and a grapple section where you swing through a building. The problem is, I knew there were a lot of levels similar to this (if not in style), so I wanted to be a bit more... Ambitious. So, I thought "I'll make 8 or so buildings, arrange them in 8 or so set patterns, and then have LBP2 randomly choose which sequence to use next in the level, so that way it's always different!"

And so it began. Everything went well, up until the random generation part. I had all my emitters rigged, had the randomizer set, and timed everything up accordingly. But, I ran into a handful of problems:

1. Randomizer wouldn't emit during the right time (it kept checking for when it had free space to drop something, not when I set it to)

2. Emitter wouldn't emit when the randomizer selected it (a result of changing the settings to "emit once" from a randomizer set to "overide pattern", triggered by a timer.

3. If the randomizer selected an emitter twice in a row, the emitter wouldn't register it as a new selection but rather a continuation of the old one, so it wouldn't even emit again.

This gave me about a 1 in 8 chance of the level breaking - not good. However, after some forum help and a lot of thinking, I've come up with a rig that seems to generate exactly on time, and for the most part it is pretty random - although if it does select one object twice in a row, it won't break.

Here's a picture of the rig:
http://img827.imageshack.us/img827/5990/aphotoe.jpg

Now, since I've been hearing how frustrating this is for a lot of people, I thought I'd post some notes on it for now. I'll most likely give the rig away as a prize with my level, since I'm so proud of it, with notes and everything, but in the meantime, notes:

Each of the emitters is set as such:
-Emit Once

-Each emitter is rigged to a counter, which activates it. The counters have a count of 1, default count 0, and have another output cable to reset it (mainly a failsafe more than anything - you probably don't need it but they were left over from another attempt and since it works I'm not complaining )

The randomizer is set as such:
-Input: On/Off (Unlike Override Pattern, this one won't leave a signal running through the cable if it is turned off.)
-Emit: One at a time (to prevent duplicates / strange patterns)
-Rigged to each emitter you want emitting something.

The emitter is in turn rigged to a toggle output, which is triggered a direction combiner, and triggers a timer when toggled to on.

The direction combiner takes two different inputs, one on and one off, for the toggle switch. The on toggle switch is triggered by a counter, which resets itself every time it is activated by a timer (this time is what will determine the intervals between random emitting.

The off toggle switch is triggered by the timer that is triggered by the toggle switch itself, when set to on - this timer runs for longer than it takes the emitter to emit the object, but less than the total time between emit intervals (the lower the timer's time is, the better - that way you don't risk anything). For example, my sequences emit every 10 seconds or so, but the timer to trigger the off toggle switch once it's on is about 2 seconds. This timer resets itself each time it completes the timing.

And so, that's basically how it works. It can randomly emit from any number of choices, and the whole rig took up about 3-4 notches of temp meter (although once it emits something, take that into account - so, no emitting more than what would overheat the level, for instance).

So to recap, it works like so:

Timer counts intervals between emitting
->Count activates Toggle Switch
->Toggle Switch Activates Randomizer & Timer 2
->Randomizer is set to run, chooses counter which is rigged to one of the emitters, for a one time emit
->Timer 2 counts down, between randomizer choice and next emit interval
->Timer 2 deactivates Toggle Switch
-> Timer switch cuts signal to Randomizer, which cuts signal to emitter
Timer finishes waiting for the next interval

Rinse, repeat.

If anyone has any questions or comments, feel free to leave them. If not, I plan to upload the level in the next week or so.
Cheers!
2011-02-05 22:12:00

Author:
LucidMomentum
Posts: 8


Wow really nice setup I might decide to use somthing similer for a top-down level for random terain(Or however you spell it) xD2011-08-03 03:54:00

Author:
MarkusTheFish
Posts: 8


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.