Optimal way to autogenerate level (for an infinite runner)?

0 favourites
  • 3 posts
From the Asset Store
A 48×48 pixel art gamekit to use instantly in plateformers, shooters or runners
  • Hi, everybody.

    Im making an infinite runner and I would like to listen to ideas by the big brains here about what do you think would be the best approach for randomly choosing from a prefab pool of modules to build the level.

    I managed to use the new Templates+Hierarchy tools that Construct currently offers to call those prefabs no problem, BUT I don't know yet how to make a system ("""algorithm""") to tell Construct that I don't want two instances of "Module_Hazard" next to eachother. Much less so more than 3!

    I thought about making an array and writing there each module class as a string and trying to figure out a way for the engine to be able to "know" which module is next to eachother.

    Here's a capx I made reducing my game to the basics that I want you to help me with. The module generator is in here but no algorithm to control its wacky randomness.

    https://drive.google.com/file/d/1mF9_ndZ8UvONgpe7v0-vlP3nc_b0dEJk/view?usp=sharing

    For example, I would want to make it in a way that no two fire1 modules can be generated next to each other as you will find out in the Test

    Cheers

  • You'll want to use the advanced random plugin to either generate a permutation table, which allows for non repeating sets of numbers, weighted probability tables also from the advanced random plugin, or simply save and check to compare the previous prefab with the current one and reroll if they are the same.

    A more robust solution could use these methods together.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You'll want to use the advanced random plugin to either generate a permutation table, which allows for non repeating sets of numbers, weighted probability tables also from the advanced random plugin, or simply save and check to compare the previous prefab with the current one and reroll if they are the same.

    A more robust solution could use these methods together.

    Thanks for the reply oosyrag

    I didn't know advanced random was a native plugin. I'll check it right now and read its documentation to see if it covers my needs.

    Probably the terms you mentioned aren't that difficult to grasp but they are a little scary for a coding noob as me.

    Again, I'll try that and post the results or (more probably) the problems I'll encounter.

    Cheers

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)