Skip to content
Shiraishi_AKi edited this page Oct 6, 2026 · 1 revision

Camera

English | ็น้ซ”ไธญๆ–‡ | ๆ—ฅๆœฌ่ชž | ํ•œ๊ตญ์–ด

BIT8_CLI provides a Camera system for controlling which part of the game world is visible.

In BIT8_CLI 0.1.0, Cameras are associated with Map data and affect world-space rendering.

The game uses a fixed 64 ร— 64 pixel viewport.

1. Camera Overview

A Camera defines the center of the visible game world.

The framebuffer resolution remains:

64 ร— 64 pixels

A Map may be much larger than the viewport.

The Camera determines which part of that larger world appears on screen.

2. Camera and Map

Camera data is stored as part of the Map system.

A .b8map file can contain:

  • Tile data
  • Nodes
  • Cameras

The Camera allows the Runtime to display different areas of the Map without changing the framebuffer resolution.

See Maps for more information.

3. Camera Position

A Camera has a position in world coordinates.

Its position represents the center of the viewport.

For example:

Camera position: (100, 80)
Viewport size:   64 ร— 64

Conceptually, the visible world area extends approximately 32 pixels from the Camera center in each direction.

This gives an approximate visible region of:

X: 68 to 131
Y: 48 to 111

The exact pixel boundaries depend on the Runtime's coordinate and rounding rules.

4. World Coordinates

World coordinates describe positions inside the game world.

Examples include:

  • Map Tiles
  • Nodes
  • Node Sprites
  • World-space drawing operations

When a Camera is active, supported world-space rendering is transformed relative to the Camera.

This allows the viewport to display different parts of the game world.

5. Screen Coordinates

Screen coordinates describe positions directly inside the framebuffer.

The screen ranges from:

X: 0 to 63
Y: 0 to 63

Some drawing operations use screen coordinates.

For example:

cls(0)
pix(32, 32, 7)

These operations remain screen-space and are not shifted by the active Camera.

This is useful for interface elements and screen overlays.

6. World-to-Screen Conversion

A simplified Camera transformation can be expressed as:

screen_x = world_x - camera_x + 32
screen_y = world_y - camera_y + 32

For example:

World position:  (100, 80)
Camera position: (100, 80)

Screen position: (32, 32)

An object at the Camera's center appears near the center of the screen.

This formula illustrates the concept.

The Runtime's exact pixel placement may depend on its integer coordinate rules.

7. Active Camera Selection

A Map can contain Camera entries.

BIT8_CLI 0.1.0 selects the active Camera using the following established rule:

The enabled Camera with the smallest ID is selected.

This provides deterministic Camera selection when multiple Cameras exist.

For example:

Camera ID 1 โ†’ Disabled
Camera ID 2 โ†’ Enabled
Camera ID 3 โ†’ Enabled

The active Camera is:

Camera ID 2

8. Camera and Tile Rendering

Map rendering uses world coordinates.

When a Camera is active, the Map is drawn relative to the visible world region.

For example:

func draw()
    cls(0)
    map()
end

The Camera determines which portion of the Map appears inside the 64ร—64 framebuffer.

9. Camera and Sprites

Node Sprites use world positions.

When a Camera is active, supported Sprite rendering is transformed into screen coordinates.

For example:

func draw()
    self:spr()
end

The Node retains its world position.

The Camera affects where its Sprite appears on screen.

See Sprites and Animation for more information.

10. Camera and UI

A game may need graphics that remain fixed on screen.

Examples include:

  • Health indicators
  • Counters
  • Menus
  • Screen overlays

Screen-space drawing is useful for these elements.

For example:

func draw()
    cls(0)
    map()

    pix(32, 32, 7)
end

Here, pix() draws at a fixed screen coordinate.

The Camera does not shift that pixel.

11. Camera Editing

BIT8_CLI's VS Code Map Workspace includes Camera visualization.

This helps developers inspect Camera positions while editing a Map.

Camera data belongs to the Map project data.

The Runtime is responsible for selecting and applying the active Camera.

See Map Workspace for details.

12. Camera and Viewport Size

BIT8_CLI 0.1.0 uses a fixed framebuffer resolution:

64 ร— 64 pixels

The Camera changes the visible world area.

It does not change the underlying framebuffer resolution.

A larger Map can therefore be explored through a small viewport.

13. Current Limitations

The established Camera system in BIT8_CLI 0.1.0 focuses on:

  • Camera entries in Map data
  • World-space rendering offsets
  • A fixed 64ร—64 viewport
  • Deterministic active Camera selection
  • Screen-space drawing operations

Features such as advanced Camera effects, cinematic transitions, and a general-purpose Camera scripting framework are not part of the established 0.1.0 feature set.

Next

The Core Systems documentation continues with the development tools.

CLI Reference

Related documentation:

The Map defines the world. The Camera decides what you see.

Clone this wiki locally