sashman / kingdomforge

2 stars 1 forks source link

Procedurally generated water sprites #2

Open sashman opened 11 years ago

sashman commented 11 years ago

Background

Currently the grass tiles are generated with a simple algorithm (see img/scripts/random_grass.py), saving a lot of time on creating terrain assets. Next step would be dealing with water tiles.

Aiming for something like this: Water Tile

What needs to be done

Create a python script (for sake of consistency) to generate a water tile given a size. The edges of the water tile must match up.

How to do it

  1. Start with a blue solid background.
  2. Generate a voronoi diagram of a different blue colour. Use the data from it to form lines on the borders of the sections.
  3. Apply a noise algorithm to distort the above image.
  4. Make sure the lines intersect the edges at controlled points.
  5. Repeat from step 2. for 2 or 3 layers.
stooie90 commented 11 years ago

When calculating the voronoi diagram, do not use a distance function between two points. This will generate straight lines between the points and will not look wavy / water like. The waves should be curved so add in an extra point to calculate a Bézier curve.