InScript

A game-focused scripting language. Statically typed, readable, and ships with 59 built-in game modules.

839 tests passing 59 stdlib modules Python 3.10+ Audit 9.2/10 MIT License
Get Started Try in Browser View on GitHub

Install

$ pip install inscript-lang
$ inscript --repl
$ inscript --version  # InScript 1.0.21

Requires Python 3.10+. Optional: pip install inscript-lang[game] for pygame.

Language at a Glance

// Structs with inheritance, operators, and priv fields
struct Vec2 {
    x: float  y: float
    fn +(o) { return Vec2{ x: self.x + o.x, y: self.y + o.y } }
    fn len() { return sqrt(self.x*self.x + self.y*self.y) }
}

// ADT enums + exhaustive pattern matching with guards
enum Shape { Circle(r: float)  Rect(w: float, h: float) }

fn area(s: Shape) {
    return match s {
        case Shape.Circle(r) if r > 10.0 { "large circle" }
        case Shape.Circle(r)           { 3.14159 * r * r }
        case Shape.Rect(w, h)           { w * h }
    }
}

// Arrow functions + method chaining
let scores = students
    .filter(fn(s) => s.active)
    .map(fn(s) => s.score)
    .filter(fn(n) => n >= 60)
    .sorted()

// Result type for safe error handling
fn divide(a: float, b: float) -> Result {
    if b == 0.0 { return Err("division by zero") }
    return Ok(a / b)
}
let r = divide(10.0, 2.0).map(fn(v) => v * 3.0).unwrap_or(0.0)

Game Modules

physics2d

RigidBody, StaticBody, World, collision callbacks, AABB and circle shapes

ecs

Entity-Component-System: spawn, query, mark_dead, remove_dead

pathfind

A* and Dijkstra pathfinding, flow fields, walkable grid

camera2d

Follow target, shake effects, zoom, world↔screen coordinate transforms

particle

Emitter with burst/continuous modes, color/size over lifetime

fsm

Finite State Machine with guards, on_enter/on_exit hooks, wildcard transitions

tilemap

Load Tiled maps, get layers/tiles/objects, coordinate helpers

animation

Clip, Animator, frame-based with fps/loop/duration control

save

Game save slots — write/read typed data, copy, delete, list

localize

Multi-language strings, interpolation, fallback, file loading

net_game

GameServer, GameClient, msgpack-style pack/unpack

audio

load/play/stop/volume/mute, music, positional audio

View all 59 modules →

Developer Tools

ToolCommandStatus
REPLinscript --repl✅ Complete
Formatterinscript --fmt file.ins✅ v1.0.19
Watch modeinscript --watch file.ins✅ v1.0.19
Test runnerinscript --test✅ v1.0.21
Static analysisinscript --check file.ins✅ Complete
LSP serverinscript --lsp✅ Complete
VS Code extensionSyntax highlighting + snippets✅ Complete
Web playgroundplayground.html✅ v1.0.23