Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help making a voxel cube game (similar to cube world)

Discussion in 'Editor & General Support' started by Jackk_, May 3, 2017.

  1. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    49
    Hello, i have been wanting to make a voxel based game similar to cube world for quite some time now but everytime i try to develop one i lack the skills and discipline needed to make such a hard project. I am writing this thread in the hopes that i can maybe be pointed in the right direction or understand what the prerequisites that i will need to know in order to make this game, i have had little coding experience in C# but i am in the process of learning it. I wan't to make this game inside of Unity because I am not confident enough to make my own engine. I am feeling quite overwhelmed with what I've seen as i know the developer for cube world has quite a lot of programming experience and is able to code from scratch.

    Terrain Generation/Biomes:

    https://forum.unity3d.com/attachments/06-jpg.57949/
    I have done procedural generation before by utilizing others' scripts and implimenting them into my games, buti have never coded one from scratch by myself, i am hoping to achieve landscapes like those seen in cube world, but i lack the knowledge on seemingly simple tasks such as creating different biomes, trees, and the way the landscape changes color between those biomes using a shader. I do not want terrain generation like ones seen in AlexStv, as i have tried using it before and couldn't understand how to implement biomes and other things, my goal is to basically be able to code the procedural terrain generation and every part of the biomes etc. myself

    Fog/Lighting:
    I want there to be a sort of fog around the loaded chunks of the game so the game seemes more seemless unlike minecraft where you can see the chunks being generated. As for the lighting I am unsure of how to add effective lighting and shadows into this game and make it work with the terrain to create different colored grass and trees in biomes and integrate them smoothly

    Modeling/Animation:

    I have had quite a lot of experience in modeling but less so in animating so modeling the characters should be easy for my game but in terms of animation i do not know if i do that within unity by seperating the model up into each limb and animating it with code or having a premade animation, if someone could help clarify the best method of animating 3d (cubic)models for use in my game that would be great.

    SFX:
    I can make my own sounds so thats something

    HUD/Menus:
    I can make graphics for the HUD

    Conclusion:
    I am willing to put in hundreds of hours learning how to do and make all of these things but i am unsure where to start, my C# skills are, to quite simply put it, bad and i want to be able to understand how each of these components work and be able to make them in my game effectively. If anyone who has knowledge on things such as procedural generations which allow for overhangs etc. and multiple biomes or can just point me in the right direction in terms of learning how to do everything i need to make this game then please leave a comment.
     
  2. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    First, you'll be happy to know that Fog will be the easiest part; it's in Window≥ Lighting :)

    It sounds like you need experience in C#. You should do a few of the Unity tutorials (unity3d.com/learn/tutorials) to get experience with working in the engine.

    I can't stress this enough:
    DO NOT, DO NOT make your first projects too big.

    It is so easy to make the project grow into something you can't handle. I first started off trying to make an open-world multiplayer version of Burning Rubber 5, and that didn't go well for me, and the next 10 similar-sized projects I tried ended the same way: Either a rage-quit, terrible realization I'd need to rewrite every script because I didn't write them well the 1st time, lack of interest, or a feeling that completing the project is impossible.

    My advice is to do many small, unfinished projects for experience. Pick something you think you can't do, then do it. I've done this so many times and each time you learn something new. Try making separate aspects of your game first, instead of trying to make it in 1 go. First get experience with C# in general, then try generating a cube world, try animating a cubed character, try making a health/damage system. But don't try to make your first game a large project as you'll quickly become frustrated.

    So first get some C# experience before trying to make your own procedural generation system, specifically with stuff like arrays and lists and dictionaries and for and for each loops etc... That way you'll be able to write code independently and actually understand code when you see scripts someone else wrote.
     
  3. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    49
    Okay thanks Droidify, i want to start learning and getting C# experience but i dont know when to start, i watched some tutorials on how to program basic movement mechanics using C# within unity but it felt like i was just copying the code and i didn't really understand what i was doing, why i was doing it and why it had to be certain variables etc. do you have any recommendations for an absolute beginner at C# or methods of getting better other than setting a target and achieving it as it feels like i actually need some C# knowledge to do those things.
     
    Alv777 likes this.
  4. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Well, the extreme basics are simple, but aren't always presented easily.

    Here's some things that should help you:

    Variables: Variables are declared to hold data during runtime. To declare a variable, do this:
    public int MyNumber;

    For starters, you'll mostly be using int, float, string, List, bool. Also, adding [] after a variable (for example, int[]) creates an array, which is a completely separate topic.
    int: holds a number, for example:

    Code (CSharp):
    1. int MyNumber=29;
    However, it can NOT be a decimal, so 29.4 won't work.
    To have a decimal number, use a float, which will also do simple numbers.

    In summary with int/float, you can write 487 with a int, but you can't write 123.45. With a float, you can write both 487 and 123.45.
    http://www.tutorialspoint.com/csharp/csharp_variables.htm

    Functions: Ways of organizing stuff to do in code. To create a function, do this:
    Code (CSharp):
    1. public void MyFunction()
    2. {
    3.     //do stuff here
    4.     Debug.Log("MyFunction ran :D");
    5. }

    Unity has some special functions. As a beginner, you'll use void Start() and void Update().
    For example, if I write this:

    Code (CSharp):
    1. void Start()
    2. {
    3.     Debug.Log("This ran on game start!");
    4. }

    As soon as the game starts you'll see that message in the console. However, I can make it more complex:
    Code (CSharp):
    1. public int MyNumber = 5;
    2. public int MultiplyBy = 3;
    3. void Start()
    4. {
    5.     Debug.Log("This ran on game start!");
    6.     MultiplyNumbers(); //this will run this function when the game starts
    7. }
    8.  
    9. void MultiplyNumbers()
    10. {
    11.     Debug.Log("The multiplied result is: " + MyNumber * MultiplyBy);
    12. }
    Meanwhile, void Update() happens every frame of the game.

    That's the basics and I could spend an hour writing about C# here, but that's just a snapshot of how it works. Try writing something yourself; if you run into problems you can post a question on the Scripting section of the Unity forums and tag me (by typing @DroidifyDevs in the post so I'll be notified). We're all here to help! :D
     
  5. Jackk_

    Jackk_

    Joined:
    May 2, 2017
    Posts:
    49
    Thank you @DroidifyDevs, I understand the basics about functions, for and while loops, if and else statements, arrays and classes but i still don't know where to start making a procedural generated terrain similar to that of cube world.
     
  6. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    There are a few of nice voxel plugin assets on the asset store for reasonable price that might help you get started. . I wouldn't write a voxel engine from scratch unless you are pretty experienced. cubiquity https://www.assetstore.unity3d.com/en/#!/content/12689 is a nice one for terrains... but just search in the asset store for lots of options. ...but as mentioned before, I'd start with several smaller projects and tutorials first. if you dont understand the tutorials yet, dont move on to a big game project. Start changing and messing about with the tutorials after you finish each one to get the understanding of how things work. Good luck !
     
  7. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    I'll agree with @JonPQ , voxel engines are really hard to make so it's easier to use an asset, especially if you're inexperienced. And if you can't get it to work, don't worry, do something easier first to get experience and then come back to it.
     
  8. snortop

    snortop

    Joined:
    Dec 16, 2011
    Posts:
    194
    Last edited: Jul 17, 2017
  9. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    86
    tried it. it's unoptimised code and quite slow to be any use as it is.
     
  10. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    696
  11. mboog12

    mboog12

    Joined:
    Oct 4, 2011
    Posts:
    86
    Do you plan on implementing a minecraft-like lighting system? That's what I'm interested in and I'll buy it asap if it does.
     
  12. LaireonGames

    LaireonGames

    Joined:
    Nov 16, 2013
    Posts:
    696
    Yeah thats already in there :) Actually working on a lighting bug as we speak but yeah its got its own lighting system so if you go into caves its properly dark without using ambient tricks. It also mixes with Unity lighting so if you place a Unity light in there it will add its lighting on top of it