Cameras
The field is seen through a perspective camera that follows the player from above and behind. Three numbers frame it: how far it tilts down (pitch), how far back it is (distance) and how wide it sees (field of view). The DS games use a narrow field of view from far away, which is why their towns look almost flat and every cell of ground is nearly the same size. How the originals do it is on Field cameras. This page is what you set.
There are three levels, from the widest to the narrowest:
| Level | Where | Lasts |
|---|---|---|
| A preset for the whole map | camera in map.toml |
always |
| A camera zone over part of the map | a camera object in Tiled |
while the player is in it |
| A move from a script | cammove, campan and the others |
until camreset or the map is left |
Presets
Section titled “Presets”A map names its camera in its map.toml:
camera = "interior"| Preset | What it is | Use it for |
|---|---|---|
default |
Tilted 59° down, a 16.2° field of view, far back: the generation-4 outdoor framing | towns, routes, caves |
interior |
Tilted 50°, a 7° field of view, further back still: nearly flat | rooms |
orthographic |
No perspective at all: every cell of floor the same size on screen | rooms drawn as the generation-4 games draw theirs |
Imports name the original game’s own presets (ref:0 to ref:16, hg:0 to
hg:15), which the importer chooses map by map. They are listed in the
map.toml reference. The sample’s town, garden, hill
and weir use default; its home and parlour use interior.
A preset is a whole framing, not three numbers to tune per map, because a game’s look depends on its maps agreeing. If one route had a slightly nearer camera than the next, the player would see the world change size at the border.
A camera zone changes the framing in part of a map: a street seen lower and
closer, a bridge from further back, a hall from one fixed point. Draw a rectangle on
the events layer (hold Ctrl to snap it to the cells) and give it the class camera.
When the player walks in, the camera eases into the zone’s framing; when they walk
out, it eases back. Inside the zone it still follows the player, unless the zone pins
it.
| Property | Meaning | Without it |
|---|---|---|
pitch |
Tilt down in degrees, 20 to 70. Lower shows more of fronts and faces, less of the ground. | the map’s |
distance |
How far back, in sixteenths of a cell, 96 to 1600. Nearer is larger. | the map’s |
fov |
Field of view in degrees, 4 to 40. Wider is more perspective. | the map’s |
blend |
Ticks (60 a second) to ease in and out | 30 |
offset_x, offset_y |
Cells to look ahead of the player, east and south (negative: west and north), -12 to 12 | 0 |
offset_up |
Cells above the player’s feet to look at, -12 to 12 | 0 |
pin |
true: the camera stays on one point and does not follow |
follows |
pin_x, pin_y |
The cell it is pinned to | the zone’s middle |
For example, a high street seen lower and closer, easing in over a second:
events layer: a rectangle, class "camera", over the street's cells pitch = 45 distance = 600 blend = 60The sample has no camera zones; its scenes move the camera from scripts (below).
How zones combine:
- Where zones overlap, the first in the layer wins. Put a small zone above the large one it sits in.
- Arriving on a map inside a zone shows its framing at once, behind the fade.
Walking from one zone into another eases between them over the new one’s
blend. - A script that moves the camera holds it: zones wait until the script gives it back
with
camreset. - A zone in an
orthographicmap stays orthographic: itspitchtilts it, and itsdistanceandfovsize it. - At most 16 zones a map.
A zone over a warp and the cell it is arrived on is an entrance camera: see The joined world.
A lower camera must come closer
Section titled “A lower camera must come closer”The engine draws the ground within about ten cells north and eleven south of what the camera looks at. That bound is what keeps a view inside the DS’s 2,048 polygons and its video memory. A camera tilted lower sees further north, so the build refuses a zone that would show past what is drawn, and says how close it may be. With the usual field of view (16.2°):
pitch |
20 | 30 | 40 | 45 | 50 | 60 | 70 |
|---|---|---|---|---|---|---|---|
furthest distance |
208 | 400 | 560 | 640 | 720 | 848 | 944 |
The interior preset’s narrow field of view sees much less, so an indoor zone may stay
further back. A wider fov sees more and must come closer still. A wide field of
view at a low tilt is what shows the most polygons: check such a zone on the DS before
relying on it.
Script cameras
Section titled “Script cameras”Scripts move the camera for scenes. Each command eases from where the camera is to
the framing asked for over ticks (60 a second, 30 if not given, 0 at once) and
waits until it is there, unless it ends in wait: false.
| Command | What it does |
|---|---|
cammove pitch: 38, distance: 420, ticks: 90 |
A new framing: tilt in degrees, distance in sixteenths of a cell, fov in tenths of a degree. What is left out stays. |
campan x, y, [ticks] |
Looks at a cell and stays there, whoever moves. At most 8 cells from the player. |
camfollow who, [ticks] |
Goes to an actor and follows it |
camera who |
The same at once |
camreset [ticks] |
Back to the map’s or the zone’s framing, following the player |
camwait |
Waits for a move given with wait: false |
shake strength, ticks |
Shakes the picture from side to side |
ease (inout, in, out, linear) sets how a move speeds up and slows down. A
script’s fov is in tenths of a degree because scripts have no decimals; a zone’s is
in degrees because Tiled has them.
The sample’s town shows the field station the first time the player comes up the path, by moving a stand-in the camera follows:
on step area(29, 26, 5, 1) when !SAW_STATION { lock set SAW_STATION place marker, xof(player), yof(player) camera marker move marker, [speed(slow), up * 4, pause(60)] say "One window is still lit." closetext move marker, [speed(fast), down * 4] camera player release}The same scene with the camera commands, easing instead of stepping:
on step area(29, 26, 5, 1) when !SAW_STATION { lock set SAW_STATION campan 31, 22, 90 # slowly up the path to the station's door say "One window is still lit." closetext camreset 30 # back to the player release}Things to keep in mind:
- In
on loadonlyticks: 0makes sense: the picture is not up yet, so the move sets where the camera starts when the screen fades in. - A camera move, a fade and a message can run together: give the move with
wait: false, then the fade or thesay, thencamwait. - Keep a lowered camera within the table above, or the top of the screen shows the clear colour. The game notes it once in its log.
- Leaving the map gives the camera back to the next map’s framing.
Multiple players
Section titled “Multiple players”In a co-op game the camera looks at the middle of the players. [coop] camera = "zoom" also pulls it back to fit them, by at most zoom_max cells. See
Co-op.
Planned
Section titled “Planned”Planned (plan 25, plan 20): yaw, a camera turned away from north, as generation-5 games turn theirs in streets. The zone record already keeps room for it.
Planned (plan 25): areas blended by position, where the framing changes gradually across an area instead of easing in time; round areas and boundaries the camera does not cross.
Planned (plan 25, plan 20): keyframed camera paths for scenes and for maps built on curved paths: a framing at each point, interpolated along the way.
Planned (plan 25): a [camera] group in game.toml with the game’s own table of
presets, so a game names its framings once and its maps choose among them.
Planned (plan 20): pieces marked cutaway, hidden or drawn see-through when they come
between the camera and the player, for tall buildings.