Axiom is a custom scripting language designed for readable game scripting and lightweight general programming.
Its design focuses on:
- explicit block endings
- simple object-oriented syntax
- clean function declarations
- game-friendly readability
- easy transpilation to Python-based runtimes
Axiom currently uses a compiler/transpiler approach. In the current toolchain, Axiom source code is compiled into Python code.
Use # for comments.
# this is a comment
Axiom supports local, global, and constant-style variables.
Create a local variable.
l. hp = 100
l. playerName = "Hero"
Create or assign a global variable.
g. score = 0
g. worldName = "Axiom"
Create a constant-style value.
c. VERSION = "0.1"
- local variables are typically scoped to the current function or block context in the transpiled output
- globals are intended for shared game state
- constants are naming conventions in the current implementation and may not yet be fully immutable
Functions are declared with f. and closed with fend.
f. functionName = (arg1, arg2)
# body
fend.
f. greet = (name)
log("Hello " + name)
fend.
Function parameters are written inside parentheses.
f. add = (a, b)
r. a + b
fend.
Use r. to return a value from a function.
r. value
f. double = (x)
r. x * 2
fend.
Classes are declared with cls. and closed with clsend.
cls. ClassName;
f. init = (self, ...)
# constructor body
fend.
clsend.
Use init as the constructor.
In the current compiler, init maps to Python __init__.
cls. Player;
f. init = (self, name, hp)
self.name = name
self.hp = hp
fend.
clsend.
Methods are normal functions inside a class block.
cls. Player;
f. attack = (self)
log(self.name + " attacks")
fend.
clsend.
cls. Character;
f. init = (self, name, health)
self.name = name
self.health = health
fend.
f. takeDMG = (self, damage)
self.health -= damage
fend.
clsend.
g. player = Character("Hero", 20)
player.takeDMG(10)
Axiom uses i., ef., e., and end for conditional logic.
Start an if block.
Start an else if block.
Start an else block.
Close the conditional chain.
i. hp > 0 do
log("alive")
ef. hp == 0 do
log("zero")
e. do
log("dead")
end
f. checkHP = (hp)
i. hp > 50 do
log("healthy")
ef. hp > 0 do
log("hurt")
e. do
log("down")
end
fend.
Axiom supports multiple import styles.
Import a module.
bring math
Import a module with an alias.
bring axiomplay.core as core
bring axiomplay.draw as draw
Import selected values from a module.
look math bring fabs
Import everything from a module.
look axiomplay bring a.
look axiomplay bring a. is the most convenient way to expose the common AxiomPlay modules directly.
Axiom supports decorator-style syntax with $.
$trace
f. test = ()
ign
fend.
Decorator behavior depends on compiler support. The syntax is reserved and intended for function or method metadata.
Print normal output.
log("Hello")
Print warning-style output.
warn("Be careful")
Print error-style output.
error("Something went wrong")
In the current Python backend, these are mapped to Python-side printing helpers.
Avoid naming your own functions print unless the compiler/runtime has protected built-in console output properly.
Do nothing.
Equivalent to pass in Python.
f. noop = ()
ign
fend.
Used inside class methods to refer to the current object.
self.hp = 100
Represents an empty/null value.
g. player = none
Boolean values.
l. alive = true
Axiom is indentation-sensitive inside blocks. Use one indentation level per nested block.
- inside
cls.: indent 1 level - inside
f.: indent 1 more level - inside
i. ... do: indent 1 more level fend.aligns withf.clsend.aligns withcls.endaligns withi./ef./e.
cls. Player;
f. update = (self, dt)
i. self.hp > 0 do
log("alive")
end
fend.
clsend.
cls. Player;
f. update = (self, dt)
i. self.hp > 0 do
log("alive")
end
fend.
clsend.
f. main = ()
log("Hello Axiom")
fend.
main()
f. add = (a, b)
r. a + b
fend.
log(add(4, 5))
cls. Enemy;
f. init = (self, name, hp)
self.name = name
self.hp = hp
fend.
f. hit = (self, dmg)
self.hp -= dmg
fend.
clsend.
g. e = Enemy("Slime", 30)
e.hit(10)
l. hp = 25
i. hp > 50 do
log("healthy")
ef. hp > 0 do
log("hurt")
e. do
log("dead")
end
AxiomPlay is the 2D game framework for Axiom. It is designed for windowed game applications and engine-style scripting.
AxiomPlay currently focuses on:
- creating and controlling the game window
- update/render loop management
- keyboard and mouse input
- drawing primitive shapes and text
- asset loading
- simple game state architecture
look axiomplay bring a.
cls. Player;
f. init = (self, x, y)
self.x = x
self.y = y
self.speed = 200
fend.
f. update = (self, dt)
i. input.keyDown("a") do
self.x -= self.speed * dt
end
i. input.keyDown("d") do
self.x += self.speed * dt
end
fend.
f. render = (self)
draw.rect(self.x, self.y, 60, 60)
fend.
clsend.
g. player = Player(100, 100)
f. load = ()
core.title("AxiomPlay Demo")
core.size(960, 540)
fend.
f. update = (dt)
player.update(dt)
fend.
f. render = ()
draw.clear(20, 20, 30)
player.render()
fend.
core.run(load, update, render)
Main game startup and window control.
Set the window title.
Parameters
text(string): window title text
Example
core.title("My Game")
Set the window size.
Parameters
width(number): width in pixelsheight(number): height in pixels
Example
core.size(960, 540)
Set the window icon.
Parameters
path(string): path to an image file
Example
core.icon("my_icon.png")
Start the main game loop.
Parameters
loadFn(function): called once at startupupdateFn(function): called every frame withdtrenderFn(function): called every frame for drawing
Example
core.run(load, update, render)
Rendering helpers.
Clear the frame using an RGB color.
draw.clear(20, 20, 30)
Draw a rectangle.
Parameters
x(number)y(number)w(number)h(number)
draw.rect(100, 100, 60, 60)
Draw a circle.
draw.circle(300, 200, 40)
Draw text on screen.
Parameters
message(string)x(number)y(number)
draw.text("Hello", 20, 20)
Draw an image/texture reference.
draw.image(playerSprite, 100, 100)
Draw a sprite with optional scale/rotation style parameters.
draw.sprite(playerTex, 100, 100, 1, 1, 0)
Keyboard and mouse input helpers.
Return whether a key is currently being held.
i. input.keyDown("a") do
log("moving left")
end
Return whether a key was pressed this frame.
i. input.keyPressed("space") do
log("jump")
end
Return whether a mouse button is currently held.
i. input.mouseDown("left") do
log("holding mouse")
end
Return whether a mouse button was pressed this frame.
i. input.mousePressed("left") do
log("clicked")
end
Return the current mouse x position.
l. mx = input.mouseX()
Return the current mouse y position.
l. my = input.mouseY()
Audio playback helpers.
Play a sound.
audio.play(hitSound)
Stop a sound.
audio.stop(hitSound)
Play music, optionally looped.
audio.music(bgMusic, true)
Asset loading helpers.
Load an image asset.
l. playerTex = assets.image("player.png")
Load a sound asset.
l. hitSound = assets.sound("hit.wav")
Load a font asset.
l. fontMain = assets.font("font.ttf", 16)
Simple camera holder.
Create a camera object.
Move the camera to follow a target with x and y properties.
l. cam = camera.Camera()
cam.follow(player)
Basic physics/collision helpers.
Create a box body.
l. body = physics.box(100, 100, 32, 32)
Return whether two bodies overlap.
i. physics.overlaps(hitbox, enemyBox) do
log("hit")
end
Body class with basic position and size properties.
Common fields:
xywhvxvysolid
Scene management helpers.
Create a scene.
Add an object/entity to the scene.
Scene startup hook.
Scene update hook.
Scene render hook.
Example:
cls. MainScene;
f. init = (self)
self.name = "main"
self.entities = []
fend.
f. render = (self)
draw.text("Main Scene", 40, 40)
fend.
clsend.
Base object helpers.
Create a base entity.
Common fields:
xyvisibleactivetag
Per-frame update hook.
Render hook.
Save/load helpers.
Write data to a save slot.
save.write("slot1", playerData)
Read data from a save slot.
l. data = save.read("slot1")
look axiomplay bring a.
bring math
cls. Player;
f. init = (self, x, y)
self.x = x
self.y = y
self.speed = 200
fend.
f. update = (self, dt)
i. input.keyDown("space") do
self.speed = 400
e. do
self.speed = 200
end
i. input.keyDown("a") do
self.x -= self.speed * dt
end
i. input.keyDown("d") do
self.x += self.speed * dt
end
i. input.keyDown("w") do
self.y -= self.speed * dt
end
i. input.keyDown("s") do
self.y += self.speed * dt
end
fend.
f. render = (self)
draw.rect(self.x, self.y, 60, 60)
draw.text(str(math.fabs(self.x)) + ", " + str(math.fabs(self.y)), 0, 0)
fend.
clsend.
g. player = Player(100, 100)
f. load = ()
core.title("AxiomPlay Demo")
core.size(960, 540)
fend.
f. update = (dt)
player.update(dt)
fend.
f. render = ()
draw.clear(20, 20, 30)
player.render()
fend.
core.run(load, update, render)
- Axiom currently transpiles to Python rather than compiling directly to native code
- language/runtime behavior still depends on backend implementation details
- some advanced features such as loops, decorators, and richer type semantics may still be incomplete
- text rendering behavior may vary depending on the runtime backend
- some modules are starter-framework level and may need further expansion for full production games
