public class Region

  1. Object
  2. Region
A loadable area of a large world: its own streaming Terrain, placed GameElements and a world-space origin (#getOriginX(),#getOriginZ() in tile units). Regions are linked to neighbours by named edges (#link(String,String), e.g. “east” -> “desert-2”), so a GameWorld can stream the adjacent regions in and out for seamless transitions as the player crosses a boundary. A region serializes independently as its own document.

Constructors

public Region()
public Region(String id, String name)

Methods

public String getId()
public Region setId(String id)
public String getName()
public Region setName(String name)
public double getOriginX()
public double getOriginZ()
public Region setOrigin(double x, double z)
public double getWidth()
public double getDepth()
public Region setSpan(double width, double depth)
public StreamingTerrain terrain()The region’s streaming terrain (created lazily; chunk-paged so a region can be huge).
public Region setTerrain(StreamingTerrain terrain)
public List<GameElement> elements()
public boolean contains(double worldX, double worldZ)Returns true if the world point (tile units) falls inside this region’s bounds; an unbounded region (width/depth 0) contains everything at/after its origin only loosely (callers use neighbor links for transitions instead).
public Region link(String edge, String neighborRegionId)Links a named edge of this region to a neighbouring region id.
public Map<String, String> neighbors()
public Map<String, Object> props()
public String toJson()
public static Region fromJson(String json)

Inherited methods

Constructor details

Region

public Region()

Region

public Region(String id, String name)

Method details

getId

public String getId()

setId

public Region setId(String id)

getName

public String getName()

setName

public Region setName(String name)

getOriginX

public double getOriginX()

getOriginZ

public double getOriginZ()

setOrigin

public Region setOrigin(double x, double z)

getWidth

public double getWidth()

getDepth

public double getDepth()

setSpan

public Region setSpan(double width, double depth)

terrain

public StreamingTerrain terrain()
The region’s streaming terrain (created lazily; chunk-paged so a region can be huge).

setTerrain

public Region setTerrain(StreamingTerrain terrain)

elements

public List<GameElement> elements()

contains

public boolean contains(double worldX, double worldZ)
Returns true if the world point (tile units) falls inside this region’s bounds; an unbounded region (width/depth 0) contains everything at/after its origin only loosely (callers use neighbor links for transitions instead).

link

public Region link(String edge, String neighborRegionId)
Links a named edge of this region to a neighbouring region id.

neighbors

public Map<String, String> neighbors()

props

public Map<String, Object> props()

toJson

public String toJson()

fromJson

public static Region fromJson(String json)