A simple procedural language with hot code reloading
Find a file
2025-12-26 19:48:04 +02:00
assets/fonts init 2025-12-13 16:08:41 +02:00
benches bench there-she-is 2025-12-25 00:52:34 +02:00
games include in ayin-game 2025-12-26 19:48:04 +02:00
html trim deps and make wasm 2025-12-24 23:43:34 +02:00
programs include in ayin-game 2025-12-26 19:48:04 +02:00
src include in ayin-game 2025-12-26 19:48:04 +02:00
stdlib include in ayin-game 2025-12-26 19:48:04 +02:00
.gitignore trim deps and make wasm 2025-12-24 23:43:34 +02:00
Cargo.lock trim deps and make wasm 2025-12-24 23:43:34 +02:00
Cargo.toml separate ayin-game and ayin interpreter 2025-12-26 00:32:46 +02:00
LICENSE init 2025-12-13 16:08:41 +02:00
Makefile separate ayin-game and ayin interpreter 2025-12-26 00:32:46 +02:00
readme.md correct readme 2025-12-25 01:29:43 +02:00
rustfmt.toml init 2025-12-13 16:08:41 +02:00

Ayin 👁️‍🗨️

Programming language and games in 1 week inspired by Langjam Gamejam.

This is hackaton code. Don't expect much.

Main ideas

  • Tiny procedural language specifically for gamedev
  • Wrapped by a game framework
  • Only user input is controller input (or specific keyboard keys)
  • Basic types: int, float, string, bool, objects, arrays, first-class functions
  • if, loop, break, return
  • Live code reload

Basic example

let migrate = fn(state) {
    state
}

let setup = fn() {
  return {
    .color: {
	  .r: 0,
	  .g: 0,
	  .b: 100,
	},
  }
}

let update = fn(state, input) {
  let x = if input.gamepad1.dpad.up { 1 } else { 0 } + if input.gamepad1.dpad.down { -1 } else { 0 }

  let new_blue = state.color.b + x

  state.color.b = min(255, max(0, new_blue))
}

let draw = fn(state) {
  frame_clear(state.color.r, state.color.g, state.color.b)
}

let min = fn(a,b) {
  if a < b {
    a
  } else {
    b
  }
}

let max = fn(a,b) {
  if a < b {
    b
  } else {
    a
  }
}

Program interface

A program is consists of 4 functions.

  • let setup = fn() -> state - create a state object for your program. Runs at the start of the program.
  • let update = fn(state, input) - update the state using user inputs at each game loop cycle.
  • let draw = fn(state) - draw the state to the screen at the end of each game loop cycle.
  • let migrate = fn(state) -> state' - update the game state to a new start, runs on live reloading.

Live reloading

  • Live code reloading watches the file for changes and updates the code between game loop cycles while keeping the state.
  • The migrate function is used to migrate the state value for when the structure of the state changes.

Build instructions

Non-web

To run There-she-is:

make run

On Fedora, required for hot code reloading:

sudo dnf install systemd-devel

WASM

Requires to build for wasm:

rustup target add wasm32-unknown-unknown
make wasm

Go to html/ and start a web server.