JAGGAME

DESCRIBE A GAME IN V
AND GET 68000 MACHINE CODE
WITHOUT WRITING ONE INSTRUCTION

jaggame goes a step further than jagkit and takes the assembly away too. A program describes itself (variables, logic, sprites, rooms, scenes, sound) to a builder. The builder checks it, compiles the logic to 68000 code, links it with a fixed runtime and writes a .jag image, plus a .j64 cartridge image for a board with the save chip.

THE SAME DESCRIPTION ALSO RUNS IN AN INTERPRETER WRITTEN IN V.

A FUZZER FEEDS RANDOM PROGRAMS TO BOTH
AND CHECKS THEY END UP IN THE SAME STATE.

A BALL, IN TWENTY LINES

It builds and runs: v run it, then just run ball.jag.

mut g := jaggame.new_game(jaggame.Config{ sprites: 1, layers: 1 })
g.art_cry('ball', 16, 16, 1, []u16{len: 256, init: jaggame.cry(255, 160, 40)})
ball := g.sprite(0)
hud := g.text_layer('hud', jaggame.TextConfig{ columns: 16, rows: 1, x: 8, y: 8 })
steps := g.p.u16('steps')

mut init := g.define_init()
ball.put(mut init, 'ball', 152, 112, 0)
hud.print(mut init, 0, 0, 'STEPS')

mut c := g.define_update()
c.if_(g.held(.left))
c.sub_from(ball.x, 2)
c.inc(steps)
c.end()
c.if_(g.held(.right))
c.add_to(ball.x, 2)
c.inc(steps)
c.end()
hud.number(mut c, 6, 0, steps, 5)
os.write_file_array('ball.jag', g.build()!.bytes)!

WHAT YOU GET

PARTWHAT IS IN IT
A small typed languageu8 to u32, fix (16.16), bool, arrays, tables, records, functions, state machines. Types, sizes and memory are checked when the image is built; every mistake comes out together, with its place.
A runtimeA frame loop for NTSC and PAL, sprites, text layers, timers, tile rooms bigger than the screen with a camera and collision, line of sight and hearing, scenes with a fade between them, menus.
SoundA six-voice DSP synthesizer with effects and music written as text patterns.
SavesA saved record in the cartridge's EEPROM.
A GPU backdropA drifting neon grid with a sweeping bar and a scrolling gradient, as the first object of the display list.
AssetsPNG files to sprites, tile sets and palettes; rooms as text with a legend.
Tested twiceA differential fuzzer runs random programs in the interpreter and on the emulated 68000. A robot plays GHOSTGRID through the pad.

THE BIG ONE: GHOSTGRID

GHOSTGRID gameplay

A stealth trainer with ten missions, written on jaggame with no assembly in it. Guards with a state machine (patrol, suspicious, alert, search, return) throw a cone of amber light on the floor that walls cut, and the cone is exactly what sees you. Cameras sweep cones of their own and call the guards.

The interpreter plays whole missions alongside the machine and the two agree frame by frame.

MORE ABOUT GHOSTGRID >>

THE GUIDE: SIX CHAPTERS

  1. the language
  2. the runtime
  3. assets, rooms and collision
  4. state machines, actors and guards
  5. scenes, menus, sound, save data and the backdrop
  6. missions as data, cameras, ranks and the record
READFOR
docs/jaggame/guide.mdthe guide, from the language to GHOSTGRID's missions
docs/jaggame/reference.mdevery public name, generated from the source comments
jaggame/README.mdwhat it is, in twenty lines of code
v -prod test jaggame/ demos/hello2/ demos/ghostgrid/    # all of it, about four minutes