Log inGet started
World

First Light: Lavic Odyssey

Branchmain
Branchesmain
Commit1698ee71e5

README.md

game.rules.framing

Framing.solve(width, height) — the climb's follow camera, solved from the live screen rather than tuned for one.

local Framing = require("game.rules.framing")
local s = ui.screenSize()
local f = Framing.solve(s.width, s.height)
-- f.fov, f.cameraDistance, f.shoulderX / shoulderY / shoulderZ,
-- f.aimPitch, f.minPitch, f.maxPitch, f.verticalArmLength, f.sensitivity

Two rules do the work.

The field of view is chosen from how much of the world has to fit across the frame. A camera's fov is vertical, so a tall screen showing the same vertical angle as a wide one sees far less to the sides; on 3:4 the spire's own width would fill the frame and the way ahead would be a wall. Solving the vertical angle backwards from TARGET_HFOV keeps the climb readable sideways and hands the tall screen the extra vertical reach as a bonus — the lava below and the rim above in one picture.

The pilgrim's place in the frame is a fraction of the frame. The rig's shoulderOffset.y raises the point the camera aims at, which lowers the subject on screen; how far depends on how much world the frame covers, so the offset is computed from the visible height at the follow distance. The pilgrim then sits at SUBJECT_HEIGHT_FRACTION on every screen.

Screenvfovhfovdistanceaim height
1080x1440 (the filmed 3:4)74.058.94.752.17
1920x108044.071.45.881.92
2400x108044.083.85.901.93
1080x240074.037.54.702.16
1440x144062.062.05.032.05

MAX_VFOV binds on a very tall phone, where the horizontal angle narrows rather than the lens bending — a deliberate trade for a game whose subject is what is above and below you.

game.rules.Rules installs the result on the local player's camera and re-solves whenever the screen changes shape.