Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Another unique idea, another pile of "how?" questions. Sand in Unity?

Discussion in 'General Discussion' started by NoctisShadowzel, Sep 21, 2019.

  1. NoctisShadowzel

    NoctisShadowzel

    Joined:
    Dec 27, 2018
    Posts:
    57
    I want to make a Hyper-casual mobile game about making sand-castles. Now while thinking about this, a few approaches came into my mind. But let's talk about game idea, firstly.

    I want to build a game based on building sand castles. I want it to be similiar to real life, I even thought about how controls are going to work, you take a bucket, fill with sand, turn it facing ground and pull the bucket; voila sand shaped like bucket... You stack them, make a castle. Maybe games goal will be -make highest tower possible-?

    New items will be unlocked; a shovel, water area, hair dryer, sculpting tools, new areas etc.

    Now the problem comes... How to simulate sand in Unity, how to approach this problem?
    I heard about meta-ball, it was used in games like Where Is My Water?, but since my game is 3D I don't know if this will work.
    I heard about voxel based terrains too, can something like it used for this? Sand is at ground, you fill your bucket by moving it in sand, put it on ground to make a bucket shaped structure from sand? But I don't know much about this topic; if you think this will work for my problem, can you point me in right direction (What I must learn, where to find best information)?

    What will be your best advice for developing this kind of game? What will be alternative solutions? (Like making game based on VFX completely, but still get a sand-pool to play around?)

    Can you give me some ideas?

    PS. I want to point out something; every time someone comes with something different, people only give reasons to not make that idea real. At some point, someone is going to come with a product which implemented what I want. I just don't know what to do; I'm amateur in this field, I want to learn magical things people do - so I can do mine real. If you can point me towards some destination, I am open to ideas.

    TY for taking time ^^!
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    I would ask, if you made any building type game / prototype before. If not not, I suggest make one, completely ignoring sand related element. Lets say, make something simple like basics of minecraft building mechanics.

    That could give you strong food hold, to going toward sandy mechanics.

    There is somewhere asset, which makes blocks building like minecraft, look smooth (curves etc). Maybe that will give you some ideas.
     
    Socrates likes this.
  3. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    Which is it then, are you looking for someone to help out with ideas on how this could be done, or are you looking for someone to tell you how to do it the way you want to do it, despite your admitted lack of experience? At first I thought, "oh there are much simpler ways to do this than meta-balls, and voxels", and then I saw your PS.

    You want to learn magical things. Magic, in real-world cases (not fantasy), is misdirection. It deceives the eye. It makes you think you are looking at one thing (meta-balls, voxels), when in fact the magician is doing something else. By telling the magician, "I want to know how you do this, but I want it to be magical and not mundane," you put them in a difficult position. That's what it seems you are doing, unless I'm misreading (which is entirely possible and not unlike me).

    Added later: Here's my own PS. Look, I understand it's annoying when you ask something and then everyone kind of goes in opposite directions and you're like wtf? and just want to know how to do what you want to do. I get it. Just not sure what to make of your post is all.
     
    Last edited: Sep 21, 2019
  4. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    did you make the ball roll yet?

    it's a cool idea, but doesn't sound like beginner appropriate. Make 100 simple games first. Several years of work, depending on your time/work ethic.
     
  5. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    This, have you made anything in unity yet?

    If not then your PS at end of your post means not much, because everyone is going to say the same thing: learn unity first, then you can worry about trying to make magical things like a realtime sand simulation.
     
  6. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    6,008
    Unlike many people on these forums, I am not averse to giving someone advice on something outside their experience level. I don't consider it to be up to me to tell someone where there limitations are (unless they ask me directly).

    However, you need to clear up your question. I can't tell if you're asking for game ideas, implementation ideas, or both. Nobody is going to sit down and work out the optimum combination of a game idea that works, and a complete tutorial on how to implement it, just for you. It's up to you to figure out exactly what you want, and then if there's something useful on the internet somewhere that seems applicable, people will point it out to you.

    So if you don't want to catch a volley from the 'start at the beginning' crowd, at least show that you know what you want. That way, even if you run into a brick wall, someone else googling the topic can use the information. No clear topic, no useful thread.
     
    Ryiah likes this.
  7. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Obi Fluid might be able to solve it for you, but the sand will be more like water than sand :D You can probably get a viscosity closer to sand if you bump up the iterations. But that will kill performance on mobile and low end PC
     
  8. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    So much do sand castle building :p
    but sure, I see use of fluid mechanics, just to make game look nicer.

    Eitherway, just had a thought, that simplest sand castle building mechanics, can be executed, using dense hightmap.
     
    MadeFromPolygons likes this.
  9. NoctisShadowzel

    NoctisShadowzel

    Joined:
    Dec 27, 2018
    Posts:
    57
    @Antypodish @BIGTIMEMASTER @GameDevCouple_I I was working with Unity3D for around 10 months. I know it isn't much when compared to some of you. Many of my projects was to learn. I have 12 not-completed project, because projects were a little big for me. Anyway, yes I know Roll-A-Ball. I wrote this thread, because I want to learn; what I need to learn - in order to build my idea. I'm still learning, and I'm just asking what I must learn - what do you know that I don't know; so you can give advice to me. I don't know which part of my post made you think I want you to build my idea for me. (Maybe PS. confused readers... I wrote that because, I don't want to hear, hey this is a little hard or maybe work for more and come back - tell me what am I missing so I can't build my idea so I can learn. Isn't purpose of this forums is to learn?)

    Anyway, thank you for suggestions. If this topic is not what it is intented to be, please delete it for me.
     
  10. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    We all learning. Is never ending journey. But asking what we know that you don't know, is quite vague.

    You should draft your concept, and measure, if you got all principles, which will allow to make your dream game.
    I gave you two possible approaches. Minecraft like, and hightmap. From that point, you need investigate either of these topics and beyond.

    Is no point going into more detail, if for example you don't understand minecraft blocks mechanics, or what is hightmap and how to implement it (even in theory). And no one knows what you know, unless you tell us. But there is tons of materials and subject on the net about either.

    So far you told us about 10 months journey, and few unfinished prototypes. That puts us at the point, you understand editor. And probably some of c#. One thing you should know, don't focus on graphics, before you got actual some mechanics working. Once you got mechanics, you will know, what you need, to make it look better.
     
    MadeFromPolygons likes this.
  11. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    Off the top of my head a fast way to prototype this out to get a base which you can build on would be:

    Heightmap like @Antypodish mentions, along with say a particle effect for pouring sand. You could use the heightmap to affect a mesh and as particle reaches floor adjust heightmap.

    Alternatively you could use marching cubes or marching tetrahedrons but it wont look smooth and perfect. Nothing is going to look smooth and perfect without a lot of work though so these are decent starting points.

    You will likely want to use a compute shader and/or job system to help speed this stuff up.

    Alternatively you could go with fluid dynamics such as obifluid as mentioned earlier in thread by others, however its not very performant and I am not sure how it would work for your use case, but its worth a go also.

    Personally I would use a combination of marching cubes + job system and/or compute shader to make that system fast. And then for the pouring sand I would use a particle system, and have the mesh build up using marching cubes. You could then use a sand texture with normal map and additional maps on the marching cubes mesh to look like nice-ish sand and in realtime add / subtract sand from it. To make the sand actually move around however you would need fluid dynamics - thats a big task and I dont have the time to walk you through that but lots of tutorials exist on the internet.

    Sand is a lot harder to do than say snow, given that sand also behaves a bit like a liquid in terms of physics such as pouring it. You should maybe try starting with snow first instead? Doing a snow build up shader is pretty easy and will be easier to get dynamic snow set up instead of sand. Then you can try and do sand next if your able to do that first.
     
    QFSW and Antypodish like this.
  12. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    What about voxels, there are plenty of Unity voxel topics and assets. It would look minecraft like unless you use very small voxels*. But they tend to have most of the features that you need with sand e.g. destructible/buildable.

    *Or run a marching cubes or marching tetrahedrons algorithm over the voxels, or have diagonal cut voxels to smooth the sides a bit.
     
    Last edited: Sep 26, 2019
  13. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    738
    Fluid Particle Simulation + Marching cube might do the trick.
    You can then change the viscosity for the wetter sand particles, and use containers to form the sand realistically.

    This is even more possible if the game is in 2D. Overall less particles to simulate, cheaper XY axis only simulation, and you can use smaller particle from all the free space you get from not simulating 3D particles.

    Obi Fluid has everything you need to do this.

    Good luck!
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    To make a sandcastle building game on mobile one needs to consider the following factors ignoring monetisation decisions:
    • it performs well, so the sandcastles and sand are all just 3D models
    • you want it to play reliably so it'll have some kind of grid
    So forget about simulations, it's not necessarily as much fun as the building of sandcastles etc.
     
  15. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,977
    Exactly what I was trying to say, but more succinct.
     
  16. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328


    Close enough? Runs on Switch. That counts as mobile, right? Incidentally, the guy behind the game's tech now works at Unity.
     
  17. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    No, it very much does not count as mobile. Mobile counts as mobile, switch is a mid range console. You cant really compare it to a mid range phone.
     
  18. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    True, a flagship mobile is better than a Switch :D
     
    OCASM likes this.
  19. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Author of Claybook's engine is absolutely brilliant. Astonishing work.
     
    Ryiah, MadeFromPolygons and OCASM like this.