Hey! It's me again, been a while since I toyed around with Construct 2, or any game creating engine to be honest, I was looking through some of my projects and found on Game Maker my attempt at a Terraria type game and thought "This could be done so much easier in Construct 2!" so I'm converting my entire project to Construct 2 and I was looking around at the best way to do the terrain generation and found Arrays to be the most efficent way (Of course) and I started toying around with it.
It's kinda working, as in everytime I launch it / refresh the page I get a new randomly placed jumble of air, dirt and stone blocks.
But of course this is not exactly how I want it to work, I was wondering how do I make it so that say between the top of the layout till about... For argument sake say 32 pixels down it will only generate air blocks and then between 32 and say 64 only dirt blocks, between 64 and 80 it can mix stone and dirt and anything below that is stone.
I have tried making a variable called worldheight which gets it's number from the layout height and then try to read inside that but I just can't get it to work.
I'm assuming I'm gonna have to find some sort of perlin noise plugin to actually generate the terrain to make hills but to begin with I just want to be able to generate a flat surface as a starting point.
I have a few other questions that pops into my mind as these will come up later I'd rather ask them now than later, better to keep them all in one place right?
1. Should I be using Arrays to create trees or should I create a preset loadout of trees that is randomly picked everytime a tree is spawned / grown from a seed or is there a better way to randomize trees with leaves and all?
2. Ore deposits, how would I create this the most efficent way without making it too much or too little? Also I assume I could use this same techinque to make underground cave systems by just replacing the ore spawned with air blocks to make air pockets?
3. Is there a way to make so that everything outside the screen for the player is not loaded but the information is there so it loads up as the player gets there? This would reduce lag due to the lower RAM usage I imagine as this was an issue I had in my project in Game Maker or will this not be an issue as I will have set world sizes by making it so that they only fit inside the layout size which will have multiple different size settings when creating the world?
4. Anyone know any good inventory / hotbar tutorials I can take a look at? I got a basic one up and runing but it only makes it so dirt can only be in one specific slot and stone in another specific slot so it's not very effective as I want the player to be able to move the items around as they please.
5. Also, crafting, how hard would this be to make? I was thinking a fairly simple crafting system like Terraria where if I have the required materials in my backpack it appears in my list as craftable items and I click it and it gets made, it shouldnt be too difficult. Come to think of it I could probably figure this one out myself but I just wanna check if my thoughts on it work.
Wouldnt it just be a set of variables? A variable check that checks for say 2 wood and 3 stones and a button appears in my crafting list that says "Stone Pickaxe" I press it, the variables are pulled off my total amount, a stone pickaxe is added in my inventory and if my total material amount goes below the requirements the button vanishes/gets greyed out from the list. Is this the correct way to go?
Another question that is not related to this project is I've noticed when I try to testrun my game either with or without debug mode sometimes it just don't load / takes up to 5 minutes to load, usually I have to save my project and restart the program before it starts up instantly when I press play.
This is not on big projects, I could literally place down a 32x64 platform with solid behavior and a little 16x16 character with the platform movement behavior and it'd still take so long sometimes and sometimes it's instant.
I'm sorry for asking so much but I find it's better to ask everything at once instead of asking it separate, I have looked at many capx files for terrain people have posted and some have been fairly nice but I havent been able to figure out what makes them tick and most have not been what I'm looking for.
Thanks in advance for anyone who can help me with either of these questions or point me in the direction I need to look in order to start tackling this.