org.globalse.arena.sword.algorithm
Class World

java.lang.Object
  |
  +--org.globalse.arena.sword.algorithm.World

public class World
extends java.lang.Object

The class World creates a world. It delivers all data of the created world.

The world is infinite. Therefore, it is divided into tiles of a fixed size. The tiles are arranged in a coordinate system, similar to pixels on a screen.

Imagine a 2-dimensional grid. The squares between the gridpoints are the tiles of the world. The gridpoints have coordinates. (0,0) is the point at the center of the grid, (1,0) is one position to the right.

To address a tile, we defined that each tile is represented by the gridpoint at its lower left corner. So the tile (0,0) is the tile that has its lower left corner at the center of the grid.

The world class is deterministic. If you create two worlds with the same parameters (which are set by the constructor), the created worlds will be exactly the same.


Constructor Summary
World(GameManager gameManager)
          The constructor creates a new world object.
 
Method Summary
 Landscape getLandscape()
          Returns the landscape of the world.
 double[][][] getLandscape(int x, int y, int detailLevel)
          Returns the heightmap and vegetationmap of one tile.
 double[] getMinMax()
          Returns the range in which "most" height values and vegetation values are.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

World

public World(GameManager gameManager)
The constructor creates a new world object.
Parameters:
gameManager - the seed for the random algorithm
Method Detail

getLandscape

public Landscape getLandscape()
                       throws java.lang.Exception
Returns the landscape of the world.
Returns:
the landscape object

getLandscape

public double[][][] getLandscape(int x,
                                 int y,
                                 int detailLevel)
                          throws java.lang.Exception
Returns the heightmap and vegetationmap of one tile. It creates two array. One array consists of values that represent the height of the landscape in a certain tile. These values are height-samples of a continuous landscape. The second array represents the vegetation type and other landscape attributes. The only predefined value is 0 for water.
Parameters:
x - the x-coordinates of the point at the lower left corner of the tile
y - the y-coordinates of the point at the lower left corner of the tile
detailLevel - the level of the detail of the landscape. Logarithm of
Returns:
An array ret of two 2D array with the height values and vegetation. ret[0] is the array of height values, ret[1] are the vegetation values.

getMinMax

public double[] getMinMax()
Returns the range in which "most" height values and vegetation values are.



This page is hosted by the Chair for Applied Software Engineering of the Technische Universität München.
Imprint (Impressum)