Combat and fog of war
For creatorsAdd-on 2.2.2+
The units from tutorial 15 now fight, and you see only what your army sees.
▶ Play
- Right-click an enemy to attack it.
- A, then click: attack-move. A click on an enemy attacks it. Esc cancels.
- H holds position. S stops.
- Everything else works as in tutorial 15.
- Tap an enemy to attack it.
- ⚔, then tap: attack-move.
- ✋ holds position. ■ stops.
What you get
Section titled “What you get”The red army waits across the ridge, hidden by fog. Select everyone, press A and click near it: your army goes round the ridge and fights its way in. The top of the screen shows your army and your kills, never how many enemies remain. The fog keeps that from you.
Build it
Section titled “Build it”-
Add combat columns to the unit table. Open
data/units.jsonand give each row its fighting stats:Unit hprangedamagecooldownsightshotSpeedtrooper 40 5 6 0.8 8 30 hover tank 160 7 20 1.6 9 18 -
Count your army on screen. In a node editor, make a Simulacrum Behaviour graph and choose it as the scene’s Rules in Properties ▸ World ▸ Simulacrum. In the node editor sidebar’s Graph panel, press + beside Variables twice and name the variables
armyandkills. Then wire On Tick (interval 0.1 s) to a Call Component node with the ComponentRTSand the methodalive, and from it to a Set by Expression node that storesainarmy. Do the same with the methodkillsforkills. Game logic explains the node editor. -
Show the count. Add an empty with Add Component ▸ HUD & Menus ▸ HUD Text,
hud.text = Army {army} · Kills {kills}andhud.at = top. A name in braces shows that variable’s value. -
Give phones the order buttons. Add an empty with Add Component ▸ HUD & Menus ▸ HUD Choice Menu and set:
hud.menu = amove=⚔|hold=✋|stop=■hud.at = righthud.layout = padhud.touch = 1 -
Press ▶ Play. Select your whole army, press A and click near the red side. Your army fights its way in and wins.
Orders and stances
Section titled “Orders and stances”| Order | What the unit does |
|---|---|
| Move | Goes where you sent it and never fires on the way. Use it to pull an army out of a fight |
| Attack-move | Moves, but fights whatever comes into sight on the way, then carries on |
| Attack | Chases one enemy anywhere, round walls, until it dies |
| Hold | Never moves and fires only at what comes into range. A unit on hold is never shoved, not even by a column marching through it |
| Stop | Stops at once |
Idle units and units that have arrived pick fights on their own: the nearest enemy in sight with a clear line. A unit struck while idle turns on its attacker. Range is measured edge to edge, so a tank’s 7 m reach starts at its hull.
Line of sight and fog
Section titled “Line of sight and fog”- Rock blocks fire and sight. A shot needs a clear line, and so does seeing. Two troopers on either face of the ridge, well within range, never shoot.
- Shots fly. A shot travels at its unit’s
shotSpeedand lands when it reaches the target. If the target dies first, the shot fizzles. - Three tones of fog. Ground you have never seen is dark, ground you have seen before is dim, and ground your army sees now is clear. A rock face at the edge of sight is seen; what is behind it isn’t.
- Enemies only where you see them. An enemy, and its shots, are drawn only where your team sees them now. A right-click on an enemy you can’t see is a move, not an attack.
- Health bars appear over hurt and selected units. The bar turns red below 35 %.
Settings
Section titled “Settings”| Column | What it is |
|---|---|
hp |
Health |
range |
Reach in metres, edge to edge |
damage |
Health a hit takes off |
cooldown |
Seconds between shots |
sight |
How far it sees, in metres |
shotSpeed |
Metres a second (0 = the hit lands at once) |
| Tag | Values | What it does |
|---|---|---|
hud.menu |
action=label pairs, joined by a vertical bar |
The buttons a HUD menu shows. amove, hold and stop are the strategy orders |
hud.layout |
pad |
Draws the menu as a pad of buttons |
Next: economy and building.