Random tile generation - 2D - LibGDX

Hello guys ;D

I’m looking at making a Flappy Bird sort of clone as it will allow me to create random ‘pipes’ on the map. I plan on using Tiled for the background and was thinking of creating pipes (simple png’s) that will overlay the map but then got thinking of using the actually Tiled system to create a completely random map.

I’ve done some searching and most of the results are about whole map generation, where as I just need random pipe generation, over the set background… if that makes sense.

I’ve noticed people talking about “Perlin Noise” and was wondering if this would be useful for my needs?

I’ve been thinking about this as well for a tiled based game I’m working on but for a flappy bird type game could you not just have one image of a long pipe, generate a random number for height within certain parameters with an offset for the top pipe by a set number of pixels and the add two hitboxes around them based off the random number generated and the offset?

Well first thing to note: there is no such thing as “random pipe generation”, so trying to research that specific topic will most likely get you nowhere!

I wouldn’t use perlin noise for this, it’s not suitable for your problem. Your problem can be solved using some simple math, actually! Think about it, what do you need to figure out? You need to figure out where to place a pipe so the player can fairly avoid it, but there is still a challenge. In the case of Flappy Bird, pipes are spawned at (IIRC) regular intervals with enough space to allow the player to just miss the pipe, but not enough to make it easy to miss. So, find a good interval at which to spawn pipes. You can determine this just by playing with values. Just start adding pipes and seeing how far apart you need to spawn them.

Thanks guys, I think I have a good idea where to head with this now :slight_smile: hopefully after this project I can work on a large random world generation project

I actually made a Flappy bird clone a while ago one Saturday in about 4 hours. I just did random height generation (within limits of course). Here’s a project of the game + src for you to look over if you feel like it: Link (r to reset)

All you have to do is create a pipe at either the top or the bottom that is a random size (vertical length) and then create the other one on the same X coordinate using a max and min “gap” value. It is fairly simple actually.