mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-09 21:31:51 +09:00
gameblockloader
@@ -1,5 +1,5 @@
|
||||
## Metadata
|
||||
Every modules must be able to introduce themselves through the `metadata.properties` file.
|
||||
Every module must be able to introduce themselves through the `metadata.properties` file.
|
||||
|
||||
The metadata file is a standard-issue Java properties file with some required keys.
|
||||
|
||||
@@ -59,22 +59,75 @@ The Modmgr provides the functions to load the following ingame elements:
|
||||
- ModMgr.**GameRetextureLoader** — loads the retextures
|
||||
- ModMgr.**GameCraftingRecipeLoader** — loads the crafting recipes
|
||||
|
||||
The Modmgr will load the blocks/items, assign them the Itme IDs, and register them to their respective *Codex*.
|
||||
|
||||
#### GameBlockLoader
|
||||
|
||||
The GameBlockLoader looks for the `<module root>/blocks/blocks.csv` for the list of blocks and the `<module root>/wires/wires.csv` for the list of wires.
|
||||
|
||||
Every block within a module gets a unique number as an ID. A texture of the block must be named as the ID, with the extension of `.tga`.
|
||||
|
||||
TODO describe the csv
|
||||
The Item ID for the blocks will be `<module name>:<id defined in the csv>` e.g. `basegame:32`
|
||||
|
||||
##### blocks.csv
|
||||
|
||||
Every block's property is defined on the csv file with following columns:
|
||||
|
||||
- id: ID of this block
|
||||
- drop: Which item the DroppedItem actually adds to your inventory
|
||||
- spawn: Which item the DroppedItem should impersonate when spawned
|
||||
- name: String identifier of the block
|
||||
- shdr: Shade Red (light absorption). Valid range 0.0–1.0+
|
||||
- shdg: Shade Green (light absorption). Valid range 0.0–1.0+
|
||||
- shdb: Shade Blue (light absorption). Valid range 0.0–1.0+
|
||||
- shduv: Shade UV (light absorbtion). Valid range 0.0–1.0+
|
||||
- lumr: Luminosity Red (light intensity). Valid range 0.0–1.0+
|
||||
- lumg: Luminosity Green (light intensity). Valid range 0.0–1.0+
|
||||
- lumb: Luminosity Blue (light intensity). Valid range 0.0–1.0+
|
||||
- lumuv: Luminosity UV (light intensity). Valid range 0.0–1.0+
|
||||
- str: Strength of the block
|
||||
- dsty: Density of the block. Water have 1000 in the in-game scale
|
||||
- mate: Material of the block (defined in the MaterialCodex; see GameMaterialLoader)
|
||||
- solid: Whether the file has full collision (0/1)
|
||||
- plat: Whether the block should behave like a platform (0/1)
|
||||
- wall: Whether the block can be used as a wall (0/1)
|
||||
- grav: Whether the block should fall through the empty space. N/A to not make it fall; 0 to fall immediately (e.g. Sand), nonzero to indicate that number of floating blocks can be supported (e.g. Scaffolding)
|
||||
- dlfn: Dynamic Light Function. 0=Static. Please see <strong>notes</strong>
|
||||
- fv: Vertical friction when player slide on the cliff. 0 means not slide-able
|
||||
- fr: Horizontal friction. <16:slippery; 16:regular; >16:sticky
|
||||
- colour: [Fluids] Colour of the block in hexadecimal RGBA.
|
||||
- vscs: [Fluids] Viscocity of the block. 16 for water.
|
||||
- refl: [NOT Fluids] Reflectance of the block, used by the light calculation. Valid range 0.0–1.0
|
||||
- tags: Tags used by the crafting system and the game's internals
|
||||
|
||||
Notes on `dlfn`:
|
||||
|
||||
- dlfn stands for the Dynamic Luminosity Function.
|
||||
- 0—static; 1—torch flicker; 2—current global light (sun, star, moon); 3—daylight at noon; 4—slow breath; 5—pulsating
|
||||
|
||||
##### Block Texture Format
|
||||
|
||||
Autotiling and TODO
|
||||
Block spritesheet must be one of following sizes (assuming global TILE_SIZE of 16): 16x16, 64x16, 128x16, 112x112, 224x224. Different sheet size denotes different format of the sheet.
|
||||
|
||||
- 16x16: Just a single tile. No autotiling and other tiles won't connect to it.
|
||||
- 64x16: A "wall sticker". Used by torches. Indices: free-floating, stuck-on-left, stuck-on-right, stuck-on-bottom
|
||||
- 128x16: A "platforms". Used by platforms. Indices: middle, right-end, left-end, stuck-on-left-middle, stuck-on-left-end, stuck-on-right-middle, stuck-on-right-end, single-piece
|
||||
- 112x112: The full autotiling.
|
||||

|
||||
The "empty" tile at the (6,5) work as a "barcode" to assign properties. Each row on the square encodes a number in binary: pixel plotted = 1
|
||||
- Topmost row: the connection type
|
||||
- …0000—connect mutually (every tile tagged as 0 will connect to each other); …0001—connect to self
|
||||
- Second row: the mask type
|
||||
- …0010—use the autotiling (this row is reserved for future expansion; for now just mark it accordingly)
|
||||
- 224x224: Same as 112x112 but has seasonal variations. On render, colours from the current and the next seasons will be blended according to the ingame calender time.
|
||||
- Top-left—spring; Top-right—summer; Bottom-right—autumn; Bottom-left—winter
|
||||
|
||||
#### GameItemLoader
|
||||
|
||||
The GameItemLoader looks for the `<module root>/items/itemid.csv` for the list of items.
|
||||
|
||||
The Item ID for the items will be `item@<module name>:<id defined in the csv>` e.g. `item@basegame:1`
|
||||
|
||||
TODO describe the csv but not the GameItem
|
||||
|
||||
#### GameMaterialLoader
|
||||
|
||||
BIN
autotiling1.png
Normal file
BIN
autotiling1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
Reference in New Issue
Block a user