0

I have made a java game engine that generates a terrain of size 800, 800 on the x z coordinates.

Each terrain object, however, only recognises coordinates of 1 to -1 on each axis and these are the bounds of the terrain. When the terrain is generated a seed is used to generate the heights of each coord from 1 to -1 on both axis.

Below is the code to generate the first terrain (I know it doesnt help much but Im just showing you so you know where the initial terrain is generated [in terrain coords x=0 z=-1. It is then added to an array of terrains and in the main game loop everything is rendered. An important note is that a new seed is generated every time a terrain is generated which I know isnt going to work for multiple terrains.

How would I make it so that terrain chunks are loaded in the direction the player is walking and they are all part of 1 seed. Also would this go in the terrain generation class or the main game loop? thanks

Terrain terrain = new Terrain(0,-1,loader,texturePack, blendMap, "heightmap", 0); //land
List<Terrain> terrains = new ArrayList<Terrain>();
terrains.add(terrain);

renderer.renderScene(treeEntities, terrains, light, camera); // in game loop

[I'm using lwjgl]

Alfabravo
  • 7,493
  • 6
  • 46
  • 82
  • Find yourself a book / tutorial / web site about creating video games (outdoor, not level based) or flight simulators. That will explain how to do on-demand terrain tiles, the generally used name for a chunk of terrain. As for the random number generation, the seed becomes per-game, not per tile. – Hugh Fisher Jun 08 '17 at 23:55
  • Look up ThinMatrix on YouTube. He has a really good randomly generated terrain tutorial. You can then just extend that to infinite using multithreading. – Nick Clark Jun 23 '17 at 20:29

0 Answers0