After playing minecraft...

Beezir…this is pretty awesome of you. Thank you.

wow that’s great! Thanks a lot, i will check that out and add it to my current project :smile:

I think if someone becomes the next notch with that, you would get a big pile of money hehe.

@Beezir

Good thing I decided to try doing that after our chat and before you released that or I’d have never learned anything :slight_smile:

Neat to see how you did it, especially how to properly seed the Simplex Noise. I was having trouble with it (I even tried changing the bit patterns like you did but I used the Unity random number gen, didn’t work out very well) and decided to switch back to Perlin. I ported the perlin section of libnoise and oddly perlin runs for about 80% the time of simplex, I was a little puzzled but I think it might have to do with the reference implementation being made to play nice with electrical engineers’ brains.

Thanks for releasing that to the community, I’m sure there’re tonnes of little tricks in there for us to discover.

Cool! Although, i’m glad i’ve managed to escape Minecraft…

What method is used to generate the landscape? I see you mentioned Simplex Noise and perlin…is there a specific name for the method used to generate the landscapes?

I just used the noise algorithm (simplex in my case) to determine density and a second pass to carve out caverns. Then I generate meshes based on that data using standard unity functions.

I don’t know much about Simplex Noise so i was wondering if it’s possible to keep a “static seed” or whatever so everytime you run the game, it would give you the same level?

Yep, that’s no problem. Saves a ton on storage space too, since you’d only have to save the seed and any changed blocks. :slight_smile:

So, in my current design, I’m trying to generate the landscape (which should be pretty quick.) I’m currently storing my block DATA (not the visual representation or prefabs) in chunks made up of 16x16x128 blocks. The world “map” is made up of 32x32 chunks, which gives me a total world of 512x512x128 blocks.

So, creating the world DATA isn’t that big a deal, it’s real quick.

However, when I do a pass to initially determine visible blocks, I’m just drawing a prefab block at those locations. As you can expect, creating a new instance of a prefab, heck even a cube primitive, is slower.

REAL slow. And generates quite a bit of gameobjects for unity. If I drew every block in just ONE chunk…I’d be creating and drawing 32,768 instances of a block in unity. Granted, I’m only drawing the outer blocks because of visibility testing, but still. It’s a lot of blocks. Just one side has 2048 blocks. The thing I like about this approach is, it lets me just create a block with a collider and assign materials, instead of having to generate meshes, work with uvs, etc. It’s more intuitive to me (easy), but it seems to cost too much to create these in unity.

So…looking at Beezir’s approach of creating a mesh from the visible faces of the blocks in each chunk seems to be a very good approach. It’s a little less intuitive for me, but mostly because it means I have to get into the nitty gritty of actually creating the mesh, working with the normals, etc.

Also, I like the idea of breaking down chunks into 16x16x16 blocks, instead of 16x16x128.

Any thoughts on this? I think I already know the approach I have to take (Beezir’s), just wondering if maybe anyone else had any thoughts or suggestions.

PS: One reason I wanted to take the prefab/block approach was, I’d like to be able to use irregular objects instead of just blocks. I guess both approaches would work with this, though.

In my own code I take a similar approach to Beezir, but I store faces in six lists: top, bottom, left, right, front, back. Only the three possibly visible sides are enabled for rendering. I think this might be the approach that Notch took but I’m not certain.

I’ve tried different chunk sizes and methods of storing/accessing chunks (ie: linked lists vs List<List>), and I found that the few chunks you have on screen the better. For instance, having a chunk size of 16x16x256 with a world size of 16x16x1 runs much faster than a using chunks of size 16x16x128 with a world size of 16x16x2 and faster by roughly a factor of 2 or 3 than using 16x16x16 chunks on a 16x16x16 world or even a 16x16x8 world.

I also found that digging on 32x32x128 chunks causes an FPS hiccup and 16x16x128 doesn’t, but the 32x32x128 chunks give a higher non digging framerate. So from my experience there are a TON of tradeoffs going on.

For not so blocky blocks, you could look into Marching Cubes or Marching Tetrahedrons. I’ve heard they can create more geometry though and with MC you’ll have to find fixes for the ambiguous cases.

