package com.codename1.gaming.level

The saved-level / map model behind the Codename One game builder.

This package is the bridge between a visual level editor and the runtime com.codename1.gaming engine: a GameLevel is a mode-aware, JSON-serializable description of a scene that the editor writes and a game loads, decoupled from how it is drawn.

A level has a mode – GameLevel.Mode#TWO_D (tile + sprite), GameLevel.Mode#THREE_D (meshes, TerrainGrid and LevelLights in a perspective world) or GameLevel.Mode#BOARD (an IsoProjection grid) – ordered Layers (a tile layer paints an assetId-per-cell grid; entity / model layers group freely placed things), a list of GameElements (pure data: an asset id, a transform and a typed property bag, not a com.codename1.gaming.Sprite) and an AssetCatalog of AssetPacks / AssetDefs resolving asset ids to artwork.

Realization – turning the data into live objects – depends on the mode: a GameLevel realizes its own 2D / board sprites, while GameSceneView is a turnkey com.codename1.gaming.GameView that plays a level end to end, including the 3D camera, lights and models (which need the GPU device).

Types

class AssetCatalogThe registry that turns an GameElement#getAssetId() into something a LevelRealizer can draw.
class AssetDefThe definition of one placeable asset in an AssetPack: the template a placed GameElement references through its GameElement#getAssetId().
class AssetPackA themed collection of AssetDefs – the editor’s “Platformer”, “Top-Down RPG” or “Board & Card” pack.
interface ChunkProviderSupplies and persists TerrainChunks for a StreamingTerrain.
class GameElementA single placed thing in a GameLevel – pure authoring data, deliberately not a com.codename1.gaming.Sprite.
class GameLevelA saved, mode-aware game level or map: the data the visual editor writes and the runtime loads, deliberately decoupled from how it is drawn.
class GameSceneViewA turnkey GameView that plays a GameLevel: it wires the whole lifecycle so a generated game scene can be a thin subclass that only adds behavior.
class GameWorldA large game space made of linked Regions, streamed in and out around the player so the world can exceed memory while transitions stay seamless.
class IsoProjectionMaps between board cells (row, column) and screen pixels for the 2:1 isometric “diamond” layout used by board / strategy games.
class LayerA named drawing band in a GameLevel: the editor’s “Background / Terrain / Items / Actors” rows, and the rendering order behind them.
class LevelLightA serializable directional light authored in a 3D GameLevel: a direction, a diffuse #getColor() and an #getAmbientColor().
class MaterialA pluggable surface material used by terrain cells and TerrainFeatures.
class MaterialRegistryProcess-wide registry of pluggable Materials, keyed by id.
class RegionA loadable area of a large world: its own streaming Terrain, placed GameElements and a world-space origin (#getOriginX(),#getOriginZ() in tile units).
interface RegionProviderLoads and persists Regions by id for a GameWorld, so a world larger than memory can page whole areas in and out as the player roams.
class StreamingTerrainAn unbounded Terrain that pages TerrainChunks in and out through a ChunkProvider, keeping at most #getCacheSize() chunks resident (LRU).
interface TerrainAbstraction over a heightfield + per-cell material + placed TerrainFeatures addressed by world cell coordinates.
class TerrainChunkA #SIZEx#SIZE square block of terrain – the unit of streaming.
class TerrainFeatureA placed, variable-size terrain element such as a wall, ramp or platform.
class TerrainGridA height grid for a 3D GameLevel: a #getCols() x #getRows() array of vertex heights spaced #getCellSize() world units apart.
class TileLayerAn efficient, single-tileset tile grid: a #getCols() x #getRows() array of frame indices into one SpriteSheet (-1 means “empty cell”).