Cheat sheet

Editor

Keys Does
Ctrl K Command palette: modules, undo, redo, export, play, settings, recent maps
Ctrl , Settings
Ctrl Z / Ctrl Shift Z Undo / redo
Ctrl 1 … 6 Terrain, Objects, Triggers, Imports, Players, Shaders
Left button Paint, select, place
Right drag, Cmd drag Orbit the camera
Shift right drag, middle button Pan
Wheel, pinch Zoom
Esc Close a picker or dialog

The editor saves by itself a second after every change. Export makes the one-file .a4m.

Game

Keys Does
Click, drag box Select. A box does not pick buildings.
Shift click or drag Add to the selection. Shift click on a selected unit takes it out.
Double click Select all units of that kind on the screen
Right click on a unit Attack it if it is an enemy; on an ally, walk there. Attacking an ally is forced: A, then click it
Shift right click Attack the enemy nearest the pointer (up to about 160 pixels away); with none near, move there
Ctrl 1–9, 0 Save the selection in a control group
1–9, 0 Select the group. Twice quickly: move the camera to it.
Right click on the ground Move
Right click on an enemy Attack
M then click Move
A then click on an enemy Attack
A then click on the ground Attack-move
S Stop
Command card slot, then click on the ground Build. A training slot trains at once.
Wheel Zoom
Edge of the window, arrow keys Slide the camera
Middle button drag Drag the map
Click or drag on the minimap Move the camera
Right click on the minimap Move the selected units there
Alt click on the minimap Ping for your team
Alt click on the ground Small "here" ping for your team
Alt click and drag Opens the ping wheel: danger, I need help, push, fight, I'm going here, ward here, missing?, vision. Let go over one to send it; right click cancels
Tab (hold) Players overlay: who is in the game
</kbd> Hero camera mode: Free, Fixed, Dynamic (with hero focus on)
V Utility slot: place a ward or use the sweeper
F8 Send feedback (start screens)
Enter Chat (team); Shift Enter to everyone
Click the chat lines Open the full message history (chips: All, Team, Events, System, Debug)
Ctrl F Search the messages in the history; Esc clears the search
Up / Down in the chat box Recall what you sent before; Tab completes a command
F12 Developer messages (Debug view); click the chat lines for the full history
? (Shift+/) Keyboard help: every key, made from the same list as the command palette
Y Lock the camera on the hero (also in the palette)
F3 Debug overlay: compact, detailed, off
Ctrl H Hide the interface
Ctrl K Command palette: orders, build and train (with costs), select army / idle worker / hero / groups, camera, chat, pings, interface; dimmed entries say why they cannot run
Esc, F10 Game menu: Resume, Settings, Quit to start screen, Quit game

M, S, A, F10, F12 and Tab are the defaults. You can change them in Settings > Input.

Commands

Press Enter, then type a /. Tab completes, up and down pick, and up on an empty line recalls what you sent before.

Command Does
/help All commands, the map's own included
/all <text> Say it to everyone
/fps Debug overlay
/hideui Hide or show the interface

These are cheats. They work only in a game at one computer.

Command Does
/gold <n> Give gold (negative takes it)
/reveal Show the whole map
/spawn <unit> [n] Put units under the pointer, 1 to 50
/kill Kill the selection
/instant [on|off] Training and building finish at once
/speed <x> Game speed, 0.1 to 8
/level <1-10>, /mana <n> Set the selected heroes' level and mana

Command line

Command Does
w4-engine Start screen
w4-engine <map> Play a map (folder or .a4m)
w4-engine --info <map> Print what the map holds

Scripting

import (
	"w4/event"   // OnMapInit, OnUnitDied, OnUnitDamaged, OnEnter, OnLeave, Every, After
	"w4/game"    // Print, SpawnUnit, Units, Time, Command, NewRegion, NewCircle
	"w4/player"  // Red ... Brown, Neutral, NeutralAggressive, Everyone
	"w4/ui"      // Text, Button, Panel, Quest, FloatText
)

Build: the editor's Build or Play, or GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o map.wasm . in scripts/. The API is in your data folder (%LOCALAPPDATA%\W4\go-sdk on Windows); the map's go.work points at it.

Files

Path What
map.toml name, size, settings, players, the format and editor version
assets/ models, textures, sounds
scripts/ main.go, go.mod, go.work, map.wasm
shaders/ unit.wesl, terrain.wesl when the map has its own
sounds.toml gains from Normalise
activity.log everything the activity panel showed
<map>.a4m the exported, encrypted one-file map