How do I Procedurally Place Tiles For Infinite Level

Get help using Construct 2

Post » Sun Oct 11, 2015 3:06 am

Hi Guys,

I was wanting to know if it is possible to procedurally place tiles in a layout for an infinite level without me having to place tiles manually. If it is possible I have two questions.

How do you make a layout size infinite so the level goes on continuously until say the player dies?

Can you (and if you can) place tiles in that infinite layout without having to manually do it.

Think flappy bird where the level went on forever until you lost the game :D
B
9
S
3
Posts: 45
Reputation: 770

Post » Sun Oct 11, 2015 7:08 am

have a look at the examples that ship with c2 especially infinite jumper and flappy bird

start new project and in the search bar at the top right of the file load window type to fine the examples
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sun Oct 11, 2015 10:41 am

Hi RamPackWobble.

I have the Steam version of Construct 2 when I go to the example projects I don't see an infinite jumper or flappy bird game. Is it something I need to get from the Scirra store?
B
9
S
3
Posts: 45
Reputation: 770

Post » Sun Oct 11, 2015 12:46 pm

I don't have the steam version so not 100% sure but try :-

New project

and you should get ...

Image

go to top right search bar and start to type "fla" and it should list the flapping bird template.

also look in the installed folder and there might be a templates folder ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sun Oct 11, 2015 1:21 pm

Ahh yes thanks man!

I see the templates. I think I may need to reconsider how I am placing down tiles as I can't think of how to place them down procedurally.

The Flapping Bird template gives the illusion of an endless level by tiling objects and backgrounds, my level is a little different as there is tiles there but they are in chunks so I can use the tileset option to place them down into my layout.

I may need to go into Illustrator and make sections of the level that are tilable and use those sections to move along the X of my player view to give the impression of an endless level. Unless there is another way to do it :D
B
9
S
3
Posts: 45
Reputation: 770

Post » Sun Oct 11, 2015 7:25 pm

I haven't really done this stuff but I believe that there is some good info in this thread:
viewtopic.php?t=66692&start=0

There's also this link in there, which appears to be similar to what you're describing:
http://tinysubversions.com/spelunkyGen/

I hope that was useful
B
64
S
38
G
24
Posts: 352
Reputation: 17,981

Post » Sun Oct 11, 2015 8:51 pm

@ultrafop thanks for the links man very cool stuff.

I had a rough idea on how I would have to do it and this just clarifies what I needed to know :D
B
9
S
3
Posts: 45
Reputation: 770

Post » Mon Oct 12, 2015 6:35 pm

Hi Guys,

Here is an update on how I am going to try and attempt to procedurally generate my level for my infinite runner game.

Image

Each artboard is a 'room' or 'section' of the level. My plan is to spawn the sections at random, which may take some careful planning on how they are built which leads me to some questions. Before I ask my questions I just want to explain that when I export these images they are going to be used in various ways.

The floor of the level is on its own layer which I am going to be making a 'Solid' when I bring in the level sections into C2. I plan on importing the sections of the level as layers e.g, FG_Solid = Floor, BG_Level = Background artwork for the level, FB_LevelElements = Decorative artwork such as the windows, barrels, crates, mummy caskets etc.

When I import my layered artwork into C2 (this may be a stupid question), how should I import it in? As a tileset, an animation frame? The floor and threats in the level (moving saws, spikes, etc) are going to need collision so I am not to sure what the best way is to bring them into C2.

My second question is, how much control can I give myself when it comes to coding the levels. Each artboard is a level which I want to spawn randomly to make an infinite level but I want the layout of the level to make sense. How can I code the logic of that to have complete control over what spawns next to what? I know that is a pretty broad question but if someone has some sort of formula or general idea on how to code the logic to control what section spawns next to another section I would appreciate a push in the right direction, otherwise I can try and figure it out myself xD

Thanks for all the help so far though guys, this is an interesting topic and I hope if I get an efficient workflow for this kind of thing, I will definitely be sharing, may be a blog post or something :D

Cheers,

Dave.
B
9
S
3
Posts: 45
Reputation: 770

Post » Mon Oct 12, 2015 6:49 pm

If you want some natural looking shapes, like for outdoor levels, you might try the Noise.js 3rd party plugin.

The noise JS is nice for picking random numbers too.

Here is something I made with the demo he posted in just a few minutes :
http://voxi3d.comule.com/simlexgenerate/

level uses Simplex noise, the ocean effect is a Perlin noise.

Might be good for like a space level, jumping through an asteroid belt or something.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Mon Oct 12, 2015 7:00 pm

That looks very interesting @jojoe.

My game is going to look pretty much exactly like the screenshot I posted above, each art board is a section of the level so the way I am hoping to manage the generation of them is to bring each level in but in a logical placement. So if there is a higher platform for the floor in one section of the level then the next section of the level will have to match that.

I am hoping to do about 16 different variations of the level sections to keep things 'fresh' xD

My problem is I am not entirely sure how to import my level sections in to C2. Whether I can bring each of the level sections in as an animation frame and use them like that, or I can build multiple layouts in C2 using a tilemap and these layouts can be my level sections, I can then make a main layout for my game and use the other layouts as my level sections and just generate them that way (I hope that makes sense haha).

I am trying to figure out the usage of these level sections and what ways are the most efficient for mobile devices to be able to run my game. I am a little worried that I am going to make 16 of them in Illustrator and then find out they aren't usable haha.

Sweet link though man thanks for that :)
B
9
S
3
Posts: 45
Reputation: 770

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests