top of page
Writer's pictureKane Adams

Critical Evaluation

For the Procedural Content Generation assignment, an algorithm currently utilised within the games industry was to be researched, have an implementation developed, and add complexity to take the project further. In the terrain generation project's final implementation, these criteria were achieved as two different algorithms were utilised.

The first algorithm implemented was Perlin noise to create the shape of the mesh used for the terrain. Perlin noise is a simple algorithm that does not warrant praise; therefore, complexity was added through fractal noise. The fractal noise algorithm is an alteration to Perlin noise where multiple Perlin noises with the same offset, but different frequencies are generated and layered on top of each other to cause the terrain to become more detailed.


Another added complexity that also showed the understanding of the algorithm was the use of chunk generation to create multiple meshes that were connected and could be travelled between without issues, this being done by setting each chunk with an offset. Chunk generation is the area that could use the most improvement. Ways to improve chunk generation involve researching ways to generate more chunks as the player progresses through the world as currently all chunks are generated when the scene is first being loaded, which can cause long loading times. A starting point for researching endless terrain generation would be the Sebastian Lague tutorials.


The second algorithm implemented was Poisson Disc Sampling. This is a procedural object population algorithm where it will generate usable points to spawn objects by checking that all points are a minimum distance away from each other. The algorithm was implemented to spawn trees and rocks around the meshes on different chunks with the use of raycasts to check whether a tree can be placed in that height region. This algorithm performs well, and should more objects be added, the algorithm will be able to handle spawning different objects as well as trees, being tested through the spawning of rocks. Ways to improve this algorithm would be to look at trying to get as many valid points as possible with the least number of attempts to reduce runtime.


Ways to add complexity to the main game scene is to utilise some of the algorithms for different purposes, one example is using the Perlin noise algorithm to create animated water. Currently, the water is a plane with a translucent material which leads to the next point of the use of shaders to improve the visual quality of the project. Shader graphs use a node system to create the colours and visuals and can also use a gradient scale to determine which shaders are used at different height values, very similar to the simpler method used of a colour gradient. Despite the mentioned improvement through shaders, the inclusion of colour gradients vastly improved the look of the game.


Along with the main game, a customise world option is available where the player can input a seed of their choosing and change the colours of the different terrain segments. The inclusion of the seed generation allowed the use of the Linear Congruential algorithm which is used to create a pseudo-random number through a mathematical formula.


Two demonstration scenes were also created as part of the project. These scenes focus on isolating the algorithms used within the main project to show how altering properties can impact the algorithm's outcome, as well as helping to outline what scripts within the project can be broken apart to make the project more modular.


Within the Perlin Noise demonstration scene, only one mesh chunk is generated with the default settings used within the main game. This scene includes options to alter how the mesh looks which range from how zoomed in the Perlin noise is, how much detail is added by the fractal noise and the different colour gradients for different regions. This helps to demonstrate the importance of each value and shows that the generation of a single chunk is efficient as the function to update the mesh is only called when a change is added, and little performance is lost through the generation of one mesh, excluding the requirement of generating colliders.


In the Poisson Disc Sampling demonstration scene, trees and rocks are spawned every second after the player presses generate using a coroutine. Like with the Perlin noise scene, the Poisson disc scene can be altered within the scene by changing the minimum distance objects can be to each other and how many attempts can be made before discarding the potential spawn point. A final option is given which allows the player to toggle off the use of the Poisson sampler and instead the points are chosen at random. The inclusion of the option to turn off the algorithm allows a comparison between the two methods and illustrates how using complete randomness can arise bugs such as objects spawning inside each other.


The inclusion of more algorithms would allow the project to have more content, with one potential algorithm being the cellular automata algorithm for the creation of cave systems below the terrain mesh. However, including cave systems would require alterations to the mesh generation as entrances and exits to the cave system would need to be added.


Overall, the project was a success as it demonstrated multiple procedural content generation algorithms that are used within the industry with complexity added. The inclusion of demonstration scenes shows how the code has been made modular, allowing it to be reused in future projects should the area be faced again. Along with implementing more algorithms for different generation systems and adding visual improvements, the main way to improve the project is to add optimisation methods to the project, such as using Unity's Job System to utilise multiple processor threads to break down tasks.




References

lague, S., 2016. Procedural Landmass Generation (E07: Endless terrain). [Online] Available at: https://www.youtube.com/watch?v=xlSkYjiE-Ck [Accessed 21 12 2022].

MELNYCHUK, V., 2020. Landscape generation using procedural generation techniques, s.l.: s.n.

Unity, 2019. Gradient Node. [Online] Available at: https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Gradient-Node.html [Accessed 21 12 2022].

Unity, 2022. Gradient. [Online] Available at: https://docs.unity3d.com/ScriptReference/Gradient.html [Accessed 19 12 2022].


9 views0 comments

Recent Posts

See All

Kommentare


bottom of page