Crash-tan
1.59.0 Released!
Crash BASIC 1.59.0 Release Notes
written by Crash-tan
Telling the renderer something it already knows is now free. Not cheaper —
free. The command is dropped before it is sent.
Say it as often as you like
1.58.0 did this for SET SCROLL, because a scrolling backdrop showed how much
it mattered: re-asserted every pass of an unpaced loop, it accounted for 93% of
everything the graphics engine was asked to do. This release extends the same
rule to the rest of the statements that are a pure function of what you pass
them — where issuing one twice leaves the renderer exactly where issuing it
once would.
That covers most of what a render loop repeats:
SET SPRITE 3, x, y, "ship" ' position, image, layer, the lot
SHOW SPRITE 3 / HIDE SPRITE 3 ' visibility
ENABLE SPRITE 3 ' slot state
SET LAYER 1 ALPHA(.8) WRAPY ON ' layer alpha, wrap and clip
SET LAYER 1 AFFINE ZOOM(2) ' plane reprojection
SET SCROLL 0, y ' scroll and camera angle
SET POLYGON 0 COLOR 5 FILL 6 ' bound shapes
SET CURSOR "pointer" ' cursor
GAMEPAD ALPHA .4 ' on-screen padWrite them unconditionally. Put them in the loop. If the value has not changed
since last time, nothing leaves your program.
What this does not change is when things happen. A value that genuinely
moves every frame is sent every frame, because that one is not a repeat — it is
animation, and it is what you asked for. Nothing is delayed, batched or held
over to a later frame. The only thing that disappears is a message whose
arrival would have changed nothing.
What still goes every time
Plenty of statements look repeatable and are not:
- Drawing primitives.
LINE,PSET,CIRCLE,POLYGONandPUTIMAGE
composite onto whatever is already on the layer. At less than full alpha,
drawing the same line twice is visibly darker than drawing it once — so the
second one is not a repeat, it is a second stroke. CLSwith anEFFECT, which restarts the wipe;SET LAYER ANIMATION
and a sprite'sPATTERN, which restart a cycle.EMITPARTICLE, which spawns another particle;PRINT, which advances
the cursor;BOUNDARY ADD, which adds another boundary.BEGIN FRAME/END FRAME, which count.- Anything that waits for an answer —
SETFONT,SET SPRITE SHADERandSET LAYER SHADERask the renderer a question and read the reply, so there
is nothing to skip.
And anything the renderer resolves on arrival rather than at draw time — aMEMORYBUFFER rasterise, a NEWIMAGE built from a palette index — is re-sent
whenever the palette changes underneath it, because the same numbers would then
mean a different picture.
Multiplayer keeps saying everything twice
In a networked room the server re-asserts state on purpose: a player who joins
halfway through never received what everyone else got at the start. So none of
this applies server-side. A CrashNet game behaves exactly as it did, by design,
and the saving is a single-player one.
AND THE WEB EXPORT NOW TAKES INPUT
If you exported a game to itch.io with 1.58.0, it loaded, drew itself, played
its music — and ignored every key, click and tap. Nothing in the browser console
said so. It simply sat there looking correct and playing nothing.
The engine attaches no input listeners of its own; a page has to ask for them,
and the boot shell that ships inside the export never did. The Arcade's own
player page does, which is why the same cart played perfectly there and not on
itch. That call is in the shell now, in the same place.
Holding on to the keyboard came with it, because those listeners live on the
canvas and on itch.io your game is an iframe on somebody else's page. The
visitor's first click usually lands on the itch page rather than in your game;
any stray click hands focus back to the parent; and a click in the letterboxed
margin around your canvas gives it to the page body. The export now takes focus
back on each of those routes, so a misplaced click costs you nothing.
Re-export anything you have already published. The shell is baked into the
export at package time, so a build made with 1.58.0 carries the old one however
new the engine is. Package it again with 1.59.0 and upload it; nothing about
your game or your itch.io settings needs to change.
AND SHAPES STAY HIDDEN WHEN YOU HIDE THEM
One thing fell out of the work above and is worth stating on its own, because
it is the failure this whole class of change invites.
SET POLYGON marks its slot visible as a side effect of doing anything at all —
that is how the statement has always worked. So a shape you hid earlier becomes
visible again the moment any SET POLYGON reaches the renderer, and the HIDE
re-asserted afterwards is what puts it back. Skip that re-assertion as a
redundant repeat and the shape stays on screen: hidden everywhere except where
you can see it.
It does not. A statement that changes the renderer's mind about something
counts as changing it, and everything filed under that shape is re-sent.SET POLYGON n COLOR, FILL, LAYER and ZORDER all still leave a hidden
shape hidden, however many times you send them.