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 AssetCatalog | The registry that turns an GameElement#getAssetId() into something a LevelRealizer can draw. |
class AssetDef | The definition of one placeable asset in an AssetPack: the template a placed GameElement references through its GameElement#getAssetId(). |
class AssetPack | A themed collection of AssetDefs – the editor’s “Platformer”, “Top-Down RPG” or “Board & Card” pack. |
interface ChunkProvider | Supplies and persists TerrainChunks for a StreamingTerrain. |
class GameElement | A single placed thing in a GameLevel – pure authoring data, deliberately not a com.codename1.gaming.Sprite. |
class GameLevel | A 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 GameSceneView | A 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 GameWorld | A 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 IsoProjection | Maps between board cells (row, column) and screen pixels for the 2:1 isometric “diamond” layout used by board / strategy games. |
class Layer | A named drawing band in a GameLevel: the editor’s “Background / Terrain / Items / Actors” rows, and the rendering order behind them. |
class LevelLight | A serializable directional light authored in a 3D GameLevel: a direction, a diffuse #getColor() and an #getAmbientColor(). |
class Material | A pluggable surface material used by terrain cells and TerrainFeatures. |
class MaterialRegistry | Process-wide registry of pluggable Materials, keyed by id. |
class Region | A loadable area of a large world: its own streaming Terrain, placed GameElements and a world-space origin (#getOriginX(),#getOriginZ() in tile units). |
interface RegionProvider | Loads 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 StreamingTerrain | An unbounded Terrain that pages TerrainChunks in and out through a ChunkProvider, keeping at most #getCacheSize() chunks resident (LRU). |
interface Terrain | Abstraction over a heightfield + per-cell material + placed TerrainFeatures addressed by world cell coordinates. |
class TerrainChunk | A #SIZEx#SIZE square block of terrain – the unit of streaming. |
class TerrainFeature | A placed, variable-size terrain element such as a wall, ramp or platform. |
class TerrainGrid | A height grid for a 3D GameLevel: a #getCols() x #getRows() array of vertex heights spaced #getCellSize() world units apart. |
class TileLayer | An efficient, single-tileset tile grid: a #getCols() x #getRows() array of frame indices into one SpriteSheet (-1 means “empty cell”). |