Mhh yeah I get what you are saying. Its tough for me to say since I kind of know what to do, I just don't know how to type it. Basically the syntax is my problem and I guess it just takes time to learn that. What Im hoping for is just some feedback on the thought process. Did I forget something/where could the problems occur.
I guess what Im gonna do is search for top down 2d games and look for the parts which are similar.
Well your saying you want to build an house, you know the color, and how many rooms you would like to have, and ask did i forget something?
Yeah you forgot a lot, programming is not just about syntax, i wish it was that easy, code of diffrent solutions cant just work together.
You cant just take any window from some house and put it into your house, you would need to know if it fits, and where to put it excactly and how it works, maybe you expect an full glass window to open at some spot or something, it would never work and you would be better of building your own window.
The problem with programming is, there is no main solution, each problem you are going to have would have multiple solutions (also depending on choices you made for other problems).
To give an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| private void Init(){ vbo = new VBO_Terrain((2*SIZE + 1)*SIZE, parent.getShader().getAttribLoc("terrain")); depth = new float[SIZE+4][SIZE+4]; SimplexNoiseGenerator gen = new SimplexNoiseGenerator(parent.getSeed()); for(int x = 0; x <= SIZE+1; x++){ for(int z = 0; z <= SIZE+1; z++){ depth[x][z] = (gen.noise((this.x+x-1)/100f, (this.z+z-1)/100f, 0, 5, 3, 0.2f) * 20); } } water = new WaterChunk(x, z, depth); int x = 0; for(int zpos = 0; zpos < SIZE-1; zpos++){ for(int xpos = 0; xpos < SIZE; xpos++){ x = zpos % 2 == 0 ? xpos : SIZE - (xpos+1); addvertex(x, zpos); addvertex(x, zpos+1); } } } |
This basicly creates some random 3d terrain and sends it to an VBO.
Its an solution for my try to create 3d terrain.
best solution?
no, far from it.
Could anyone else use it?
Nope, it would take hours before anyone understands the mess i made.
But for me it works to test some rendering, when im going to expand anything, i can throw this code away.
I really recomment taking some introduction tutorials, just so you wont get overwhelmed by any code.
Then you should find some open source game / engine you can mess around with to see what you could do.