Just wondering about Minecraft

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Just wondering about Minecraft

Post by N64vSNES »

So most of you probably know I'm working on a Minecraft remake "Crafter" to get a bit of experience with 3D graphics.

I started work on it again today and I've been wondering for some time now, about the world and maps.

Here is a screenshot for illustration:
Image

In Crafter each block is considered a single element of a 3D array. I've read on Minecraft wiki the maps are 128x128x64? But either way this should work fine.

EDIT:
Crafter uses 256x256x64 at the minute and Minecraft uses 128x128x64, 256x256x64 and 512x512x64 depending on the version you're playing.

I could simply have a height map or something to generate this world but that would be kinda crappy since the original Minecraft actually randomly generates the worlds.

So I'm curious about how others would try and attempt to replicate the method Minecraft uses.

Thanks.
User avatar
Van-B
Chaos Rift Regular
Chaos Rift Regular
Posts: 125
Joined: Tue Aug 10, 2010 7:17 am
Current Project: iPhone puzzle game
Favorite Gaming Platforms: All - Except Amiga
Programming Language of Choice: DBPro, ObjC++
Location: Scotland

Re: Just wondering about Minecraft

Post by Van-B »

I would dig tunnels, in fact I've tried this with a little test engine and it works quite well. Once you have a solid world, maybe based on a perlin noise heightmap, you could take a random location under ground, and dig. If you scan the blocks near a start location and work out the distance to the start location, you can dig out spheres, then move that location each time, so dig out, move, dig out, move... each time changing the movement vector. Then you could randomly stop digging, or stop when there are no blocks to remove - so when the tunnel hits a larger area it stops. With lots of these tunnels, you would have a decent representation of what Minecraft does. The same technique could be used to set ore areas. When a tunnel breaks the surface, you could expand the radius by 1 to ensure a good cave entrance. Would be a good start I think.
Health, ammo.... and bacon and eggs.
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: Just wondering about Minecraft

Post by N64vSNES »

Van-B wrote:I would dig tunnels, in fact I've tried this with a little test engine and it works quite well. Once you have a solid world, maybe based on a perlin noise heightmap, you could take a random location under ground, and dig. If you scan the blocks near a start location and work out the distance to the start location, you can dig out spheres, then move that location each time, so dig out, move, dig out, move... each time changing the movement vector. Then you could randomly stop digging, or stop when there are no blocks to remove - so when the tunnel hits a larger area it stops. With lots of these tunnels, you would have a decent representation of what Minecraft does. The same technique could be used to set ore areas. When a tunnel breaks the surface, you could expand the radius by 1 to ensure a good cave entrance. Would be a good start I think.
That's a pretty cool idea man :)

I think I'm going to go with this method to be honest, it seems like my best bet to getting it as close to exact as possible. I was trying to split things up like

1- Get a random height, get a random radius, build hill with random data at random location
2- Get random crap again and generate a tree
etc

Needless to say it didn't work too well :lol:
User avatar
bnpph
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 75
Joined: Thu Mar 10, 2011 12:30 pm

Re: Just wondering about Minecraft

Post by bnpph »

janequorzar
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 42
Joined: Thu May 12, 2011 2:45 pm

Re: Just wondering about Minecraft

Post by janequorzar »

Perline noise is the way to go. Has been for years. And if you can do it dynamically on the fly, as notch is doing, then your good to go. I am doing something similar to mine once I get to that point. However, I am not remaking Notches version of minecraft, mine has "some" similarities.. but its not minecraft. Meaning I am making a real terrain, not made out of blocks. And as for infinite goes, notch is using 32 Bit which limits to about 2Billion. If you run it with 32Bit x 32Bit integers and split it up, then technically it would seem infinite. Its arrays within arrays. Then you save each section . chunk to the hard drive as you explore and it will be there when you come back to it. In theory it would take you a lifetime to travel through the whole thing. The drawback, that notch never figured a way around was the memory limits of computers. But look at it this way, clear the memory when the chunk is not in use. Notch's JAVA doesn't do this efficiently, which is why I am not really fond of JAVA, which is another reason he is doing it the way he is doing it. World of Warcraft does something similar as does EVE Online. You would be surprised at how simple it is and yet how VAST those two MMOs are if you have never been in them.

I am hoping to implement this into my game as well.

If you want to see what i'm working on, keep and eye on my you-tube as well as there is a download link to a demonstration of me starting this project. ( Started it last night. )

http://www.youtube.com/watch?v=7KUzCCoa ... ideo_title

Keep in mind, I started this last night and have slept since then.. lol

The video doesn't do the program justice. I have already advanced further then my video.

If I can be of service, let me know.. Take care. :-)
N64vSNES
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Thu Aug 12, 2010 11:25 am

Re: Just wondering about Minecraft

Post by N64vSNES »

Thanks for the great links guys.

No better way to learn than biting off what you can't chew ;)

I've tried really hard to replicate the way the maps are generated but it looks like perlin based noise map is definitely the way to go ( I believe Notch did this at first ) although I really didn't want to do it. Although Van-B's method did get a pretty decent looking map, I'm just very pedantic since I want it to look and play exactly like Minecraft.
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: Just wondering about Minecraft

Post by MadPumpkin »

Just like everyone else said, perlin noise is definitely what you should use. Minecraft generates it's terrain in columns. If you're not already, you should do the same. It makes it easier (my opinion) to generate terrain with caves already placed using an algorithm:

Code: Select all

FROM A SIDE VIEW MIGHT SHOW UP LIKE THIS (2D)
##########
#####   ##
###      #
#####   ##
and do each column from bottom to top/top to bottom.
Instead of first creating the land and then putting holes in it. But maybe that's just me. And since I feel like a dick by just saying "well I would do it this way", then I'll say HOW I would do it.

A hole would be randomly generated below a certain terrain height. Then the next column would decide whether this hole was going to get much bigger, and it would have possibly more "air" tiles. Then repeat with every hole, checking if each one has an adjacent air tile below a certain terrain height, and if not skipping the operation entirely, or making that one a hole. This is how I would go about it anyways, and so that caves can be in mountains and not just large underground chambers, also I would have the terrain height NOT check precisely whether it's beyond a certain depth, but relative to how many blocks are above it, this would make it so that large mountainous areas could still have caves.
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
Post Reply