Documentation
¶
Overview ¶
Command game3d is a small 3D game that uses the games work of Glutter 1.10 and 1.11 together (SPEC §27, §28): Coin Run. A character (a skinned glTF model, made with its skeleton and four animations by internal/genassets) runs and jumps through a small level (a glTF file too) in a viewport3d.View with PBR materials and a shadow, collects its twelve coins and keeps out of the lava. A pad (package gamepad: the left stick moves, the right stick looks, A jumps, Start pauses, and the D-pad and A drive the pause menu through the key events that pads make), the keyboard (WASD or the arrows, Space, Esc) and a locked mouse (a click in the view locks it; package widgets' PointerLock) all play it, and on a phone the touch does: drag on the left half to move, on the right half to look, and the round button jumps. The music and the sound effects are package audio streams, a hit makes the pad rumble, and the pause menu is Material. The view draws at every frame (Continuous).
Run it with: go run ./examples/game3d
It needs a GPU renderer (Vulkan, Direct3D 12 or WebGPU); with another one the view shows its fallback, a line of text.
On Windows: go run ./cmd/glutter-windows run ./examples/game3d. On the web: go run ./cmd/glutter-web serve ./examples/game3d. On Android: go run ./cmd/glutter-android run ./examples/game3d.
Environment: GLUTTER_BACKEND=x11|wayland (Linux) or win32 (Windows), GLUTTER_RENDERER=vulkan|d3d12|webgpu, GLUTTER_SCREENSHOT=<file.png>, GLUTTER_SCREENSHOT_AFTER=<duration>. In debug builds GLUTTER_DEV_GAME3D=proof puts the character on the second stepping stone with four coins picked up and the camera turned towards the level (the state of the proof pictures), and =paused shows the pause menu.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
genassets
command
Command genassets writes the assets of examples/game3d: the character and the level as glTF binary files (.glb) and the music and the sound effects as WAV files.
|
Command genassets writes the assets of examples/game3d: the character and the level as glTF binary files (.glb) and the music and the sound effects as WAV files. |