Molten

Shipping a Molten game

Build Molten with the Debug or Release workflow. Run the resulting molten CLI from build/<preset>/bin/<Config>/ on Windows or build/<preset>/bin/ on Linux.

molten build --release samples/gridline dist/Gridline

The output directory must be new or empty and outside the game source directory. The command checks the project with the same checker as castc check, emits release C for Cast, and gathers any C sources under native/. It imports assets, packs the imported files and checked project text, and writes third-party notices from the pinned SDL, volk, Vulkan-Headers and Inter sources. A separate Release build compiles and links the gameplay and engine together. The command publishes the complete output directory after linking succeeds.

The builder needs the Molten checkout and its configured build, plus LLVM with Clang and LLD. On Windows, it also uses the Visual C++ toolchain and Windows SDK captured by Molten's CMake configuration, and Ninja from PATH or Visual Studio. It looks for clang-cl.exe on PATH, in installations reported by vswhere, and in the standard standalone LLVM directory. On Linux it looks for clang and the matching clang++ on PATH, including versioned names. Use --clang PATH to select an LLVM installation. The default workflows run ship_gridline with these same prerequisites; it is reported as skipped (not failed) when LLVM is not installed (molten exits with code 77 for a missing tool).

Metadata and the player folder

name = "Gridline"
title = "Gridline"
organization = "Molten"
version = "1.0.0"
icon = "icon.png"
first_screen = "MainMenu"
escape_quits = false

name is the executable basename and the application name used for player data. organization defaults to Molten. Both use up to 64 ASCII letters, digits, hyphens or underscores. The title defaults to the name. The version uses one to four numeric components, each at most 65535. A game-relative PNG up to 256 × 256 pixels supplies the window icon and the Windows executable resource. Windows also embeds the product title and version in the executable. Linux ships the PNG separately and provides a desktop entry for installation into a launcher. For a desktop install, put the executable and pack together in a directory on PATH, and the PNG on the desktop's icon theme path.

Distribute the entire output folder. Run the executable directly from any working directory. On Windows the game links SDL and the C/C++ runtime statically. On Linux it links SDL statically and uses the system C and C++ runtimes and the desktop libraries for the SDL video backend. Build on the oldest Linux distribution your players need to support so system library versions match. Both platforms need a Vulkan 1.3-capable driver with the features required by Molten's renderer and the system Vulkan loader (vulkan-1.dll or libvulkan.so.1). The game folder is read-only at runtime.

Vulkan adapter selection

The game prefers a compatible discrete GPU. Set MOLTEN_GPU before launch to force a zero-based Vulkan adapter index, a case-insensitive adapter name substring, or the adapter type integrated or discrete. For example, set $env:MOLTEN_GPU = 'integrated' in PowerShell or run MOLTEN_GPU=integrated ./Gridline on Linux. The game uses the first compatible match. If there is no compatible match, startup reports the reason and exits. The startup log identifies the selected adapter index, name and driver version.

Custom Slang vertex shaders should read vertices with loadVertex(vertexID) from molten.slang rather than drawPush.vertices[vertexID]. Indexing a physical pointer to a struct and then reading a field (pointer[i].field) crashes Intel's Windows Vulkan shader compiler when the pipeline is created, so the game exits on Intel GPUs. If a shader indexes its own struct pointers, reinterpret the pointer as float4* or uint4* and rebuild the struct from vector loads, as loadVertex does. Test a shader on an Intel GPU with MOLTEN_GPU=integrated.

Positions a shader gets (drawPush.model, view_proj, camera_position) are in render space: world minus the render origin, which moves by whole chunks near the camera (docs/DESIGN.md M15). Lighting and anything relative to the camera are unaffected.

Settings and saves

SDL resolves the per-user data folder using the game organization and name. For Gridline this is typically %APPDATA%\Molten\Gridline on Windows and ${XDG_DATA_HOME:-$HOME/.local/share}/Molten/Gridline on Linux.

A player can place a settings.ini file in that folder. Omitted or invalid entries use these defaults. Dimensions may be 64 to 16384 pixels per side. Fullscreen selects the closest display mode when available. Disabling vsync prefers immediate presentation, then mailbox, and falls back to FIFO if the display supports only FIFO.

width=1280
height=720
fullscreen=false
vsync=true
volume_master=1
volume_music=1
volume_effects=1
volume_ui=1
graphics=cinematic
quality=high

graphics (standard or cinematic) can only lower the tier the game asks for in game.toml; quality (low, medium, high) scales the M17 lighting for weaker GPUs, and low turns it off (the M16 look). See DESIGN.md "Graphics tiers".

Audio volume values range from 0 to 1. Cast's audioSetBusVolume(bus, volume) applies a volume immediately and saves it to the same file. Gridline exposes all four values in Pause.

Cast can import saveRead(name): string and saveWrite(name, value): bool from "molten". Each slot is a file under saves/ with a portable name and a 16 MiB limit. The returned string is frame-lifetime data. A missing or unreadable slot yields an empty string. The C API returns a pointer and length for binary data, and a null pointer for a failed read. Saves replace existing slots atomically. The normal dev runner uses the same save API and per-user folder when a project supplies a portable name.

Game pack version 1

game.mtpack starts with the bytes 4d 54 50 41 43 4b 01 00 followed by an unsigned 32-bit entry count. Each entry has a 32-bit key length, a 64-bit byte count, the key bytes and the payload bytes. Integers are little-endian and there is no padding. Keys are case-sensitive UTF-8 paths separated by forward slashes, with no leading slash, empty segment, . or .. segment. The writer sorts keys by byte value.

The runtime reads the pack into memory. assets/ holds the imported formats documented in formats.h. project/ holds game.toml and validated concept, UI and style text. engine/ holds the default SPIR-V shaders, Inter atlas and optional icon. The runtime parses the checked text through libcast's data parsers and resolves it against the statically registered gameplay schemas. Asset and project reads are confined to the pack.

Steam

MOLTEN_STEAM is off by default. molten build --release ... --steam enables the empty CMake module boundary. A future integration can add the SDK-backed implementation, Steam startup and shutdown, and distribution requirements behind that boundary.

View this page's source on GitHub