Tile based "digging" games

0 favourites
From the Asset Store
Advanced inventory mechanics for your RPG game (Array-based). Take Items, split them, pick up them, read the description
  • Many of you have probably seen games like terraria for example where the terrain seems to be made up of tiles that you can dig out.

    I was wondering what the theory behind the creation is?

    Are the tiles little sprites that you spread all over the screen?

    I'm gathering you wouldn't paint them by hand and that you would generate them some how? I guess this would involve setting an upper limit (so you have a horizon) and then getthing it to fill in the test with sprites and adding a random function somewhere to pick different types of sprites.

    Is that sounding like a sane path to take?

    Any options or examples welcome.

  • Would like to know this as well.

  • For a start of an answer check this post out

    There are also other examples of tiling/grid in the "how do I" section, make sure to do a quick search if you need more.

  • I'm guessing the world is a huge array - you need to know how they work before undertaking a project like this.

  • Very nice so one method is to store the differing tile images as animations as use something like int(Random(0,Sprite.AnimationFrameCount)) to pick a random animation. That's cool. If you wanted to "tile" around something. E.g. bury a diamond in the dirt I guess you could overlap the diamond at a particular position on another layer then when you grab it you could destroy all the overlapping tiles so you have a hole where it was dug out?

  • well, this is a old post but i think ppl still wanting to learn about ways to make building/block/digging kind games (including me), so i'v made a search on the internet and found this site here:


    and here:

    Minor78 - Level Editor

    that explain the basic behind auto tiling, but i'm still learning how to use things and i cant find a basic tutorial of how to make a level editor with construct. I hope this help and if you guys find some good basic tutorial of autotiling/level editor for platformer using Construct, pls let me know too

  • I also may add that for awesomely big world, you could use random seed.

    The idea behind that is that all number returned by this kind of random() function would always take your seed number at a start and return every time the same numbers.

    Because you might not now it but a random doesn't really exists in a computer world. Random() function are series. You take a starting number and then always apply the same operation to have the next pseudorandom number.

    Well now that I've explained that for those who didn't know.

    If you apply the same random operation for creating your big world, you can understand now that if you have the same serie of randome number you'll generate the same exact world.

    Then basically you could store an entire world in one single number (and I believe it's how minecraft works). Then you just have to store what has been modified in this world. Which would be far less than the big world.

    The only downside is that generating the world, if it's a really big one, could take some time.

    But there's some ways to split your big world in tiny ones (that's the purpose of Arsonide's gridTree plugin for Construct Classic) to avoid this overhead (also minecraft might use something like that).

    That's all (:

  • some dude make a aproach with this kind of game here:


  • Terraria you say..yes excellent game but Ummmm....

    What about "Cortex Command"..Sheer Genius..A Brilliant Indy game... 11 years in the making...

    The only way I can think how they did it was with an Procedurally generated Pixel Array of Truly EPIC Dimensions

    well worth a look...if you can figure how they made that and give me that code ..I'll buy you a Lamborghini ....A phat red one


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Lol, i am actually working on a terraria based game. I didn't use array or some complex stuff. This is a picture from my project: http://i.imgur.com/CquvHk2.jpg The map is random "Erased" With ores randomly puttet underground. It's the easy way to make random maps, which also look's great. The map is different each time, and i even added fog beneath the ground, so you need to discover stuff to find stuff ;) http://i.imgur.com/1E7uiFQ.png

  • HPA97 even though this thread is ancient, it still got me curious. You say it's randomly erased. Does that mean that beside the ores you made the rest by hand?

  • HPA97 i would love to know how you made it generate without using arrays,Im making a sandbox game similar to growtopia.

  • Hoyer It's random erased. Everytime you load the game, you get a random map, with random ore placed. So it's somehow the same outcome as an array random generator, just ALOT easier!

  • RookieDev The trick is to make your tiles all over the map, except at the top (because you want some surface) http://i.imgur.com/dinYKeO.png Then you add "Erasers"(Which i like to call them) http://i.imgur.com/WKsx1aM.jpg Which are the pink/purple circles or whatever you wanna colour them just make sure they are invicible during game. Then you make each of them individual so they don't erase in the same pattern. After that, you goto your event sheet, and make a global variable which you may call "RandomGen", just give it variable = 0.

    Make a group, which you may call "ERASERTOTAL" And inside you make more Groups (Depending on how many eraser you have. http://i.imgur.com/92nBeaD.png. I for an instance has 6 to begin with, but i only use 3 of them + an extra eraser.

    Do: System Every Tick -> System Set RandomGen to = round(random(0,7))

    Inside your Eraser group:

    (Make sure your eraser has "Bullet" behaviour.

    Do: System Check Variable = 0 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 1 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 2 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 3 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 4 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 5 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 6 -> ERASER1 Set angle + degrees

    Do: System Check Variable = 7 -> ERASER1 Set angle + degrees

    Do: On start of layout -> System (for example) Wait 5 seconds

                              ERASER1 Set Bullet speed to 400

                              ERASER1 Set scale to 0.5

                              Wait 15 seconds

                              ERASER1 Destroy

    (You could do anything you want for that one, but i did it like this to make it a bit more random and make the terrain look abit more nice)

    Now do the same for all of your Erasers.

    !!REMEMBER TO CHANGE Which "RandomGen" number that active certain angle for each of your erasers or else they will all do the same erasing!!

    To make it even more random:


    Instead of making a new global variable for that one, you could just use the "RandomGen" global variable.

    At the beginning of the layout, you don't want to show the players how the map is generated, so make sure the tiles and erasers are invicible at the bery beginning.

    Make a group called (for example): "GenerateInfo"

    Create "Text" which you may call "LoadInfo"

    Inside it will look like this. http://i.imgur.com/wcHHJIQ.png

    Every 1 second you set "Generating: (add 5%)"

    Do this 20 times, at the end you make "LoadInfo" Set Invicible.

    At the picture you can see that i did chagne something, and added an another second, but that is bcause i have some delays with the erasers and random ore placing.

    Now for the Ore's


    You make theese pink circles, which will be spawned random all over the map at the end of the generating process (Make sure the map is finished erased before making the Ore gen appear).

    Make sure you give the dirt/stone.etc(tiles you wanna replace with ores...) an variable. (ID=0)

    Whenever an Ore is above a tile, the tile will change ID. (For example) DirtID = 0. "Random CoalGen appear" DirtID = 1 (Which will turn the Dirt to a coal ore. and you can watch the picture to see how it's made.

    That is mostly it, but you also want the dirt on surface to become grass.

    Make spawners at the whole top layer of the map, which spawns "Seeds" At all time. Whenever a seed hit the dirt, the seed destroy itself, and the grass change ID to a grass ID.

    You also need to make sure the map get visible after the generating, you need to time the Seconds needed to generate the map, which you also need to put dealys on the LoadInfo! I hope this rough tutorials made some sense, in worst case i could make my capx downloadable, but id like to have it myself, becuase i plan to upload it to scirra arcade soon ;)

  • Thanks For Being so detailed about how you made that happen,I will study this,I think your method will come in handy in the future.Thank you HPA97

    I seen your youtube channel you should do more Construct2 Videos man this is the future and alot of people need help.Thanks!

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