All docs

Vector Editor

Draw and edit .vec vector assets — the building blocks for every sprite, platform, and background in a VPy game.

The Vector Editor opens automatically when you create or double-click a .vec file. It is a 2D (and optionally 3D) path editor that works directly in Vectrex coordinate space (−128 to +127 on both axes).

Vector Editor with a player character drawn — canvas in the centre, layers panel on the left, properties on the right


Canvas and coordinate system

The canvas shows the Vectrex screen boundary as an outlined rectangle. The origin (0, 0) is in the centre. X increases to the right; Y increases upward — the same convention used in your VPy code.

Use scroll wheel to zoom (1×–8×) and middle-mouse drag to pan.

Game units

A .vec normally stores Vectrex beam units, which is what the console draws. A sprite traced from an arcade game can instead be stored in game units ("units": "game" in the file): one arcade pixel per unit, so an arcade grid of steps of 4 or 8 survives exactly instead of being rounded to beam units. One game unit is 110/127 of a beam unit, and the editor draws it at that scale, so what you see stays 1:1 with the console. Only the grid you edit in changes, not the size.


Tools

ToolShortcutUse
SelectSClick or drag-box to select points; drag to move
PenPClick to add points to the current path
LineLDraw straight two-point segments
BezierBDraw smooth curves with tangent handles
PolygonGPlace a regular polygon (set sides in properties)
CircleCDraw a circle approximated as a polyline
ArcADraw an arc segment
Walkable AreaWPaint a horizontal shelf where enemies can walk (used by the wander AI)
PanSpace+dragNavigate the canvas without deselecting

Layers

The left panel lists every layer in the file. Each layer contains one or more paths.

  • Click the eye icon to toggle layer visibility.
  • Click a layer name to select all paths in it.
  • Use the + Layer button to add a new layer.
  • Drag layers to reorder them (draw order, bottom to top).

Layers panel — three layers listed, middle layer selected, paths visible in the tree


Path properties

Select a path to edit its properties in the right panel:

PropertyDescription
IntensityBeam brightness of the whole path, 0–127. Higher = brighter.
SegmentsOne brightness per segment of the path (1→2, 2→3…), 0–127, where 0 turns that segment off.
ClosedConnect the last point back to the first.
NameOptional label, used for debugging.

Select individual points to move them by dragging or by typing coordinates in the input fields.

Per-segment intensity

Each segment of a path can have its own brightness. The Segments list in the path's panel shows every segment with its own value, and you edit it there directly, without selecting points first. Set a segment to 0 to turn it off. Selecting segments on the canvas and setting an intensity applies it to those segments only. The selection is named in the status bar (segment 3, or 4 segments).

Per-segment intensity is drawn by the SDK as well as the editor, so the game shows what you see here.


Walkable areas

Switch to the Walkable Area tool and drag horizontally across a platform to define the shelf where enemies patrol. Each area has a Y level, an x_min, and an x_max. The Playground editor reads these to derive enemy patrol routes automatically.

Walkable area drawn across a platform — green horizontal band with handles at each end


Views and 3D

Four buttons, one per view, sit above the canvas, and the keys 1–4 do the same when the canvas has focus:

ButtonKeyView
XY1Front view (X-Y), the normal 2D view
XZ2Top view (X-Z)
YZ3Side view (Y-Z)
3D4Perspective view

In the 3D view, middle button + Shift drag orbits the view; middle-button drag alone pans. Paths stay flat (Z = 0) unless you give points a Z coordinate. A sprite with Z values is a 3D wireframe that DRAW_VECTOR_3D draws turned in space.


Background image

Drag any PNG or JPG onto the canvas to load it as a tracing reference. Use the opacity slider to dim it while drawing. The image itself is not saved in the .vec file — it is editor-only.

The fit menu decides how the image sits on the screen:

FitUse
stretch to screenFill the Vectrex screen, ignoring the aspect ratio
fit width (keep aspect)Fill the width, keep the proportions
1:1 pixelsOne image pixel per unit
1:1 centeredThe same, centred on the origin
arcade playfield (224x256)Place a 224×256 arcade screenshot where the game's playfield sits on the Vectrex screen, for tracing arcade graphics

The Edge Detection button (Canny algorithm) processes the background image and overlays detected edges as a guide. Adjust the threshold sliders to tune sensitivity.

VectorEditor with a background reference image loaded and edge detection overlay active


Import

File → Import supports:

  • DXF — 2D CAD drawings. Select the XY, XZ, or YZ plane to project onto.
  • OBJ — 3D meshes. The editor extracts silhouette edges and projects them to a flat plane.

Both formats are converted to polyline paths. Adjust the angle threshold to filter edges by sharpness.


File format

.vec files are plain JSON. A minimal example:

{
  "version": "1.0",
  "name": "player",
  "canvas": { "width": 256, "height": 256, "origin": "center" },
  "layers": [
    {
      "name": "body",
      "visible": true,
      "paths": [
        {
          "name": "outline",
          "intensity": 127,
          "closed": true,
          "points": [{"x": 0, "y": 10}, {"x": 8, "y": -10}, {"x": -8, "y": -10}]
        }
      ]
    }
  ]
}

Using it from VPy and C

A .vec lives in assets/vectors/ and is named by its file name without the extension (ship.vec is "ship").

LanguageHow to draw itTargets
VPyDRAW_VECTOR("ship", x, y), DRAW_VECTOR_EX("ship", x, y, mirror, intensity), DRAW_VECTOR_3D("ship", ax, ay, az, x, y) (points with z), DRAW_VECTOR_ROT("ship", x, y, angle)m6809, rp2350, uvm2, pitrex
C#include "ship.h", then DRAW_VECTOR(SHIP_vec, x, y) or DRAW_VECTOR_ROT(SHIP_vec, x, y, angle) (DRAW_VECTOR_ROT_EX adds mirror and intensity). The project's Makefile compiles the .vec to gen/ship.hWASM simulator, rp2350, uvm2

mirror is 0 for none, 1 to flip X, 2 to flip Y, 3 for both. angle runs 0–127 for one full turn counter-clockwise (32 = 90 degrees). Every point is a beam move, so keep point counts low. See VPy and C for how the two languages share the runtime.