Difference between revisions of "Talk:Game Design Unity Infinite Terrain Generation Part 1"

From ShieldKings Wiki
Jump to: navigation, search
(Created page with "12 Comments on “Infinite terrain generation in Unity 3D – Part 1” Pingback: Recursos para desarrolladores | Ibuprogames Kujo 19 July 2015 The tutorial...")
 
m
 
Line 1: Line 1:
 
12 Comments on “Infinite terrain generation in Unity 3D – Part 1”
 
12 Comments on “Infinite terrain generation in Unity 3D – Part 1”
  
     Pingback: Recursos para desarrolladores | Ibuprogames
+
     Pingback: [http://www.ibuprogames.com/2015/07/16/recursos-para-desarrolladores/ Recursos para desarrolladores | Ibuprogames]
 +
 
 
     Kujo
 
     Kujo
 
     19 July 2015
 
     19 July 2015
 
 
     The tutorial was explained great, but in the downloaded project there is a scripting error in NoiseProvider.cs (16,49) “Type ‘Perlin’ does not contain a definition for ‘GetValue'”
 
     The tutorial was explained great, but in the downloaded project there is a scripting error in NoiseProvider.cs (16,49) “Type ‘Perlin’ does not contain a definition for ‘GetValue'”
  
 
         kulesz
 
         kulesz
 
         27 July 2015
 
         27 July 2015
 
 
         Strange – do you have LibNoise files in the project (they are already attached in rar archive)? Eventually is “using LibNoise.Generator” added in the NoiseProvider class?
 
         Strange – do you have LibNoise files in the project (they are already attached in rar archive)? Eventually is “using LibNoise.Generator” added in the NoiseProvider class?
 
 
 
     Dominik
 
     Dominik
 
     21 July 2015
 
     21 July 2015
 
 
     That’s very nice tutorial, thank you. :) When do you plan to release next part?
 
     That’s very nice tutorial, thank you. :) When do you plan to release next part?
 
 
 
         kulesz
 
         kulesz
 
         27 July 2015
 
         27 July 2015
 
 
         I’ll try to finish it in the first half of August – if time allows :)
 
         I’ll try to finish it in the first half of August – if time allows :)
 
  
 
     Pingback: [https://dineshramitc.wordpress.com/2015/07/22/part-1-infinite-terrain-generation-in-unity3d/ Part 1: Infinite terrain generation in Unity3D | Dinesh Ram Kali].
 
     Pingback: [https://dineshramitc.wordpress.com/2015/07/22/part-1-infinite-terrain-generation-in-unity3d/ Part 1: Infinite terrain generation in Unity3D | Dinesh Ram Kali].
  
 
     Pingback: [http://www.synchronical.net/2015/07/camera-improvements-further-testing-design-process/ Camera Improvements & Further Testing – Design Process | Joseph Riches]
 
     Pingback: [http://www.synchronical.net/2015/07/camera-improvements-further-testing-design-process/ Camera Improvements & Further Testing – Design Process | Joseph Riches]
 +
 
     chan
 
     chan
 
     26 July 2015
 
     26 July 2015
 
 
     Nice tutorial. I followed it all the way till I managed to reproduce it myself. However, original source code still have some parts missing (e.g. in TerrainChunk class only “Position” is assigned and values “X” and “Z” are not – this gives zeros when running CreateTerrain() method there and terrain is spawned always on (0,0)).
 
     Nice tutorial. I followed it all the way till I managed to reproduce it myself. However, original source code still have some parts missing (e.g. in TerrainChunk class only “Position” is assigned and values “X” and “Z” are not – this gives zeros when running CreateTerrain() method there and terrain is spawned always on (0,0)).
 
 
     Another thing is that it has very large number of separate files, which is very hard to follow if one or another file is set incorrectly. I managed to copy everything (including LibNoice classes) into a single file, which can be copy-pasted, dragged onto game objects and “versioned” much easier than such large project. Rewritten script is here:
 
     Another thing is that it has very large number of separate files, which is very hard to follow if one or another file is set incorrectly. I managed to copy everything (including LibNoice classes) into a single file, which can be copy-pasted, dragged onto game objects and “versioned” much easier than such large project. Rewritten script is here:
 
     https://dl.dropboxusercontent.com/u/248943005/InfiniteTerrain/TerrainGenerator1.cs
 
     https://dl.dropboxusercontent.com/u/248943005/InfiniteTerrain/TerrainGenerator1.cs
 
 
     In order to use it, you only need to have camera in the scene and drag the script on any GameObject.
 
     In order to use it, you only need to have camera in the scene and drag the script on any GameObject.
 
 
     I did this as I realised that currently procedural terrain generation is tricky question and what was trickenning me was that I was unable to simply reproduce any kind of procedural terrain generation myself. I also keep usually number of files as low as possible, because when building larger games, amount of files becomes unimaginably large (try to imagine adding forests, sounds, weather, day-night cycles, multiplayer, UI, game mechanics, etc.).
 
     I did this as I realised that currently procedural terrain generation is tricky question and what was trickenning me was that I was unable to simply reproduce any kind of procedural terrain generation myself. I also keep usually number of files as low as possible, because when building larger games, amount of files becomes unimaginably large (try to imagine adding forests, sounds, weather, day-night cycles, multiplayer, UI, game mechanics, etc.).
 +
    Anyways, it’s quite good tutorial.
  
    Anyways, it’s quite good tutorial.
 
 
 
         kulesz
 
         kulesz
 
         27 July 2015
 
         27 July 2015
 
 
         In you code X/Z properties are not needed – they are redundant with the Position property which includes them.
 
         In you code X/Z properties are not needed – they are redundant with the Position property which includes them.
  
 
         As for the large number of separate files I cannot agree – the golden rule is to keep one class in a single file, it helps to keep it clean and easier to maintain. Especially for large projects (which my tutorial is not).
 
         As for the large number of separate files I cannot agree – the golden rule is to keep one class in a single file, it helps to keep it clean and easier to maintain. Especially for large projects (which my tutorial is not).
+
 
 
             chan
 
             chan
 
             28 July 2015
 
             28 July 2015
 
 
             There are some other strange things there. e.g. how did it come solution for
 
             There are some other strange things there. e.g. how did it come solution for
 
             steepnessNormalized = Mathf.Clamp(steepness / 1.5f, 0, 1f);
 
             steepnessNormalized = Mathf.Clamp(steepness / 1.5f, 0, 1f);
Line 57: Line 47:
 
             P.S. Isn’t there possible to use some Perlin noise function, which would take and use for calculations only 2 arguments (I guess 3rd argument for y axis only drains performance).
 
             P.S. Isn’t there possible to use some Perlin noise function, which would take and use for calculations only 2 arguments (I guess 3rd argument for y axis only drains performance).
 
             P.P.S. Wouldn’t it be better to use coroutines and WaitForSeconds, which allows more friendly solution for FPS rates when new chunks starts to be loaded?
 
             P.P.S. Wouldn’t it be better to use coroutines and WaitForSeconds, which allows more friendly solution for FPS rates when new chunks starts to be loaded?
+
 
 
                 kulesz
 
                 kulesz
 
                 30 July 2015
 
                 30 July 2015
 
 
                 As for steepness – I’ll explain it in another part. Generally speaking steepness from Unity is relative to terrain size and resolution, so several approaches may be fine for this (just like the one you mentioned).
 
                 As for steepness – I’ll explain it in another part. Generally speaking steepness from Unity is relative to terrain size and resolution, so several approaches may be fine for this (just like the one you mentioned).
 
                 2D Perlin functions could be available – LibNoise is attached as a source code so you may take a look at it. I may be able to do it in the upcoming days.
 
                 2D Perlin functions could be available – LibNoise is attached as a source code so you may take a look at it. I may be able to do it in the upcoming days.
 
                 WaitForSeconds and coroutines could be added in several places, especially when new chunk is created. As for heightmap generation separate threads are still better and faster solution.
 
                 WaitForSeconds and coroutines could be added in several places, especially when new chunk is created. As for heightmap generation separate threads are still better and faster solution.
+
 
 
                     chan
 
                     chan
 
                     30 July 2015
 
                     30 July 2015
 
 
                     Well, I would probably do these things, which runs on runtime in Coroutines, as the most important thing during the game play is if the game doesn’t get laggy. Player usually don’t care very much if tile is made faster or slower – the point is that the tile creation wouldn’t lag the whole game.
 
                     Well, I would probably do these things, which runs on runtime in Coroutines, as the most important thing during the game play is if the game doesn’t get laggy. Player usually don’t care very much if tile is made faster or slower – the point is that the tile creation wouldn’t lag the whole game.
  

Latest revision as of 22:25, 28 November 2015

12 Comments on “Infinite terrain generation in Unity 3D – Part 1”

   Pingback: Recursos para desarrolladores | Ibuprogames
   Kujo
   19 July 2015
   The tutorial was explained great, but in the downloaded project there is a scripting error in NoiseProvider.cs (16,49) “Type ‘Perlin’ does not contain a definition for ‘GetValue'”
       kulesz
       27 July 2015
       Strange – do you have LibNoise files in the project (they are already attached in rar archive)? Eventually is “using LibNoise.Generator” added in the NoiseProvider class?
   Dominik
   21 July 2015
   That’s very nice tutorial, thank you. :) When do you plan to release next part?
       kulesz
       27 July 2015
       I’ll try to finish it in the first half of August – if time allows :)
   Pingback: Part 1: Infinite terrain generation in Unity3D | Dinesh Ram Kali.
   Pingback: Camera Improvements & Further Testing – Design Process | Joseph Riches
   chan
   26 July 2015
   Nice tutorial. I followed it all the way till I managed to reproduce it myself. However, original source code still have some parts missing (e.g. in TerrainChunk class only “Position” is assigned and values “X” and “Z” are not – this gives zeros when running CreateTerrain() method there and terrain is spawned always on (0,0)).
   Another thing is that it has very large number of separate files, which is very hard to follow if one or another file is set incorrectly. I managed to copy everything (including LibNoice classes) into a single file, which can be copy-pasted, dragged onto game objects and “versioned” much easier than such large project. Rewritten script is here:
   https://dl.dropboxusercontent.com/u/248943005/InfiniteTerrain/TerrainGenerator1.cs
   In order to use it, you only need to have camera in the scene and drag the script on any GameObject.
   I did this as I realised that currently procedural terrain generation is tricky question and what was trickenning me was that I was unable to simply reproduce any kind of procedural terrain generation myself. I also keep usually number of files as low as possible, because when building larger games, amount of files becomes unimaginably large (try to imagine adding forests, sounds, weather, day-night cycles, multiplayer, UI, game mechanics, etc.).
   Anyways, it’s quite good tutorial.
       kulesz
       27 July 2015
       In you code X/Z properties are not needed – they are redundant with the Position property which includes them.
       As for the large number of separate files I cannot agree – the golden rule is to keep one class in a single file, it helps to keep it clean and easier to maintain. Especially for large projects (which my tutorial is not).
           chan
           28 July 2015
           There are some other strange things there. e.g. how did it come solution for
           steepnessNormalized = Mathf.Clamp(steepness / 1.5f, 0, 1f);
           ? I used
           steepnessNormalized = steepness / (90f*Settings.Height/Settings.Length);
           which gives approximately half/half of area for steep and flat textures.
           P.S. Isn’t there possible to use some Perlin noise function, which would take and use for calculations only 2 arguments (I guess 3rd argument for y axis only drains performance).
           P.P.S. Wouldn’t it be better to use coroutines and WaitForSeconds, which allows more friendly solution for FPS rates when new chunks starts to be loaded?
               kulesz
               30 July 2015
               As for steepness – I’ll explain it in another part. Generally speaking steepness from Unity is relative to terrain size and resolution, so several approaches may be fine for this (just like the one you mentioned).
               2D Perlin functions could be available – LibNoise is attached as a source code so you may take a look at it. I may be able to do it in the upcoming days.
               WaitForSeconds and coroutines could be added in several places, especially when new chunk is created. As for heightmap generation separate threads are still better and faster solution.
                   chan
                   30 July 2015
                   Well, I would probably do these things, which runs on runtime in Coroutines, as the most important thing during the game play is if the game doesn’t get laggy. Player usually don’t care very much if tile is made faster or slower – the point is that the tile creation wouldn’t lag the whole game.
                   I would probably do threading stuff more for editor approach, as there are no such thing as FPS rates. It’s also the best thing for simulations, when you simulate heightmaps (especially with more features, like erosions) and save them into files, which are just loaded during the game play.
                   I was recently thinking to apply xxHash random numbers (http://blogs.unity3d.com/2015/01/07/a-primer-on-repeatable-random-numbers/) which should give better randomisation – it has also function with two coordinates input. But at the moment I can’t find out properly how LibNoise is dealing with octaves, which defines sizes of mountains.