Search Unity

After playing minecraft...

Discussion in 'General Discussion' started by jc_lvngstn, Oct 8, 2010.

Thread Status:
Not open for further replies.
  1. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Sorry. I didn't even use indentation! Whoops.


    Code (csharp):
    1.  
    2. struct Node:
    3.     child_nodes as (Node)
    and

    Code (csharp):
    1.  
    2. public struct Node {
    3.     public Node[] child_nodes;
    4. }
    5.  
    are equivalent. "variable as (type)" is syntax for array declaration of type "type". Syntax for classes is the same as structs, basically:

    Code (csharp):
    1.  
    2. class Node:
    3.     child_nodes as (Node)
    4.  
    is equivalent to

    Code (csharp):
    1.  
    2. class Node {
    3.     Node[] child_nodes;
    4. }
    5.  
     
    Last edited: Mar 2, 2013
  2. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    /edit found some mistakes :eek:
     
    Last edited: Mar 3, 2013
  3. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    Can anyone provide, or know of a link for a short tutorial on how to use the TQueue.cs and TList.cs in the sample projects on this thread?
     
  4. Pixelblock Games

    Pixelblock Games

    Joined:
    Oct 25, 2012
    Posts:
    20
    Download isn't working :( This really sounds awesome!
     
  5. rocky1408

    rocky1408

    Joined:
    Nov 28, 2012
    Posts:
    3
    hi guys,

    I developed little games with unity3d and after I played minecraft a long time i found this thread and followed all concepts and yet I am developing a own voxel explore game. I wrote a little bit code I tested it and a friend of mine which have a bigger monitor sent me this picture :http://img3.fotos-hochladen.net/uploads/screen3v6ax40jk27.png (background had red lines and they were shown only in startup settings good or better) I have searched a few days, but i don't find the problem. today I remembered this thread and I would ask you if you have an idea what the problem is. thanks a lot, greetings rocky1408
     

    Attached Files:

    Last edited: Mar 13, 2013
  6. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    I think the problem you're having is called "pixel bleeding". It has to do with the texture atlas. There are some posts about this problem here in this thread, but you might find solutions or workarounds somewhere else if you google for it
     
  7. rocky1408

    rocky1408

    Joined:
    Nov 28, 2012
    Posts:
    3
    thanks, I have a little more space beetween my textures in the atlas and it worked. I hope it was the right thing to do
     
  8. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
    Some of the textures are so far away, that a very high mipmap level is selected. The mipmap level selected is so high it is blending many of your textures in it. as wasstraat mentioned, this is called "pixel bleeding", there really isn't a perfect solution for it

    Some workarounds:
    * Make the textures bigger, and only use a portion of them. The problem will still be there, but will happen farther away.
    * Add some transparent space between your textures. The problem will still be there but much less noticiable.
    * Hide the problem with fog
    * Write your own shader, clamp the values of ddx and ddy and pass them to the texture sampling function to force the video card to use a higher level mipmap. This will not work on mobile.


    The proper solution would be to use texture arrays instead of atlases, but unity does not support those.
     
  9. Gurc

    Gurc

    Joined:
    Jul 9, 2012
    Posts:
    43
    I had seen something called octree. Maybe he is using them. There were game engines using octrees, but they did not get popular.
     
  10. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
    Last edited: Mar 15, 2013
  11. Riebulka

    Riebulka

    Joined:
    Mar 16, 2013
    Posts:
    7
    Can i help somehow?
     
  12. Riebulka

    Riebulka

    Joined:
    Mar 16, 2013
    Posts:
    7
    Can I contribute to the project? I can do a medium programming in C#, I know how to model. I'm really surprised this project. Respect For everyone!!!
    So Yes or No.

    Thanks.


    Riebulka, Lithuania
     
    Last edited: Mar 16, 2013
  13. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792
    Minecraft has other ways to craft an item too. Some items require a specific order, some are allowed to be mirrored and others are allowed to be scattered across the table. But all recipes can be placed anywhere on the table as long as they still fit.

    Axe/Bow/Fishing Rod = Mirrorable
    Stew/Book = No specific shape

    Technically recipes for things like swords and pickaxes are mirrorable but are symettric to begin with so recipes like that may fall under the same category.

    I prefer the Terrarian method though, no need for a crafting grid. It's just a list of craftable items and how much resources they require.
     
    Last edited: Mar 16, 2013
  14. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
    Mirroring is ver easy to do with my algorithm: when you generate the string for the user input, instead of generating 1 string, generate 2 strings: the first one is left to right top to bottom, and the second one right to left top to bottom, and lookup both. The overal performance order of the algorithm is the same.

    I also do have the no specific order matching for dyes. If you add snow and dye regardless of shape, you get colored snow. This is also very simple to do: generate a 3rd string, but sort the items by some criteria (alphabetical works just fine). Then have a second hash table where the no shape recipe codes are also sorted. I go much further than that with dying, but this would work just fine for the soup example.


    Minecraft PE also has this, they call it MATIS. It is a piece of cake compared to grid crafting. I suppose it is a matter of preference. I find multitouch to be particularly well suited for grid crafting, since one way to do splitting in our game is to touch and hold a stack with one finger and touch an empty slot with another finger.
     
  15. Riebulka

    Riebulka

    Joined:
    Mar 16, 2013
    Posts:
    7
    hello????
     
  16. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    This thread is not about one single project. It just discusses the different techniques and approaches of voxel terrains and people sometimes showing the progress of their personal project.
     
  17. Nightmare Games

    Nightmare Games

    Joined:
    Sep 5, 2012
    Posts:
    201
    Do you or any one else where to get the minecraft kit for unity? I saw it somewhere here but cant find it
     
  18. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    There are several packages out there, but I'm using and modifying the one jclvngstn made:
    http://sourceforge.net/projects/minepackage/files/
     
  19. Riebulka

    Riebulka

    Joined:
    Mar 16, 2013
    Posts:
    7
    ok.... :(
     
  20. Nightmare Games

    Nightmare Games

    Joined:
    Sep 5, 2012
    Posts:
    201
  21. Nightmare Games

    Nightmare Games

    Joined:
    Sep 5, 2012
    Posts:
    201
    FINALLY, I got it! If any one wants to get it, save yourself the time and download it here:

    DOWNLOAD
     
  22. adamascj

    adamascj

    Joined:
    Apr 22, 2010
    Posts:
    55
    Sorry if I am in the wrong thread. I did a little game in the Minecraft-style, using the free Cubic World kit. It is a mix of single and multiplayer (using the free Photon Cloud server ). Let me know if it's working.

    http://www.dmu.com/mine
     
  23. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792




    The maker of FortressCraft seems to have ditched XNA in favor of Unity3D, most likely due to XNA no longer being developed any further by Microsoft. It looks pretty good so far, I just wish my engine was that fast!
     
    Last edited: Mar 23, 2013
  24. rocky1408

    rocky1408

    Joined:
    Nov 28, 2012
    Posts:
    3
    hi guys,

    sry but i have the next problem. if i go to far from origin i become white lines between the chunk meshes and the meshes moves very silly. i think it has to do with the precision of the unity coordinate system. i know that unity has a problem with precision beyond 100k at each axis. instead of an infinite world i want to go from -100k to 100k. but with this problem i can't go more then 2k in each axis. i know that i can shift the meshes at the origin when i'm leaving generated chunks and generate new chunks, but i would play my game with 2-3 players and i don't know how to sync that. i hope you can help me again.

    greetings rocky1408
     
  25. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    This is our first public display of the work we have been doing for the last 6 months. This video simply focuses on the random dungeon generator in action. Stay tuned for more info on what this game is about. Expect Random Item Generation, Random Weapon Generation, Random Quest Generation. Basically, we should have named this game "The Big Random". Our goal is to bring a new game to you, every time you pick up KonCraft and play it.

    I posted this here as well as WIP since I learned a lot over the months from this thread however we do not use minepackage at all.

    Hope you enjoy this demo:


    More dungeon room generation examples:
     
    Last edited: Mar 27, 2013
  26. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    Last video of external dungeon being posted. This time, it's mega fast. While watching, realize this is visual representation of a dungeon inside of a block world. Each room can have many things, such as mobs, items, breakable blocks, puzzles, etc:

     
  27. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792
    @rickyhenry
    That's a nice looking generator you've got there! I'd love to try making my own level generator using a minecraft-style terrain generator I've been developing.
     
    Last edited: Mar 31, 2013
  28. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
    Just an update on some things we have been up to.

    First we added rivers, jetpacks, and diver suit:


    We also did some serious improvement to the jungle biome:


    For pc, we added normal mapping



    Which make the terrain look more 3d and with bumps

    And we also added specular light, meaning that some things like gold and crystals will reflect light:


    We added dropbox integration, so you can sync between pc and mobile
    We added the capability of creating multiple characters
    We now have exploding tnt, tree farming and acid.


    We also rewrote the terrain shader for mobile using glsl which gives a very nice fps speedup in mobile.

    and a lot more stuff that wont fit here.
     
  29. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    @GibTreaty thansk for the kind response. I went through a lot of different mine package sources and basically had to buckle up and settle with the fact that none were designed in a way that would work without noise or in other words, every voxel system out there is more or less based around the usage of some sort of noise algorythm for complete and utter chaos. I essentially had to write my own noise system in a round about way in order to achieve the ability to randomly place objects underground in their correct spot and build out the rooms as well as the flow of the dungeon. However, it is not based on a noise such as PerlinNoise, more or less a conditional script with a lot of conditional statements =D.

    In essense, the entire terrain is generated first. I then proceed, based on where the user is, to calculate a random underground dungeon where the maximum is at the top of the terrain at all times in my particular case. The calculation occurs only if the start of a new dungeon room is located within a column of chunks that the user is within a radius of. Once the dungeon is calculated, (all blocks requiring model placement or what not are calculated along with it), my world builder determines what should spawn at that location. If it is a spawn block (1 of 50 different spawn types at the moment), then delete the block and place a prefab there, or delete as many blocks as the model requires and then place the model there. Such as a door model, might require removal of a 3x3 section of blocks before being placed. Any other empty blocks are just carved out. The blocks that make up the outer walls of the dungeon are built using a layering system. In the layering system, I have set biomes (used for different dungeon levels as you progress) and also set the ability to choose what blocks go where as well as random blocks. For instance, see the screenshot below and notice the floor and walls.

    This entire dungeon generator could be used in a full voxel block world as well since that is essentially what we are going to do with this after the game is built. In the end, this dungeon will be a lower "mini-game" within our full voxel world on top.

    A view from inside and on the ground
    $dungeon_Image1_tn.jpg

    A view from above looking down at the generated dungeon
    $dungeon_Image2.jpg

    Another view from above
    $dungeon_Image3_tn.jpg
     
  30. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
  31. agriffin

    agriffin

    Joined:
    May 10, 2012
    Posts:
    20
    Hi guys! I have a question!

    Sometimes between my chunks I can see a sort of seam as if they were not aligned correctly (although they are). It is most noticeable when the camera is moving and the chunks are dark and the sky is bright such as in a dark tunnel. Does anyone have a solution to this? I am thinking I may have to overlap the edges of the chunks slightly.

    Thanks!
     
  32. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    i've seen this problem discussed in this very thread before. You are going to have to search through this thread, but it is IN here. Also, I think this only applies to MinePackage if that is what you are using. If so, I recommend moving to something else like the projects found on unitycoder.com's blog about voxel systems: http://unitycoder.com/blog/2012/10/18/voxel-resources-engines-for-unity/
     
  33. agriffin

    agriffin

    Joined:
    May 10, 2012
    Posts:
    20
    Thank you for the reply! I've read this whole thread before and thought I saw it too but I wasn't sure! I'll have to see if I can find it!

    I'm not using MinePackage, I made mine from scratch and the issue appears even in the most basic example.. :( I did find a semi-solution though: the seams only appear when I have my chunk gameobjects at the chunk position. For example, chunk (0, 0, 1)'s position would be (0, 0, 16) for 16x16x16 chunk. However when I have all chunk gameobjects remain at (0,0,0) and instead offset the vertices to the chunk position the seams are no longer there.

    I am not sure of all the consequences of doing this though. If I use some sort of LOD that relies on the distance of the gameobject it would probably be an issue.

    Nice work on your dungeon generator! Very cool!
     
  34. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    Searching this thread is a nightmare. I've found that going into the little known "printview" will allow you to search much more faster! I downloaded all pages from print view, then combined them into one webpage on my computer. Now, I just open up the page, Press CTRL+F for something I want to find, and i get instant results:

    http://forum.unity3d.com/printthread.php?t=63149&pp=100
    This link produces 16 pages instead of 77 pages

    thanks for the comment on the dungeon generator!
     
  35. GenericGame

    GenericGame

    Joined:
    Nov 26, 2012
    Posts:
    206
    Two new videos, this time showing where the minecraft style engine plays a part in our game. Even though the game is not focused on block breaking or placing, it is part of the actual gameplay. These videos are just made to show the speed at which the system works. One is short version, but I also recorded 20 minutes of gameplay if you care to watch the longer version:

    Short Version:


    Long Version:
     
  36. Leviathan6785

    Leviathan6785

    Joined:
    Apr 24, 2013
    Posts:
    1
    minecraft has a lot of things that is implemented into it. graphics just dont matter. Its constantly generating new terrain, mobs, and structures. This game may not be so fast because of this
     
  37. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    I sincerely apologize if this was already answered somewhere in the 70+ pages of this thread, but I'm trying to set up my own Minecraft-style rendering system in Unity (well, except it's very finite, but otherwise very Minecraft-y). I'm having difficulty with lighting. I have a direct lighting system working and operating fairly speedy - getting a solid 80FPS when digging/recalculating - but I have no clue how to set up more Minecraft-style light - where it "leaks" into surrounding cells. I tried a 15-pass approach but that turned out to be very slow indeed. Any tips for more speedy lighting?

    EDIT: Seems my direct lighting is a bit slower than I thought... when I'm digging a LOT my FPS goes down to 30-40. Argh.

    My hunch is this has to do with how much raw data I'm iterating over - rather a huge amount of it

    EDIT 2:
    Nevermind
    I ported over the lighting engine from the Cubic World package and after a few hours of hair-pulling non-progress I finally got it working perfectly - and it's reasonably fast (If I dig REALLY fast, it goes down to 70FPS, but that's not too bad - and I saw the same thing in the original Cubic World project, so not sure if I can really fix that)
    I could also reduce chunk size to make it a little faster.
     
    Last edited: Apr 24, 2013
  38. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
  39. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Nice read, haven't heard of fbm before, unless you're refering to simplex noise generated at different frequencies and amplitudes, creating different layers of detail. Looking forward to more blog posts :D


    What package are you exactly talking about? the one jc_lvngstn made? I'm having trouble with the lighting too
     
    Last edited: Apr 26, 2013
  40. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    767
    Yes, evaluating a noise function (does not have to be simplex or perlin) at different frequencies and amplitudes and adding the result together is called fbm (Fractal brownian motion). From your comment, it looks like you were familiar with the algorithm, just not the name.
     
  41. Enka2012

    Enka2012

    Joined:
    May 2, 2013
    Posts:
    8
    Hi guys! Does anybody know how to save the generated chunks in order to reload the map with all the modifies the player does?
     
  42. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    The way I do it is somewhat comparable to what your trying to do. I'm not saving them to disk, but I am sending them over the network for a multiplayer game and seems to work very well.

    I added BatchGet and BatchSet methods to my Chunk, BatchGet returns a byte array of all block IDs in the chunk (which is convenient in my setup because block ID is represented with a single byte, provides a direct 1:1 mapping between byte and block). BatchSet takes a byte array and runs through the entire chunk assigning the block IDs.
    So in my current setup when a new player connects to the game I'm calling BatchGet, sending the byte array over the network along with chunk XYZ, and on the receiving end calling BatchSet and then recalculating lighting. It would be pretty trivial to just save that info out to a file, so that when loading the world back I find the chunk at the stored XYZ, call BatchSet with the stored data, and then recalculate lighting (I could very well have stored lighting information to avoid recalculating, but I'm lazy :p)

    If your world is randomly generated, I also suggest storing the seed for that world. Another thing you could do (and probably should) is keep a flag on each chunk that determines whether that chunk was modified after it was generated. When a block is changed it flips that flag to true. So you only store chunks that have changed, and the rest can be re-generated from the world seed.
     
    Last edited: May 2, 2013
  43. Enka2012

    Enka2012

    Joined:
    May 2, 2013
    Posts:
    8
    Ok, thank you very much! Just a quick question! Till now i have used a package made by someone else that contained a lot of things and I modified, but I'd like to start to a simpler one, so that I can understand better how it works. Do you have any suggestion? How did you start? Thank you so much! :)
     
  44. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Mine is mostly made myself, although I'm far from totally understanding everything so I did scavenge a ton of scripts from someone else's package (Cubic World or something), mostly for lighting and physics.

    The very first thing I did was just get a single chunk rendering. This article helped a great deal:
    http://codeflow.org/entries/2010/dec/09/minecraft-like-rendering-experiments-in-opengl-4/
    The basics of it is, when you're generating the mesh for a chunk you loop over each solid block. For each potential cube face, drop in a quad if the neighbor is an air block (later you might also check if it's transparent or non-solid such as a fence)
    In my own code, I also decided on having some kind of BlockRenderer class that would handle rendering a single block. By default my chunks use the SolidBlockRenderer which does what I just mentioned, but I could just as easily drop in a FenceBlockRenderer class if I wanted fences. Possibly store a default SolidBlockRenderer to use, and a dictionary of block type -> block renderer (when rendering a block, if dictionary does not contain block type, uses SolidBlockRenderer)
     
  45. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    792
    I learned, like a few of you have too, that assigning to the Mesh Collider is the main cause of lag. I had only just realized that a couple weeks ago. I'm making progress on my mesh optimizer though!

    Before Optimization
    $1 16x 16x16 Before.png

    After Optimization
    $2 16x16x16 After.png

    Currently supports one block type. I'm now working on a way to account for multiple block types. Shouldn't be too hard as I've gained some experience in making submeshes which will be somewhat similar for what I'm imaging in doing for this.
     
  46. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Yes, assigning mesh colliders turned out to be the main bottleneck in mine, what I eventually settled on was a custom physics solution "inspired from" (essentially copied over from) the Cubic World package. A few physics bugs here and there, and no real complicated simulations, but I can live with that.
     
  47. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Here's a minecrafty question: Is anyone working on multiplayer, and what are you using / would you use? A lot of the popular choices like Photon seem based on the dev owning the servers and the servers not handling much game logic. For a minecraft game, you'd want the players to be able to host their own dedicated servers and I'd imagine you'd want an authoritative server that handles all the game logic and actual voxel representation. I'd also think that, like Minecraft itself learned the hard way, you'd want to design it so that the single player game basically was a client connected to an internal server, so that you don't have to duplicate the game logic for single player vs multiplayer. It seems being able to use Unity itself (in headless mode) for the server would be best. Would you use Unity's builtin networking then? Or uLink? Something else? It seems like Photon would be useless for this, or am I misunderstanding Photon?
     
  48. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    I think that heavily depends on how your multiplayer is set up. If it's a semi-persistent world (Minecraft style where the server stores game saves and players can build up their settlement over days or even months) you probably want a persistent server. Look into Lidgren (which will allow players to host their own servers)
    In my game, it's not persistent at all. You load up a predefined map, a bunch of players join and you shoot each other, and every round the map resets (no changes to the map persist, ever). In this case, Photon Cloud was completely sufficient for me. The hardest part was really getting the state of the world to newly connected players, basically the master client (deemed by the cloud-hosted server) is in charge of grabbing all modified chunks, zipping up their state and sending them to the new player.
     
  49. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Also: Does anyone know what the license is on CubicWorld? Those textures look like they were ripped from Minecraft, so that's suspicious, also I haven't seen the author actually say anywhere whether it's public domain or GPL or something else...
     
  50. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Thanks! My game's not a fully voxel world like Minecraft but it does let players build things out of cubes, and I'd like players to host their own persistent world servers. I'll have a look at Lidgren and see if it would do what I need. I started some really basic multiplayer using Unity's builtin networking, but the general opinion seems to be that Unity's is the worst choice in almost all situations. Hmm.
     
Thread Status:
Not open for further replies.