Original Post
Hello, I am learning videogame programming - I've been doing a few tutorials and I noticed that the algorithms used to fill out the vertices/indices arrays can get extremely complicated to create... for example, //This is to set the equidistant vertices to outline the terrain. vertices = new VertexPositionColor[WIDTH * HEIGHT]; for (int x = 0; x < WIDTH; x++) { for (int y = 0; y < HEIGHT; y++) { vertices[x + y * WIDTH].Position = new Vector3(x, y, 0); vertices[x + y * WIDTH].Color = Color.White; } } //This will use the vertices to connect them and create the triangles. int[] indices = new int[(WIDTH - 1) * (HEIGHT - 1) * 3]; for (int x = 0; x < WIDTH - 1; x++) { for (int y = 0; y < HEIGHT - 1; y++) { indices[(x + y * (WIDTH - 1)) * 3] = (x + 1) + (y + 1) * WIDTH; indices[(x + y * (WIDTH - 1)) * 3 + 1] = (x + 1) + y * WIDTH; indices[(x + y * (WIDTH - 1)) * 3 + 2] = x + y * WIDTH; } } is to fill the indices using clockwise triangles to create a terrain (http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_basics.php) I can follow through and understand what it does just fine, but if I were asked to create that algorithm from scratch it could take me weeks IF i ever got it... My question is: would a game designer/programmer actually need to create these kind of algorithms from scratch...? Thank you.