Random Generated World

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
ArterianGames
Prole
Posts: 11
Joined: Tue Apr 28, 2015 6:36 pm

Random Generated World

Post by ArterianGames »

Hey guys!

Im pretty new to Love2D, so I dont know how to do anything.... I would like to learn how could I make as the title says, random generated world. It would be like 2D Minecraft, Terraria, Magicite or something 2D Blocky... :D If you can, pm me your skype name, so if I need anything else, I can directly ask you.
Bigbadbeee
Prole
Posts: 5
Joined: Thu Nov 20, 2014 9:38 pm

Re: Random Generated World

Post by Bigbadbeee »

What type of map are you using EX: map = { 1,4,3,2 }, Tiled?

If you are using map = {} then
if you want just the first 3 layers to be random then do this

Code: Select all

 tile = {}
           tile[1] = "path.to.tile.image"
           tile[2] = "path.to.tile.image"
           tile[3] = "path.to.tile.image"
           tile[4] = "path.to.tile.image"
tilepick = math.random(1,4) -- you have "4" tiles
map = {tilepick,tilepick,tilepick
           tilepick,tilepick,tilepick
           tilepick,tilepick,tilepick
           4,4,4 }
User avatar
I~=Spam
Party member
Posts: 206
Joined: Fri Dec 14, 2012 11:59 pm

Re: Random Generated World

Post by I~=Spam »

If you want to use a seed just like minecraft where if you have the same seed it will always generate the same map, you would use perlin noise. I don't think I said that very well... Oh well. Anyway, here's some links: ;)

http://en.wikipedia.org/wiki/Perlin_noise
http://devmag.org.za/2009/04/25/perlin-noise/

Perlin noise has a lot of advantages... I am not expert but one of them is that you will get groups of about the same value. This makes it so that it is not entirely "random". If you were to make something similar to minecraft you want clusters of ore to form not just scattered in random places.

Here is a picture of perlin noise.

Image
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
ArterianGames
Prole
Posts: 11
Joined: Tue Apr 28, 2015 6:36 pm

Re: Random Generated World

Post by ArterianGames »

BigBadBeee, I didn't really do anything yet, I just made the simple functions, window, and a player image... I don't even know how to use the tiles... Anybody I could add on skype for help? pls? :D
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 117 guests