code

HM2D DOCUMENTATION

Historical Note:

HM2D was first proposed on 4th of the 2nd, 2026.

I. Overview: The Philosophy of HM2D

HM2D (Historical Motion 2D) is a high‑performance, symbol‑oriented domain‑specific language for 2D game development, reactive UI systems, and temporal logic simulation. Its identity is built on Temporal Logic, Positional Symbolism, and Context‑Symmetry.

Meaning in HM2D is determined by symbol shape, symbol position, adjacency, and context. HM2D avoids English‑like commands and instead uses visual logic, allowing the compiler to parse shapes and spatial relationships at extremely high speed.

Time in HM2D is discrete and only exists when code is running.

II. Temporal Mechanics & The Active State Timeline

HM2D uses an Active State Timeline. When no code executes, the universe freezes.

Full‑Rotate n — Rewinds n temporal steps (“Subtraction of Present”).

Full‑Rotate 0 — Generates a dormant RNG packet (1–9).

Full‑Rotate –n — Expands RNG memory to 1–n (“Limit Break”).

Full‑Rotate ÷n — Visual Mode: rotates sprite physically n times.

III. Movement & Diagonal Vectoring

Movement is expressed through visual direction symbols.

Move^ n — Up

MoveV n — Down

Move< n — Left

Move> n — Right

Diagonal Vectoring:

Move^> n — Up‑Right

MoveV< n — Down‑Left

Max Dash Rule:

Move>

Moves until collision or screen edge.

Infinite Movement:

Move> 5 (*Forever*)

Move^> (*Forever*)

Runs every frame, persists until archive/erase/identity‑swap, is not a loop.

IV. Temporal Wait System

HM2D includes a native wait primitive for visible movement and pacing.

Syntax:

wait <time>

Units:

ms — milliseconds

s — seconds

Examples:

wait 100ms

wait 0.2s

wait 1s

Behavior:

Pauses execution of the current script.

Allows engine to render movement between steps.

Does not freeze the entire game.

Works in behaviours, timelines, overlays, identity logic, and cutscenes.

Example:

Move> 3

wait 0.1s

Move> 3

wait 0.1s

Move> 3

V. Print / Debug Output System

HM2D includes a print/logging primitive.

Syntax:

print <expression>

Examples:

print "spawned"

print hp

print "X:" x " Y:" y

Debug‑Scoped:

debug print "entered behaviour: stalk"

Example:

behaviour stalk

    print "stalking"

    Move> 2

    wait 0.2s

    print "step"

end

VI. Symbolic Key Mapping

on #KEY# key === ,script,

#S# — hardware key

=== — input bridge

, , — script capsule

Capsules prevent timeline confusion.

VII. Schrödinger’s Script & The Archive

Archived sprites store 50% visual data and 0% script data.

Scripts exist in source but not RAM until unarchived.

Thousands of off‑screen entities can exist with no cost.

VIII. Identity & Polymorphic Design

Sprites are Identity Containers with up to 7 designs.

Asterisk Tag:

if sprite=*Knight* : Move> 1

Erase & Draw:

Erase(*Knight*)

Draw(*Ghost*)

Identity swap resets script state.

IX. Boundary Triggers (Screen Logic)

OffScreen(fraction) detects fractional visibility.

Examples:

OffScreen(1/2) : Archive(sprite)

OffScreen(3/4) : GameOver

X. Commenting

// comment //

Comments occupy zero time and do not affect rewinds or timeline math.

XI. Symbol Placement Summary

Meaning depends on symbol position.

#ffffff — color hex prefix

#S# — keyboard input symmetry

id# — object ID suffix

Double‑check system:

First symbol = context

Second symbol = assurance

XII. Engine File Rules

Every HM2D project contains these default files:

Engine.HM2D

The core engine logic file. Always present. Can be renamed but cannot be deleted.

Graphics_Manager.HMDM2DAdvancedScript

The protected graphics controller. Cannot be renamed. Cannot be deleted. Only editable through HMDM2D developer mode.

File Naming Rules:

All normal scripts must follow:

[FileName].HM2D

All developer‑mode scripts must follow:

[FileName].HMDM2D

or

[FileName].HMDM2DAdvancedScript

Protected Files:

Graphics_Manager.HMDM2DAdvancedScript — undeletable, unrenamable

Core Engine Files — protected unless marked safe

Engine.HM2D — renamable but not deletable

XIII. Interactive Tutorial System

Built‑in tutorial engine with:

Challenge progression

Real‑time evaluation

Symbol‑level error detection

Adaptive difficulty

XIV. HMDM2D (Developer Mode Language)

Developer‑mode language with:

Script validation

Script existence checks

Deletion/repair

File explorer access

Output console

Developer module imports

Engine‑level operations

XV. Asset Creation

Sprite Creation:

Upload image → becomes sprite asset.

Audio Creation:

Upload audio → becomes audio asset.

XVI. Dictionary of All Syntax & Symbols

Movement:

Move^ n — Up

MoveV n — Down

Move< n — Left

Move> n — Right

Move^> n — Diagonal up‑right

MoveV< n — Diagonal down‑left

Move> — Max Dash

(*Forever*) — Infinite movement

Temporal:

wait n — Pause execution

Full-Rotate n — Rewind

Full-Rotate 0 — RNG packet

Full-Rotate –n — RNG expansion

Full-Rotate ÷n — Visual rotation

Debug:

print x — Output

debug print x — Debug‑scoped output

Input:

#A# — Hardware key

=== — Input bridge

,script, — Capsule

Identity:

*Knight* — Identity tag

Erase(*ID*) — Remove identity

Draw(*ID*) — Activate identity

Archive:

Archive(sprite)

Unarchive(sprite)

OffScreen(fraction)

Symbols:

#ffffff — Hex color

id# — Object ID

// comment // — Zero‑time comment

Engine:

Engine.HM2D — Default engine file

Graphics_Manager.HMDM2DAdvancedScript — Protected graphics controller

HMDM2D — Developer mode

Assets:

Upload Image — Sprite

Upload Audio — Audio asset

XVII. Trivia & Fun Facts

HM2D is developed alongside HM3D.

RNG defaults to 1–9 for minimal memory footprint.

Zero‑Logic: blank = 0.

HM2D is designed for symbolic clarity, not English‑like syntax.

Created by the HM2D Development Team