In the programming of my 2d sandbox game, I decided to add a procedural generation engine to generate terrain. The way I have decided to implement it is by using the diamond square algorithm to generate values, then based on the values I will derive the matching terrain (each terrain has a range where it can generate. The only example I could find for the algorithm (found here) requires an odd grid size (i.e. 17 x 17, not 16 x 16) to generate. I understand why and was wondering if I should use a different algorithm, or if there was a way to make it work with this algorithm.
With numbers on a a 17x17 grid, you could just take the average of the 4 corners of each small square to get a number for the square. E.g., with 3x3 instead of 17x17, say you have
3--2--1
| | |
4--3--1
| | |
5--4--2
That grid defines 4 small squares. The squares would have values
(3+2+4+3)/4=3.00 (2+1+3+1)/4=1.75
(4+3+5+4)/4=4.00 (3+1+4+2)/4=2.50
Same idea for 17x17 grid into 16x16 squares. Or am I not understanding?