Field cameras
The DS games of generations 4 and 5 draw their world in 3D, but it rarely looks like it. Towns read almost like a flat map; every cell of ground is nearly the same size from the top of the screen to the bottom; buildings show their fronts and a little of their roofs. That look comes from one choice of camera, not from the art. This page explains that choice and how PokeLoom reproduces it. What a creator sets is on Cameras; how the 3D engine turns a camera into pixels is on The 3D engine.
A perspective camera has three numbers that decide what a scene looks like:
| Number | What it does |
|---|---|
| Pitch (tilt) | How far the camera looks down. Straight down shows only roofs; level shows only fronts. |
| Distance | How far back from what it looks at. |
| Field of view | How wide an angle it sees. Wide is a strong perspective; narrow is nearly flat. |
The field of view and the distance trade against each other. A wide lens close to the player and a narrow lens far away can show the same width of ground at the player’s feet. What differs is everything else. With a wide lens close by, the ground near the bottom of the screen is much nearer to the eye than the ground at the top, so near cells are drawn large and far cells small, and tall things lean outward at the screen’s edges. With a narrow lens far away, the near and far ground are almost the same distance from the eye, so they are drawn almost the same size and walls stay upright.
The generation-4 games use the second: a field of view of a few tens of degrees or less, from many cells away, tilted steeply down. The result is close to an orthographic picture (one with no perspective at all) while still being real 3D: the depth buffer sorts what is in front of what, roofs and walls are lit as faces, and the camera can still move.
There is a second reason for the choice. The DS’s screen is 256 pixels wide, and the games’ art is drawn so that one cell of ground is 16 pixels across where the player stands. A near, wide camera would make cells at the top of the screen smaller than that and cells at the bottom larger, and every texture and character sheet would be scaled away from its pixels. A narrow, far camera keeps nearly every cell at its drawn size, so pixel art stays crisp.
What the camera looks at
Section titled “What the camera looks at”The camera looks at the player’s position on the ground. Across and along the map it follows the player exactly, every frame, so walking feels rigid and precise. Its height follows a fraction of a second late: walking up stairs, the player rises first and the view catches up. A hop down a ledge is drawn as a lift of the sprite, so the camera does not bob with it.
Presets
Section titled “Presets”A preset is a whole framing: a pitch, a distance, a field of view, and the near and far planes that bound what is drawn. The games keep a small table of them, and each map’s header names one. Most outdoor maps share one preset, so the world keeps one scale as the player crosses from a route into a town. Rooms usually take another, and a few special places take their own: a steep camera over a gym puzzle, a lower one for a dramatic hall, a nearer one in a cave.
Two details of the generation-4 tables matter for anyone matching them:
- Every preset shows about the same height of world at the target. A preset may be steeper or flatter, nearer or further, but its field of view is chosen with its distance so that a cell is still 16 pixels across where the player stands. Only the tilt and the strength of the perspective change.
- Rooms can be orthographic. Some room presets turn perspective off entirely: every cell of floor is exactly the same size on screen. Rooms then look like a drawn floor plan seen at an angle.
A change of preset happens behind the fade of a warp: it is instant and never seen. Generation 4 has no blending between presets.
How PokeLoom models presets
Section titled “How PokeLoom models presets”A map names its preset in map.toml (camera = "interior"). The engine has three
built-in presets of its own:
| Preset | Framing |
|---|---|
default |
Tilted 59° down, a 16.2° field of view, far back: the generation-4 outdoor framing |
interior |
Tilted 50°, a 7° field of view, further back still: nearly flat |
orthographic |
No perspective: every cell of floor the same size |
An imported game’s maps name the original’s own presets, which the importer chooses map by map. Those are read from the game the creator owns and never ship with the engine. The map.toml reference lists the names.
Planned (plan 25): a [camera] group in game.toml holding the game’s own table of
presets, so any game, imported or original, names its framings once and its maps
choose among them.
Camera areas
Section titled “Camera areas”Some places need a different framing in part of a map: a lower view down a long bridge, a fixed view of a hall, a camera that looks ahead of the player at a cliff edge. The generation-4 games mostly do this with scripts. Generation 5 makes it data: a map holds camera areas, and the camera changes as the player walks into one.
PokeLoom’s form of this is the camera zone: a rectangle drawn on a map’s events layer, with its own tilt, distance, field of view, look-ahead offset, height and optionally a pin to one point. Walking in, the camera eases into the zone’s framing over a number of ticks; walking out, it eases back. A zone placed over a warp’s arrival cell is an entrance camera: the player arrives already framed by it.
The engine holds three framings at once, the map’s, the zone’s and a script’s, and shows the first of script, zone and map that exists. Whenever that changes, it blends from where the camera is to the new framing with an ease. All of it is whole numbers and fixed point, one update a tick, nothing allocated, so it runs the same on desktop and DS.
A camera tilted lower sees further toward the top of the screen. The engine only draws ground within a fixed distance of the camera’s target (that bound keeps a view inside the DS’s 2,048 polygons and its video memory), so the build refuses a zone that would show past it. The table of safe distances is on Cameras.
Generation 5
Section titled “Generation 5”Generation 5 keeps the narrow, far-off lens but lets it move much more:
- Yaw. A framing may turn the camera away from north, so a street can be seen along its length or from a corner. Character cards still face the screen, so which frame of a sheet looks right depends on the turn as well as on where a character faces.
- Areas blended by position. Inside an area, the framing is not eased over time but set by where the player stands between two edges: walk halfway along a street and the camera is halfway between its two framings. Walking back undoes it exactly.
- Round areas. A circle that keeps the camera aimed at a centre, or looking from a fixed eye, while the player walks around inside it.
- Boundaries. Up to a few rectangles or circles that keep the camera’s eye or target inside, or outside, a shape, so it never shows past the edge of the drawn world.
- A trailing camera. The camera may lag behind the player a little in every direction, not only in height.
- Cameras along paths. Some big-city maps are built on curved walkways where each point and segment of the path carries its own framing, interpolated as the player walks. The camera turns and tilts along the street so the way ahead stays open and buildings never stand between the camera and the player.
- Event cameras. Scripts move the camera to stored framings, bind it to an actor, shake it, and play keyframed camera paths in cutscenes.
How PokeLoom models them
Section titled “How PokeLoom models them”Each of these is a general feature of the one camera rig, not a mode for one game. Today the rig has tilt, distance, field of view, a look-at point with an offset, zones, entrance cameras and script moves. An imported generation-5 game’s camera setups become presets and whole-map zones, without the turn.
Planned (plan 25, plan 20): yaw in the framing and in the choice of character frames; the zone record already keeps room for it.
Planned (plan 25): areas blended by position, round areas and boundaries, each a kind of zone on the same rig.
Planned (plan 25, plan 20): keyframed camera paths, for scenes and for maps built on curved paths, with a framing at each point.
Planned (plan 20): pieces marked cutaway, hidden or drawn see-through when they come
between the camera and the player, for creators who would rather not frame every
street by hand.
Scripted cameras
Section titled “Scripted cameras”Both generations move the camera in scenes. Generation 4 often does it by moving an invisible stand-in object with a movement list and letting the camera follow it, then putting the camera back on the player. Generation 5 has commands that move to a framing, pan, bind and shake.
PokeLoom offers both ways. A script can move a stand-in actor and camera it, or use
cammove, campan, camfollow, camreset and shake, each eased over a number of
ticks. The commands are on Cameras and in the
script reference.
PokeLoom
Section titled “PokeLoom”The engine never asks which game it runs. A game’s camera is a set of values: presets, zones on its maps, and the moves its scripts make. Platinum’s look and HeartGold’s look are two tables of presets; generation 5’s look is the same rig with more of its features in use. An original game can take a generation-4 framing on its routes and a generation-5 style street camera in its city, because they are the same system.
In co-op on one machine the camera looks at the middle of the players and can pull back to fit them; see Co-op.