Placeholder Image

Subtitles section Play video

  • Hi guys, welcome back to another video.

  • If you've seen some of my other videos, you'll know I like making games with redstone.

  • I really like making games with redstone.

  • But what goes on behind the scenes?

  • How do my projects get built from start to end?

  • Today, hopefully, I'm going to answer those questions and take you along with me on my journey to build Flappy Bird with just redstone.

  • I hope you enjoy.

  • Flappy Bird is a mobile game by Miniclip, originally released in 2013.

  • However, it was removed from the App Store and the Google Play Store in 2014 because the creator felt like it was too addictive.

  • Well, sorry Miniclip, but today we're going to be spreading your game a little bit.

  • First, let's think about the screen.

  • I think the best way to do the screen is with a lamp display.

  • I don't see any advantage to using pistons here.

  • As far as how big it's going to be, I'm not really sure, so I'm just going to make a starter screen and we can always change the size later.

  • Okay, I just made one that's 16 lamps by 16 lamps.

  • Now let's talk about the bird.

  • So, the bird is constantly falling.

  • To me, when I hear constantly falling, I think of a degrading circuit.

  • A degrading circuit would just lose value over time.

  • For example, you could have a comparator into another comparator like this.

  • If you imagine that this line right here is the height of the bird, if you start it like this, you can see how the height naturally falls down.

  • Here, let me put some lamps so you can see it a little bit better.

  • You start like this and see how the gravity part of the bird.

  • All right, so I played with the timings a little bit and as long as we're trying to make this game run in real time, I think this is probably a good speed.

  • Yeah, it feels about right.

  • The one problem with this though is that right now, aesthetically, the bird is just a huge bar of lamps that gets shorter.

  • I'd rather have it just be like the top of the bar, so a single pixel.

  • If we attach a red coder to this or a signal strength decoder, we can just get that top pixel.

  • I'll show you what I mean.

  • All right, I attached a red coder on the end of Now, if we send in a signal strength here, it's only going to light up one lamp associated with that signal strength.

  • When I press this button, it's still going to give a signal strength of 15 and start to degrade, but now it's just a single lamp.

  • Our lamp started up there and it falls all the way down to the bottom just like it had gravity.

  • All right, so we've got a bird on the ground.

  • We can set it up to the ceiling and then it'll fall down, but how do we make it jump?

  • Well, if we think about what a jump is, a jump is really just take the current height and add a value to it.

  • Why don't we just take this signal strength, which again represents the height, add some value to it, and then plug it back in whenever we want to jump.

  • It seems like it would work to me.

  • The way that we're going to add a value to the height is with a circuit like this.

  • This is the input signal strength right here, this is the output, and this is where you want to put the value that you want to add.

  • What we're doing here is what I like to call a double inversion, where an inversion is taking 15 minus your current signal strength.

  • We do it once right here because we're taking 15 minus whatever this signal strength is, and that's the output, and then we're doing it again over here. 15 minus 7 is 8.

  • If you don't do anything special to it in between the two inversions, then it's just kind of a comparator.

  • It goes in one signal strength, and it comes out the same signal strength, because inverting it once and then inverting it again puts it back to what it was.

  • But if we go over here and put some value here, that's going to subtract it from whatever it is in between the two inversions, and that actually adds it to the number.

  • If you want a proof of this, I'll put it on the screen right now, but yeah, I mean this is just the way I remember it.

  • The way to add to signal strength is just to subtract while it's inverted.

  • So if you jump height to be let's say 3, then you just grab a signal strength barrel with 3, and now whatever signal strength goes in here, it's going to add 3 to it and come out here.

  • So for this example, we have 8 plus 3 is 11.

  • If I try something else, let's say 10 plus 3 is 13.

  • So that seems to be working.

  • So now I just have to attach this to this, and we should have jumping.

  • Alright, I think it might be working.

  • Let's try to spawn a bird and jump.

  • Okay, maybe now it's working.

  • No, not at all.

  • Okay, finally seems to be working.

  • I changed some timings.

  • Alright, I think it's time to put this bad boy onto the screen.

  • To do that, I'm going to need a vertical red coder instead of a flat one like I have here, but I think I have a design for it.

  • Yep, I was right.

  • I have one in my schematics folder.

  • So this is a vertical red coder.

  • It does the exact same thing as the other one.

  • Whatever signal strength you put into the back here, it's just going to show whatever lamp that is.

  • So we've got 14.

  • That's going to show the 14th lamp.

  • Okay, I took the vertical red coder, I attached it to this guy, and I put it behind the screen.

  • I think it should work.

  • Let's try it out.

  • Nice.

  • It actually feels like Flappy Bird already.

  • The next step is to generate the pipes.

  • Since we have pipes coming from the top and the bottom, you might think it's easiest to just generate like a random length pipe right here, and then another random length pipe right here, and that would look something like this.

  • But I think a better way to generate them would be to generate one giant line and then pick a random hole, right?

  • Because once you have this line, if you just pick a random hole, like say you pick here, there you go.

  • Those are your two pipes.

  • To physically move the pipes across the screen, I think I'm just going to use a system like this.

  • It's actually pretty simple.

  • We just have an observer chain and then a bunch of observers coming off of that chain.

  • Whenever you give it an update, it gives you a nice three-wide pulse across these lamps.

  • Okay, I stacked it up a little bit and I simulated a little system to see what the pipes might look like.

  • Yeah.

  • I mean, that looks pretty good.

  • My only concern is that this might be a little bit too fast.

  • I mean, these are moving pretty fast across the screen and considering our bird only falls that fast, I don't think it'll mix well with those pipes.

  • But I mean, at the same time, you can also just make the bird fall a little bit faster by making this clock a little bit shorter.

  • So I'm not that concerned.

  • You know too fast.

  • This would, even if the bird was at the same pace and it was falling really fast, this, I don't think Flappy Bird is meant to be, meant to be this crazy.

  • At least not until you get to the later levels or whatever.

  • So I'm going to have to think of a different system to move the pipes across.

  • Okay.

  • I just had a thought.

  • What if we put repeaters on the back of these?

  • They're one wide.

  • So, oh, okay.

  • That's, that's much better.

  • Check it out.

  • Dude.

  • Oh my God.

  • I can't believe how easy that was to fix.

  • All right.

  • So like I said before, for each set of pipes, we're just going to create one long column and then generate a random hole.

  • To me, when I hear one long column and a random hole in it, that kind of reminds me of the vertical red coder again, because if you just invert this, now it looks like one long column with a hole in it.

  • So I think if I can find a way to modify this to make the hole bigger, that'll be perfect.

  • Okay.

  • I've been working on it a little bit.

  • I think I've got something promising.

  • So if we input a signal like that, we get a hole right here.

  • And if we input a different signal strength, maybe you want a little bit higher.

  • We get a hole that's higher up.

  • Okay.

  • That seems pretty cool.

  • All I did here was take the output from the red coder and make it go up a slab tower by a designated amount.

  • So for example, I think the output's coming from about right here and you can see it came out with a single strength of seven, meaning that it's going to go up like this and create a hole.

  • That's only seven long.

  • Everything else still has torches on it.

  • Okay.

  • I hooked up the fancy observer screen to it.

  • And now we'll actually be able to see the pipes right now.

  • It's set at this current height.

  • And if we press this button, it releases it.

  • And that's what the pipes look like.

  • That's actually pretty good.

  • We can go over here and we can change the height.

  • We can do something like this instead, press the button and we get a different height.

  • Awesome.

  • After playing with it for a while, I noticed that sometimes the holes are like too high and they chop off the top pipe.

  • So I modified the input system a little bit.

  • And you go right here and press the button.

  • That is the highest possible hole.

  • Or if you go right here and press the button again, that's going to be the lowest possible hole.

  • And that means that this redstone line is essentially our range.

  • So now we just need a way to randomly assign a random piece of dust to full power.

  • The easiest way to do that is with a randomizer circuit.

  • So this is a 50, 50 randomizer.

  • When I press this button, it's either going to give me an output or it's not, it's a 50, 50 chance.

  • The way this works is we have a dropper pointing up into a hopper and the one non stackable and one stackable.

  • If it chooses the non stackable, which is the ax, it's going to output two signal strength and reach the lamp.

  • But if it outputs the stackable, which is the dust, it's only going to output a one signal strength, which does not reach the lamp.

  • So let's activate three of these at once.

  • And that way it's going to generate a random three bit binary number, which means it's going to be a random number in the range zero to seven or zero, zero, zero to one, one, one, zero, one, two, three, four, five, six, seven.

  • Can you see where I'm going with this?

  • All we have to do is use a decoder to decode the three bit binary number into its corresponding torch zero through seven.

  • And now with three randomizers and a decoder, we can choose a random torch every time we press this button.

  • Okay.

  • I made a little circuit to automate it and check it out.

  • Random pipes.

  • Let's put this thing on the clock.

  • Oh yeah.

  • That is amazing.

  • All right.

  • We've got pipes.

  • We've got a bird.

  • Let's try to combine them.

  • Okay.

  • Slight problem.

  • And I probably should have seen this one coming, but the observers don't mix very well with the red code or like, I can't bring these observers across here, which means that the pipes just kind of disappear as soon as they reach the birds column.

  • I'm sure there's a way around this though.

  • I might have to redesign something, but I'll let you know what I figure out.