Skip to main content

JARU 0.9.7: a scene editor, more speed on the boards and a refreshed IDE

· 8 min read
Jon Otero Fernández
Author of JARU
JARU 0.9.7Scene editorPerformanceESP32-S31IDE

JARU 0.9.7 is out. If 0.9.6 was the release of the physics engine and sound, this one is about making games faster and having them run better on the board: there is a scene editor to lay out rooms without writing the code by hand, the interpreter is noticeably faster and uses less memory on the ESP32, and the IDE gets a new look and a new sprite editor.

Before rebuilding your projects, read the breaking changes section: you need to flash the new firmware on your boards, and a few behaviour changes may require touching code.

Scene editor​

This is the big one. A scene is a room of your game —Level 1, the castle, the boss screen— and you lay it out in its own window in the IDE:

  • Tile, image and object layers, with parallax and repetition, and a camera that follows an object within its bounds.
  • Objects with behaviours you add without writing code: patrol, follow a route, chase or flee, platformer or top‑down control, health, animation, enemy spawners... Twelve in total, and each object can have its own mass, friction, bounce or gravity.
  • Room rules: when the player touches a coin, add points and destroy it; when they fall into a pit, lose a life and restart the room.
  • State machines: an enemy that patrols slowly and, when you get close, chases you fast.
  • Game variables and controls that carry over from one room to the next: score, lives, and the keys, the GPIO for each board or the buttons of a gamepad.
  • A problems panel that warns you before running about what will not work, and a Play button that runs the room in the VM without leaving the editor.

What matters is how it works inside: on build, each scene is translated into plain JARU code, an .aru file your game imports. The VM needs nothing special, so a room made in the editor works the same on Windows and on every board, and you can always open the generated code to see what it does. A game with many rooms can also load them as data with SceneLoad: the Build stores as data the rooms that have no behaviours, state machines, templates, variables or code of their own, and the game does not load the code of each one.

To get started, the new guide Your first game with rooms explains the game loop, how to switch rooms, and the title and game over screens. The StarterPlatformer and StarterTopDown examples in the IDE are templates ready to copy.

Faster and leaner on the board​

  • Superinstructions: the compiler fuses the most frequent bytecode sequences into single instructions. On JaruBench, 1.47‑1.48 times faster on ESP32, ESP32-S3 and ESP32-P4, and up to 2.5 times in tight loops. Nothing changes in the language.
  • Jump tables in the board interpreter: another 1.2‑1.7 on ESP32 and S3.
  • Partial screen updates on ESP32 and S3: Display.update() only sends to the LCD what changed.
  • Less internal RAM: tens of KB per game on the TTGO, between the heap without heap poisoning, strings in a single block and shared constants.
  • One BMP per sprite instead of one per frame: JaruGoody loads on the TTGO in 6 seconds instead of 49.

A fixed pace with Display.fps​

Being faster, a board draws frames without scrolling several times quicker than frames with scrolling, and a game that moves a fixed amount per frame changed speed depending on what was on screen. Now it takes one line:

Display.fps = 30          // 30 steps per second on every board

Display.update() waits for the next step and returns how many are due, in case the game wants to catch up on the late ones without drawing them; Display.dt gives the real seconds between frames. The details are in the Display guide.

Physics and collisions​

In the 0.9.6 announcement I warned about a limitation: the engine could not hold a stack of boxes. Now it does, also at 20‑30 fps on the board. On top of that, a spinning KINEMATIC body really hits (pinball flippers), and map collision gets a long round of fixes: one‑way platforms stepped on at the corner, rotated rectangles, grid.get with wrap, and a collider that flips with the sprite.

For games that resolve their own collisions, sprite.contacts() returns the normal and depth of each contact:

// Push the player out of the obstacles it is touching
var contacts = player.contacts(obstacles)
if (contacts != nil) then
foreach (var c in contacts)
var nx = c[1], ny = c[2], depth = c[3]
player.x += nx * depth
player.y += ny * depth
end
end

IDE​

  • JARU Slate: one dark style for every window, with blue kept for what is on or is the main action.
  • New sprite editor: undo, batch slicing, editable pivot and collider, and actors and poses. An actor groups a character's sprites and the IDE generates the code that loads them: var tiki = ActorTikiLoad().
  • Images and maps: rectangular selection with copy and paste, a tile grid, and Rect and Line tools in the map editor.
  • Running: Play no longer leaves a console open and what the game prints reaches the Output; Run on a board checks which firmware it carries and, if it is not the JARU VM, offers to flash it.
  • Some eighty fixes from a usability review, above all the ones that lost work without warning.

A new board: ESP32-S31​

There is a VM for the ESP32-S31 (ESP32-S31-Korvo-1 board), with an 800x480 RGB screen, USB keyboard and SD, and the IDE configures and flashes it like the others. And for any board with an I2C bus, support for the Adafruit Mini I2C Gamepad: you assign it in the game controls just like a key or a GPIO.

Breaking changes​

ChangeWhat to do
Programs compiled with 0.9.7 need the 0.9.7 firmwareFlash the VM on each board with Flash Firmware before uploading programs
/ between two integers is double precision and div is exactNothing, unless the program depends on the old rounding
nan == nan is false, as in any languageTo test for NaN, use v != v
A function without its end is a compile error (usually an else if, which in JARU is elsif)Fix the end or the elsif the error points to
grid.set and grid.clear only accept values from 0 to 255Out‑of‑range values throw an error instead of being clipped silently
flipX and flipY also flip the colliderCheck off‑centre colliders on sprites that flip
The sprite carries the pivot and collider from the sprite editorRemove any hand‑made compensation, if you had one

The full list, with the fixes and the known issues, is in the release notes, which are also installed with the IDE.

Download​

JARU IDE 0.9.7 for Windows is available on the site:

Unzip the file and run the installer inside it. If you already have the IDE installed, it will tell you there is a new version.

FAQ​

Do I have to rebuild my 0.9.6 projects?​

Yes. The bytecode and the sprites produced by the Build have changed, so they must be regenerated; the IDE does it when you build. Check the breaking changes table as well.

Do I have to flash my boards again?​

Yes, once: Flash Firmware on each board. A 0.9.6 firmware cannot run the new bytecode, and it gives no warning when it receives it: the program stops at the first new instruction with "Unknown Opcode encountered". If that happens, flash the firmware and press Run again. From 0.9.7 on, the VM itself refuses programs from a later version with a message.

Does the scene editor replace writing code?​

No. It generates plain JARU code that your game imports, and in each room you can add your own code, per object or on creation. Whatever the editor does not cover is still done as always.

Do I need an ESP32-S31?​

No. It is one more board. The release works the same on ESP32, ESP32-S3 and ESP32-P4, and development still starts in the Windows VM.