Taintspore, that’s interesting about the performance difference with different chunk sizes.
You mentioned lists…one thing I am doing is using a 32x32x1 array of chunks, for the visible world. Each chunk contains 16x16x128 blocks.

To locate a particular chunk for any block, I just divide the block x world position (0-511) by 16, that gives the the chunk “X”. I do the same with the block Y location to get the chunk Y.
This means I can access any chunk pretty much instantly, given the block location. When I move into a new chunk boundary, I just do a quick slide in the opposite direction with my main chunk array…and since all am doing is changing references to my chunks, it’s pretty quick with a 32x32 array.
Any thoughts on this approach?

As far as non cube blocks…I was thinking of more natural landscape formations. For example…a single rock column, taking up only one block, would just have a mesh sort of like a stalagmite. It seems like it would work the same, I would just have to have some soft of post-process on the terrain to intelligently say “Here is a rock corner…just put a corner here” or “here is a rock column, use the stalagmite mesh” instead of just using blocks. Not sure if that makes sense of not. It would definitely take more resources, but it should be interesting to try it out. It might be a neat way to have a more “natural” landscape, but still give the ability to be generated, mined, and expanded on.

Regardless…I’m thoroughly enjoying this conversation. Thanks for contributing, all.

@Beezir, great, i just tried giving the System.Random the same seed once a new level was created and it works perfect, it generates the same level over and over again. So i also added a saving system that only saves changed chunks indeed and applies it to the world after it got generated.

I guess i will have to change it to a 16x16x128 chunk size too, cause if you increase the blockViewDistance in Beezirs code, it takes quite a long time to generate the world and loading a new row makes your fps drop down to 20 too (depending on your machine).

And yes, Notch also uses the 16x16x128 version, his world isn’t higher so it actually makes sense.

This is the best thread ever here on the forum hehe. I can’t wait to see all the “clones”, seems like many people try something like that.

I just realized though that the minecraft fanbase is really rough to people who try to make simliar games, i just saw it on Cubelands videos, or on the minecraft forum.
I guess a lot of them don’t even know that minecraft is a clone from infiniminer, and notch also mentioned that in one of his very old youtube videos where minecraft was called “the cave game”.

Competition is good, it can make minecraft better and gives people more choices. If the games have different systems, that is great too. I am planning on doing a loto f things different from minecraft. Sure it will have simliar stuff like the materials, gathering, etc, but i already created some fun new systems that puts the game into a different categorie.

Honestly, I was a little hesitant about posting my interest in a minecraft clone. Snobbery exists everywhere, and often you’ll get see the response “Why don’t you make your own game, instead of just copying others?”

Thing is…I love Minecraft, and I think imitation is the sincerest form of flattery. It’s really inspired me to give something similar a shot. Look at the huge Tower Defense genre…at the huge variety there is now. Besides…since Notch isn’t working for me to implement the changes I want…might as well do it myself :slight_smile:

Regardless…I’m still curious about the chunk sizes, specifically the depth. It seems like you should be able to have both infinite Height, Width, AND depth to the maps.
Anyway…as soon as I get done with “work”, I’ll get a chance to work on it some more.

That sounds pretty similar to the way I do it at the chunk level. Actually I quantize space the exact same way. I used the face lists on a per chunk basis and I’ve discovered it’s actually slower than just having one mesh per chunk (I was trying to avoid sending the back faces to the gfx card but I underestimated my 8800). I’m guessing it’s slower because i was sending more meshes.

The problem with that is going to be figuring out when you’ve got a column or not, if you used marching cubes or a derivative it should automate the process.

In regards to minecraft and cloning. Making a voxel based world doesn’t mean you cloned minecraft, otherwise all polygon based (rather than sprite based) RPGs copied, let’s say Ultima Underworld. Ignore the high and mighty’s, if nothing else it’s fun nd you’re giving yourself a leg up for when hardware can better handle large numbers of voxels.

I’ve got a question about the meshes themselves: I always end up with three vertices per triangle, I’ve tried using mesh.optimize() but it doesn’t seem to work. I looked at beezir’s project and it looks like he gets roughly a two to one ratio. I’ve gone looking for info on creating triangle strips and i could probably do it manually, but in the docs it says optimize is supposed to do that on it’s own. There a trick to using it?

