Sunday 28 January 2018

A procedural world.



I decided before Christmas ,after learning just a bit more about shaders that i would attempt to make world at the centre of this game procedural instead of relying on textures.

The reasoning for this being :

  • Reduce the number of textures stored in the app and in memory while it's running.
  • Have a greater variety or worlds.
  • Free myself partially from content creation(still an issue as i keep tweaking things)
  • Build up a repertoire of techniques i can return to for later games, projects
  • Expand my own learning of GLSL.

Some of the cons so far:
  • What i sacrifice in memory usage is taken from GPU power and more device power usage
  • The algorithms require a lot of tweaking to looking plausible and pleasing(this becomes a time sink, but at least i'm learning) 
  • Testing all this slow.
  • There maybe future unforeseen consequences, due to GPU changes that cause the code to behave incorrectly or simply not work at all.


To do this i initially started by working with a GLSL plasma function, i modified this (https://www.bidouille.org/prog/plasma )function to produce 3d noise instead of 2d based on the location of the point that is being drawn within the 3d space, as opposed to the points location on the texture. The reasoning for this is that it creates more seamless realistic textures on 3d objects such as a sphere.

  1. By layering a few of these functions , having the results from some subtract and results from others add i created float representing height between 0.0 and 1.0. 
  2. Using that i then set a cut off at 0.5,. Anything below is water anything above is land.
  3. From there i can subdivide it further into, deep water, shallows, lowlands, mountains etc (citiy lights are just a texture so far)







Will updates this tomorrow with changes to this.