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
    How to highlight the block. I already know which block to highlight.

    ;)
     
  2. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I create a new block at highlighted position just the way I would create a normal block there. This new block has the only face - the face the player points at. And this face, to be always visible, is moved slightly along its normal.
     
  3. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    But that's cheating! :)

    Thanks for the info, that certainly makes sense.
     
  4. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Any suggestions for how to handle displaying water?

    I figured the mesh would be built similar to the land except faces would be built both when exposed to air and when exposed to land.

    Each face would get a material applied to it that looked like water with some transparency. The lighting algorithm would work similar as on land.


    Then... I'm not sure where to start with a shader for an underwater effect for the camera when someone is submerged.
     
  5. HeadHunter2009

    HeadHunter2009

    Joined:
    Jul 3, 2012
    Posts:
    50
    Just enable fog and change it color to blue, and add density, then add some bubbles particles and you will have underwater effect.
    And enable all this when you touch water.

    Result:
     
    Last edited: Jul 8, 2012
  6. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I introduced a new block attribute, let's name it "stability". It supposed to help to determine if a construction is stable or it should collapse if a player does something with it. Stability is the direct opposite of sun light, it spreads upwards through solid blocks and decreases its value if spreads in other directions. Right now stability doesn't affect block physics but it will in the near future.



     
  7. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    hi,
    one suggestion:
    actually you use cross technique to simulate grass, its works well in front and semi-front view but in in top view, the model
    disappears. Maybe can you try to use 3 tilted planes as grass ? Here's a little example in attach:
     

    Attached Files:

    Last edited: Jul 9, 2012
  8. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    If one day you want to test moving humanoids in you world, I have a strange little creature for you.
    in the the attached zip, there is a running movie of him. If you are interested, I can send you the fbx with 3 states (running, idle and jumping/falling)
     

    Attached Files:

  9. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    FYI there is an article in GPU Gems about making moving grass that had a bit about how to arrange your planes to create decent grass. They used the "star" (3 planes) method and an "A" (3 planes) and grouped them close together randomly. It looked pretty good.
     
  10. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Thanks, that didn't even occur to me.
     
  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    maybe its this one,
    http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html
     
  12. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447




    Small angles make no difference, but big angles are just too big. Maybe, if I had more grass geometry it would look better.
     
  13. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    I read the article here:

    http://http.developer.nvidia.com/GPUGems/gpugems_ch07.html

    Pretty neat. I need to buckle down and just figure out how to make decent grass on my own.
    I notice they show the star design (with three planes intersecting in the middle), and the "A" design. I'm really curious to see which looks better overall.
     
  14. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Neither looks better overall. They look best together.
     
  15. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    Mass destruction


    UPDATE
     
    Last edited: Jul 15, 2012
    Deon-Cadme likes this.
  16. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    Pretty cool, Alex.

    How'd you get the Performance Counter data? Are you manually calling Profile or something?
     
  17. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
  18. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    You know, I saw that earlier in the thread, or perhaps it was at blokworld, but I didn't realize it was that useful. Cool.

    (btw I am making good progress on my engine in large part because of this thread and will post a video in a week or two)
     
  19. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Hi, guys. At least i did it: i finished reading all damned 56 pages of this thread :)

    I have a lightning problem: i'm playing with top-down camera, and different levels of blocks are looking as a plane.


    Should i use posteffects like SSAO, or play with shaders, or just bake a shadows into a texture... any recommendations on this field?
     
  20. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Whe's the download link? I'd love to play with this.
     
  21. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    769
    We cheat. We do Ambient Occlusion very cheaply like this: for every vertex, calculate the light of the 4 blocks above it and average them out. For the blocks that are solid, do include them in the average with light 0. Then use a regular vertex lit shader and pass that average as the light per vertex.

    This is the result:
     
  22. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    I'm dreaming to survive into this world. Is the world infinite and what about multiplayer ?
     
  23. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    2 SevenBits:
    Here you are: https://dl.dropbox.com/u/84293295/Terrain.unitypackage
    I decided to play with a top-down camera, with terrain slicing possibility. So i have each terrain's level = 1 chunk. Though, still need to calculate maximum level size.

    As i don't have down sides of cubes, every cube consists of 20 vertices. If limitation is 65.000, then i can have 3250 cubes per chunk, which means 57*57 cubes field. However, if 2 cubes are next to each other, they are using less than 40 vertices. So, i guess, i can try even 100*100 level (now it is 64*64).

    But lets get back to lightning :)

    2goldbug:
    Can you, please, make a screenshot with camera looking down on terrain stages? Like in my-case perspective.

    I guess, i found a post about it. Do you using same technic?
    http://forum.unity3d.com/threads/63149-After-playing-minecraft...?p=720575&viewfull=1#post720575


    2 all:
    Also, i found this example: http://mrdoob.github.com/three.js/examples/webgl_geometry_minecraft_ao.html
    But looking like even with AO, it has the same problem:


    Played a bit with it. Got an idea, why not to bake that AO shadows into textures?
     
    Last edited: Jul 23, 2012
  24. Sean Hall

    Sean Hall

    Joined:
    Apr 26, 2012
    Posts:
    192
    This all looks amazing, although I have not been following this thread. So Is this all on project or is this different people having a go to see what happens?

    I've played mine craft and this is allot better, so I was just wondering.
     
  25. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    It depends :)

    Some guys like goldbug had finished development and making money on it.
    Other guys like me are just playing around with block world due to inspiration and free time :)
     
  26. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    I have two generators. First one generates an infinite terrain, and the seconds one generates an island of arbitrary size "in the middle" of an infinite ocean.

    Right now it's a single player engine. If there will be multiplayer, it will be for several persons only with full trust to the players. People should trust each other when they have to survive. Or there will be no multiplayer, I haven't decided.

    There are issues with block physics and mass destruction I have met:

    1. Construction strength is often a counter-intuitive thing. Even I, the person who knows the calculation rules, can't always predict if the construction is to collapse, and even if I know it is unstable, I can't always predict which blocks and how many of them are to fall. Imagine, you build a roof for your new house, you place a new block and suddenly all the roof collapses. You have to clean up the construction site, build an additional supporting column inside the room, start building the roof from scratch, and hope it will not collapse again (but it surely will :).

    2. [to be continued]
     
  27. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    There's a link somewhere in this discussion thread regarding lighting that goes into detail about what goldbug said. It's very detailed.
     
  28. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    I had to rotate the way I was drawing blocks in my mesh as some of the UVs were being drawn on in the wrong direction
     
    Last edited: Jul 24, 2012
  29. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    769
    There are multiple engines here. The OP has the minepackage, and he made it available for free

    Alexzzzz's is very impressive. He pushes the limit of what is possible to do with a block engine. I must confess it scares me a little to think what could happen when he finally releases a game. I am kind of glad he is not targeting mobile :)

    Block Story (HeadHunter and myself), is fully developed and being sold right now in amazon appstore and Google Play, and soon in other places. We don't focus so heavily on special effects for the block engine as Alexzzzz's since we are targeting android devices. Instead our focus is on speed and on gameplay.

    We do have some unique features, like infinite up and down, with different terrain generators at different heights (floating islands, caves, hell, Forgotten Sky, Moria). And we do have colored lights (Alexzzzz had them first). This was built by a fan and it shows what colored lights can do for you. Our water also looks extremely good.

    There are others which seemed very promising, but they don't seem to be quite so active anymore. If you search through the thread (I know it is very long), you can find them.
     
    Last edited: Jul 23, 2012
  30. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    769
    I'll do something better. Here is the webplayer version. We don't keep it up to date, since we are making no money on the webplayer version, but you can see how the cheap AO looks.
     
  31. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Damned, i played your game for dozen minutes, and forgot about what i was looking for :) But then game crash and i recalled, what i was going to do :)

    Anyway, looking like that at certain camera angles you have the same problem.


    But using AO greatly improves quality.
     
  32. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    Anyone know how to get rid of these lines in between blocks?

     
  33. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Take a look at uv mapping stage - there should be epsilon value, play with it a bit
     
  34. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    2 goldbug: are your multiplie lights also made with vertex coloring?
     
  35. Ravart

    Ravart

    Joined:
    Mar 9, 2011
    Posts:
    42
    @alexzzzz

    Thanks for the hint!

    My work got the better of me the last two weeks, so i hadn't much time to develop my minecraft further.
    Still there are two good things. My GUIInterface and InputListener Libary is nearly ready to go beta.

    Second, I thought about a Occlusion algortithm for blocks, means only viewable blocks are shown.
    Required Blocks are loaded on the run and added to a matrix. Therefore I wont need to load/unload different clusters.

    Well I hope I can show you soon my work!
     
  36. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    Thanks, changing the epsilon fixed it
     
  37. botumys

    botumys

    Joined:
    Apr 16, 2009
    Posts:
    707
    If you plan multiplayer, I have an little idea about sharing creations.
    It would be great to create a kind of auction house with blue print. For example:

    I build a house somewhere in my world and I want to share it. In the game, I define the house's bounding box by placing little sticks around it. The game detect automatically to upper top limit. I enter in the blue print auction house and upload the schema, I can choice a price too. Other players can now choose my house in the list, pay the price (gold or materials) and place the house in their world.
     
  38. caldrin

    caldrin

    Joined:
    Dec 4, 2011
    Posts:
    127
    all these are looking really good :)

    Alex you really need to look into multiplayer simialr to minecraft if you could pull it off i think you would have a massive hit on your hands as well as your stuff looks awesome :)
     
  39. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    769
    Yes, AO, smooth light and colored lights are all part of the same thing.

    For each vertex I calculate an average RBGA value from the 4 blocks on top. I use the alpha channel as sunlight which is always white. Light changes smoothly from vertex to vertex by the regular interpolation that video cards do.

    I wrote a specialized shader for doing the work, including treating alpha as sun. The result is not only visually appealing, but fully hardware accelerated dusk/dawn and about 5-10x the framerate that MC gets in the same hardware.
     
  40. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    Does anyone know how to implement the 'cracks' that show on blocks when mining in Minecraft?

     
  41. Foam

    Foam

    Joined:
    Jun 13, 2012
    Posts:
    322
    You can do it with a shader.
     
  42. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447
    2. Mass destruction requires a huge amount of calculations:
    ― Create separate game objects for blocks that are to fall.
    ― Remove those blocks from the chunks they are inside, recalculate lighting, then rebuild the terrain, grass, etc meshes.
    ― Allow the block objects to fall.
    ― After the blocks have hit the ground, add them to the chunks, emit dust particles, recalculate lighting, rebuild the meshes.
    ― Destroy the block objects.

    Some of these tasks may run in background, others must run in the main thread. Some tasks depend on others, some don't. The task manager becomes very complicated.
    ― It must strictly control the order the tasks are executed in.
    ― It should be able to join multiple block manipulations into a minimum number of new tasks.
    ― It should be able to skip the tasks that are to do the same work several times in a raw.
    ― It should support task prioritization.
    ― It should provide the lowest possible latency but not affect FPS too much.
    ― And it's almost impossible to debug.
    Update:
    ― The most important point: the code still has to be readable and maintainable.

    Mass destruction is a very heavy stress test that my task manager can hardly stand. Writing a decent task manager has been hard from the very beginning and I'm still not happy with it.
     
    Last edited: Jul 26, 2012
  43. Duskling

    Duskling

    Joined:
    Mar 15, 2011
    Posts:
    1,196
    Its just a texture that loops with a UV offset over time
     
  44. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Just wondering about speed of chunk generation. This 60*60*1 chunk generation takes 0.05 sec, is that okay?


     
  45. alexzzzz

    alexzzzz

    Joined:
    Nov 20, 2010
    Posts:
    1,447


    64x64x64 chunks, but almost flat terrain with no mountains and no caves. 17000-18000 vertices, 8000-9000 triangles per mesh. i5 2500K, 4GHz.

    28.66 milliseconds in average for creating lists of vertices, uvs, etc
    plus
    7.80 milliseconds for creating a mesh object and assigning it to a MeshFilter component.

    0.05 sec looks close but flat terrain is not a very interesting case.
     
  46. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Thanks, man, for fast answer + it is almost my case. So, there is nothing to optimize. :(

    Flat terrain is not interesting indeed, but i have other problems: in my case, one chunk is one terrain layer, but it is needed to update one (sometimes even dozen) chunk(s) as fast as possible.

    Now i'm considering making some prediction, which chunk would be used next + thinking about threading: to throw vertex/coloring routine to another thread and finalize chunk building in main thread.
     
  47. ImogenPoot

    ImogenPoot

    Joined:
    Jul 2, 2012
    Posts:
    214
    So you are not actually using PhysX for falling blocks? That would make the task much easier :)... I have to admit that seeing your block demo for the first time intrigued me to upgrade mine ^^. The falling blocks really count for something. Just that I'd need to do this with PhysX, which is hard, since you often can't reconnect blocks when they hit the ground... But probably I will wait for a later development state, to implement this.
     
  48. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
  49. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    769
    Yes. This is a video I made last year:



    It looked great. We don't do it today because we sacrificed it for moving into mobile. We may very well add it back for when we deploy to desktop or for high end mobile devices.
     
  50. VeTaL

    VeTaL

    Joined:
    Jul 2, 2012
    Posts:
    125
    Indeed. So how are you managing with tangents? Just running the same algorithm as in that link?
     
Thread Status:
Not open for further replies.