As far as mesh.optimize(), I’m a bit inexperienced there. I’ll likely end up using that approach, eventually, maybe I can be more help after I get that experience.

I was worring about people hating me when i want to create a “minecraft” clone.

But thinking about it, and i can just repeat myself, minecraft itself is a clone from Infiniminer. Noone complained about it (at least i never saw someone complaining about it), it’s just that minecraft got so famous that everybody hates “rip offs”.

If you add nice new features and have more than a classic minecraft mode, people will rethink about it and wont complain so much.

Noone hated people when they try to do a zelda clone, or super mario or a xyz world war shooter.

Nobody speaks against a sandbox game that allows you to build and destroy and using blocks is just the only reasonable way about it.

after all, infiniminer, minecraft etc are all “clones of Lego” reasonably seen and lego is a clone of old wooden brick based toys.
so nothing wrong about.

you will only be hated if it is a 1 : 1 clone instead of something with a similar concept.
also minecraft kind of tries to even favor that as the development pace of the alpha isn’t exactly stunning for a few hundred thousand USD win the past months. it still progresses as if it was a single dev in sparetime … so there is definitely a massive vacuum present which the first one with the dedication, staff and pace will fill, whoever that is will make some happy happy cash.

but one has to keep in mind that competing with minecraft isn’t exactly trivial as its modding and community are its strength. it will take you potentially too long to compete even anywhere reasonably with it.

@dreamora, i kinda agree with your points, i am not a big fan of this “who was first and who made a rip off”.
I think if people try to adopt a game idea, they can create something new and more interesting.

Also yeah, notch is kinda lazy, selling ~30.000 copies in 24 hours but skips several weeks of updates. He hired people now so hopefully it gets a bit faster.

@Taintspore, it’s interesting you get a better framerate with 16x16x128 chunks. I just changed beezirs code to use that kind of chunks but everytime i need to load new ones, the frames drop to <20. Well it kinda makes sense cause now it has to generate 16x16x128 chunks at once per frame so this slows it down quite a lot.

Maybe if i change it to 6 arrays as well could solve this problem. But i dunno, maybe i need a different system, hmpf.

@Kiyaku: I’m not sure what is causing the lag, I’ll have to look at Beezir’s code (those tests were with my own).

At the moment mine doesn’t create new chunks as you wander but mesh generation after a dig op is really fast. Voxels tend to be pretty CPU intensive, especially since we can’t do them using cuda or openCL (at least as far as I know).

I tried increasing the visibility range of Beezir’s system from 50 to 200 and I had to kill the process, from my tests with using multiple lists per chunk unity likes it much better when there are fewer chunks.

Anyway, like i said, when imget a chance I’ll take a look and see if I can figure out what is causing the difference in performance.

It might be the noise function, Beezir’s simplex looks the same as mine so I think we got it from the same place and I found that implementation slower than the perlin found in libnoise. I think it’s because be that Perlin’s reference implementation for Simplex was written for hardware and that the libnoise perlin noise is optimized for software.

I still haven’t managed to get mesh.optimize to work either. I know the algorithm is suboptimal (to make it go faster) but It’s can’t be this bad, I’m going to try to reorder the way the mesh is constructed to give optimize (lol, just realized that optimize is suboptimal) a better chance at creating triangle strips.

Well i tried to remove the Simplex Noise function, it is a bit faster then but still not really good.
I also used a higher viewdistance (100), it takes quite some time at the beginning cause he creates all gameobjects for all chunks you can see in that 100x100x100 view and then generate the mesh. After that its faster so its okay if you just load for a while at the beginning to generate the world.

But when it tries to replace the next row for you (beezir doesnt create new chunks, he just moves the gameobject from the row behind you to the row infront of you and recreate the mesh), it slows down a lot.

So you use 16x16x128 chunks right? What do you do to create the voxels per chunk, do you have 3 loops for X, Y and Z size and check if there is a cube, if yes, create the mesh?
That’s what beezir does too (and i did that in a previous script too) but that’s the point why it’s so slow. He also has to check if the current cube is touching another one, if not, you need to create the faces.

What exactly is your optimize problem? Maybe i can help, it seems to work nice in beezirs exaple too.