been working on some wacky shit lately
here's that recent "goblet" tweetjam, but this time running inside a unity game
been working on some wacky shit lately
here's that recent "goblet" tweetjam, but this time running inside a unity game
no pictures to show here, but today i improved my burst-compile-times because they were getting way out of hand - used to be about 3 minutes, now it's about 10 seconds
it's compiling about 70 jobs, and when it was slow, the time was spent almost entirely on one relatively small job (!!!)
the culprit: making two temp native-hashsets (fine), and passing them as parameters to a bunch of function calls (NOT fine). hand-wavey guess: this seemed to cause an N^2 compile-time cost somewhere
by the way, here's where this project started, if you wanna see some earlier progress (starting with "get pico8 emulation at least partially-working inside unity")
upgraded the player-controller to make it handle moving platforms more smoothly/cleanly
also fun fact, the motion and IK for this crane is solved inside the #pico8 program, and the C# side just copies out the elbow and cabin positions into 3D space
finally bit the bullet and implemented the lua feature which had the worst "how much do i want it vs how much do i dread it" ratio: comma-separated values (outside of function-args and table-definitions)
first pic is a #pico8 cart which involves a multi-local-declare, a multi-assign, and a function with multi-return-values. second pic is the generated C#
C# tuples help out a ton with this problem!
new grammar for "one or more identifiers"
describes how the pattern-set called {identifiers} can match stuff like...
x
x.child
x[2]
x[4].child.veryChild
x, y, z
x, y[2+i], z.child[2]
getting into the runtime part - you guessed it, it involves another #pico8 cartridge, this time on a little phone device
(common disclaimer: windows-screen-recorder adds a little vertical offset to the mouse-cursor position. it looks accurate in-game!)
doing some #pico8 emulator improvements by seeing how much it takes to get this old game to run correctly
spoiler: it's gonna need a bunch of new features. gonna ignore audio for now...there's plenty of other stuff to figure out
it's going well...got the script to parse (~2k lines!), and have been whittling away at the resulting compiler errors. some lua-side highlights:
- for-pairs, for-all, while, break
- revise names if C# considers them illegal (like a var called "byte" or "readonly")
- exponent operator
- better handling of local-var scope and local-var-shadowing
last remaining compiler fixes: "value or default" notation and overwriting deep-elements in tables
then...on to the missing P8-API functionality!
okay good news and bad news
the good news: tiny-platformer compiles successfully!
the bad news: the burst compiler takes 4 minutes to optimize it
next time i work on it, i'm gonna try doing some pre-optimizations of my own to (hopefully) cut that down - most notably, identifying all the types that a variable will contain (number, string, table, bool, nil), so most of them can be a concrete type, instead of every value always being a union every time
took a stab at that type-detection optimization, and it almost worked but i got myself tangled up so i reverted it (may try again later). weirdly the compile time doesn't seem as bad anymore, dunno what happened
so instead, i've been getting map() to work
getting somewhere...
btnp() just acts like btn() so far, needs camera() support, still no #pico8 color-palette, and i'm not sure why the fire doesn't render - but yeah, look at this little runny-jumper go!
moving camera, animated fire-blocks, and some other less-interesting improvements
a few notable things still left to bring this cart to parity:
- fillp() to draw the background circles correctly
- emoji-glyphs for certain tutorial text
- screen palette
- audio ☠️ (still planning to skip this for now)
added emoji-glyph support (visible in the cart on the right)
but that's kinda boring, so here's the giant spider machine at the end of the game
connected the official #pico8 palette and did some doodling on an LCD-screen shader
(...masto video compression isn't as bad as twitter, but in this case it janks up the image a bit at medium viewing distance)