How Do I Handle Arrays For Terrain??

0 favourites
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • Also Whiteclaws I asked for a tutorial that was not showing RANDOM GENERATION. I dont need random I need SPECIFIC GENERATION.

    That tutorial showed how to make tiles appear through an array at random in 3 events. Im sure its even easier if I dont want random. Im sorry if im confusing im not familiar with what im even talking about

  • As you may have learned, an array is basically a grid of data. For building a tile-based level, each grid space represents a point on the layout. The system then needs to read the array data, and place the appropriate tile in the correct place accordingly (or not, if it's supposed to be empty). So my question is, how are you filling your array with the values you need to create your level. Without customizing the data in your array, all of its values will be "0", and if they're all the same, then you're entire layout will be filled with whatever "0" is supposed to be (empty tile, solid tile, etc...) So how are you entering your level data into the array?

  • Try this and see if it helps make what I'm referring to a little clearer.

    Level Data from an Array Capx

    Please keep in mind, that I've only used a single way to put the level data into the Array, there are lots of ways. You need to find the way that best suits your needs. Hope this helps :)

  • If you are trying to Stack your Array from the Bottom..Use Push to back....

    Your Tiles are made up of I presume for terrain stuff like Grass, dirt , rock, etc and you want it done in layers?

    There would need to be some limited Randomization to your Generation seed but no so much that its too chaotic...this takes time to figure out...Seeding is a fairly exact science..you need to know the basics...its not something you will pick up in 5 min....You will get the concept but not the actual coding..

    You probably should start a proper Grounding in the idea... before you get serious..its a complex field but easily doable once you understand what has to happen in order to do it..

    Read up as much as you can then do some tests...before you make your game..every hours you spend studying will make your game better in the end..

    Try these for starters and run with it...

    http://www.gameprogrammer.com/fractal.html

    http://en.wikipedia.org/wiki/Category:Computer_graphics_algorithms

    Also this might help you...

    GENERATING RANDOM TILE

    The basic idea is to Generate a seed , then load it into the Array either from front to back or vice versa....persona preference for me is start at the base. the ROOT data and then move up the tree creating nodes of detail as you require..

    this way..the over all effect is a coherent world populated by detailed areas with Gold, lava, rock, gems etc...that are created and populated at the right place and layer ..this is all determined by your seed or Ruleset that you create and must know how this works before you can really even start to think about it.

    Load your tile data or create a generation algorithm that generates the tiles you need and then "push to Back all of the Data in the right sequence...so obviously Grass would go at top..Dirt next, then rock etc...but yeah..STUDY first ..then test, then refine...

  • there ya go

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • California mystazsea brent_hamel

    Thank all of you guys for your replies!

    I have actually learned the basics from the capX file that California posted.

    That is all I needed to see to grasp how to use arrays for Terrain. I still have a few questions.But I will keep them to myself for now. I want to test around with this. Also mystazsea you mentioned PUSH TO BACK how do i go about using this function?

  • That Event is within the events for any ARRAY..

    Make a new event, set a condition and then PUSH TO BACK is one of the ACTIONS you can call..in the possible actions for an ARRAY

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