Commander
The player’s strategy controls, on the camera: click or drag a box to select units, right-click to send them (to walk, attack, gather or build), hotkeys and the command card for everything else. It shows the team’s resources and supply, what’s selected, a minimap, and pans the camera with the arrow keys, the screen’s edges and the minimap, zooming with the mouse wheel.
Part of the Strategy module: Real-time strategy: factions, units that walk around obstacles and fight, workers that gather and build, buildings that train units, fog of war, the computer playing a side, the player’s controls and HUD, playing online team against team, and the Strategy template.
Keys: A then click attacks-moves, S stops, H holds position, M then click moves, Esc cancels. Ctrl and a number keeps the selection as a group, the number picks it again. Shift adds to the selection, or queues up buildings to place. Double-click a unit to pick all of its kind on screen. It selects by the rules of Griff’s SelectionState (as SelectionControls does), with the same input actions: Select, Command, AddToSelection, AssignGroup and Group1 to Group9, which the player can rebind.
Requires: Camera
Works with: FogOfWar (hides what the team can’t see)
Needed by: FogOfWar
Takes the player’s input only while it has focus (its Controllable): its Focus action hands it the input and takes it from everything else the same player plays.
In a network game, each machine keeps its own entity with this on it: it isn’t sent.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
team: text = “Player”. The team the player commands: a Faction’s Team. (Names a team.) (Field: a name.)
Map and Camera
Section titled “Map and Camera”mapCenter: [x, y] = [0,0]. The middle of the map, in world units. The camera, minimap and pathfinding stay within the map. (Field: a vector.)mapSize: [x, y] = [48,32]. How big the map is, in world units. (Field: a vector.)scrollSpeed: a number = 16. How fast the camera pans, in world units per second. (Field: a number.)edgeScroll: true or false = true. Whether resting the mouse at the screen’s edge pans the camera. (Field: on or off.)minZoom: a number = 5. The closest the mouse wheel zooms in: the camera’s smallest Size. (Field: a number.)maxZoom: a number = 13. The furthest the mouse wheel zooms out: the camera’s largest Size. (Field: a number.)controllable: true or false = true. Untick it to have the controls ignore the mouse and keys (selecting, orders, panning) while the game plays on: another part of the scene has the player’s input. Its Focus action ticks it and unticks it on everything else the player plays, and another’s Focus takes it back. (Field: on or off.)
Screens
Section titled “Screens”hud: true or false = true. Whether to show the resources bar, selection, command card and minimap. (Field: on or off.)victoryPanel: text = “Victory”. A panel opened when every other team is beaten, e.g. “Victory”. (Names an entity.) (Field: an entity’s name.)defeatPanel: text = “Defeat”. A panel opened when the player’s team is beaten, e.g. “Defeat”. (Names an entity.) (Field: an entity’s name.)
Sounds
Section titled “Sounds”orderSound: text = null. A sound played when the player gives an order, e.g. “Sounds/select.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)readySound: text = null. A sound played when something’s finished: a unit trained, a building up. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
Actions
Section titled “Actions”What anything can make it do with no code: a Trigger’s do when its message arrives, a Contraptions Wire’s input as its signal comes on, a script’s Game.Do(entity, “Name”).
Focus. Gives its entity the player’s input: whatever there and inside it has focus, and everything else the same player plays loses it (a platformer’s player stops on the arrow keys while a board takes them).
Scripts use it as Commander: its methods, events and values that aren’t saved with the scene.