Search Unity

Question about the engine/voxel terrain!

Discussion in 'Editor & General Support' started by nielscorn, Jun 16, 2011.

  1. nielscorn

    nielscorn

    Joined:
    Jun 16, 2011
    Posts:
    5
    Hello,

    First let me start by saying, i already tried the answer page but i would rather have a discussion about this than 1 simple answer, thank you for understanding.

    So me and a couple of friends(we have already started on some basic coding) are determined to make a minecraft-type game but with better graphics and basicly just smoother terrain and not the gigantic blocks that are in minecraft... (even if this doesnt get finished, it's a fun project)
    Now i know this engine does not have voxel terrain and uses hightmap so the things i want the game to do will not work with the current setupup, however, i wish to ask if it's in any way possible to get the same effect or to get a voxel terrain in this engine?

    what we want it to be able to do:

    - realtime ingame manipulation of the terrain(use a power/force/tool to dig in the ground(in a smooth manner and first person)Example of how it should kinda work bu then in first person
    - the realtime ingame manipulation of the terrain ofc also includes lava,water,sand,etc...

    the main thing is the terrain manipulation like in 'from dust' but then in a first person perspective and with the intent of mining, digging, collecting, etc like in minecraft.
    Is this at all possible?

    Would this even be possible in multiplayer?

    Please discuss, i'd really love to hear your opinions and if maybe this is possible to do in the engine or maybe there is an addon so voxel terrain does work in unity engine? or maybe something different but with the same effect?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Yes, basically you'd use the Mesh class. And a lot of work.

    --Eric
     
  3. steego

    steego

    Joined:
    Jul 15, 2010
    Posts:
    969
  4. nielscorn

    nielscorn

    Joined:
    Jun 16, 2011
    Posts:
    5
    Hmm.... so if this is to be done, what would the end result be? Would it enable multiplayer gameplay? or would that make it extremely laggy?

    Basicly if i understand correctly, minecraft is just a huge blocky 3d game i would like to make but i want the cubes about 100 times smaller or even more?
     
  5. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    thats not going to work out with blocks 100 times smaller as that means 100*100 more blocks that need to be kept up to date, thats even heavy to impossible for a local lan multiplayer but for sure totally impossible for an online game
     
  6. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    531
    If you use voxel terrain with Marching Cubes, you don't have to have 100x the voxel resolution of MInecraft... that WOULD be next to impossible, since you'd have 100^3 times the amount of voxels for each given chunk of terrain.

    Now, the beauty of Marching Cubes, is that the voxels are not blocks as in minecraft. Each voxel contains a mesh that will fit that area precisely, based on the neighboring voxels.

    Going into details about the implementation would be quite a lengthy thing... So my best suggestion is that you read up on how Marching Cubes works, and try to learn as much as you can about it.

    Minecraft is a deceivingly simple game... it looks so simple on the surface, but once you start analyzing how it does things, you start to see the huge complexity it has under the hood.

    Anyways, best of luck!

    Cheers
     
  7. nielscorn

    nielscorn

    Joined:
    Jun 16, 2011
    Posts:
    5
    So with these marching cubes, would the actions i described be possible? destroying and modifying the game in realtime at will?

    - Would it also be able to randomly generate a map(with the layers predefined where some ore/elements can be found, like 20% chance to create a pocket of coal between layers 10-20)

    randomly generated maps are just for the future but lets say i have this scenario:

    Made a map relatively deep and with a hill, would it be possible to go digging in the ground, in the hill etc to make realistic holes with the marching cubes?
     
  8. cerebrate

    cerebrate

    Joined:
    Jan 8, 2010
    Posts:
    261
    Marching cubes is a method, as described on the (as linked by steego) wikipedia page if you read it, of how to turn a 'voxel map' into an actual mesh. It has nothing to do with 'randomly generated maps', which would be the realm of modifying the information contained in the voxel space.

    so yes, it would make 'realistic holes' (in a sense, nothing would break off and fall though).

    Funny enough, most people don't know we've already had a marching cube script since forever:
    http://www.unifycommunity.com/wiki/index.php?title=MetaBalls. Figure out how to get that to work with a 3d array that contains the voxel information,and you're golden.

    The 'randomly generated map' part is up to your own doing. Notch has, in regards to minecraft, probably used some kind of 3d perlin function.
     
  9. nielscorn

    nielscorn

    Joined:
    Jun 16, 2011
    Posts:
    5
    Cerebrate, any chance i can find some guides or anything how to implement this into unity or anything that would help me on my way?
    i'm a little bit overwhelmed and have no idea where to start with the marching cubes... Anything to get me started or to get me on the right track :/?

    Would be very appreciated!
     
  10. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    You dont have to focus on multiplayer (massive) part that much. Minecraft isnt massive in general gameplay, if you are able to get 4 players system working thats enough in my opinion. If you make your terrain mesh with low triangles and good LODs you wont have performance problems.
     
  11. cerebrate

    cerebrate

    Joined:
    Jan 8, 2010
    Posts:
    261
    Well, I would just read the marching cubes page on wikipedia, it does a pretty god job of explaining it. Additionally, that metaballs script on the unity wiki pretty much everything done for you.