Sign in to follow this  
Zorphas

algorithms...

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
The code you posted is trivial to an experienced programmer. Keep going. You'll get there.


QFT. You'll get it with experience. Believe me, theres much, much scarier stuff out there, and for quite a while you will need to rely on references. The only way you will learn/remember stuff is if you apply it.

Also, the one thing I can say about programming is that it does wonders for your problem solving skills. With experience, comes the ability to solve increasingly complex problems. So yes, programmers often have to solve problems, but with the right combination of research and experience, they can be solved.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this