If you just want to see what's new, please scroll down a bit. But first of all, I should issue a..
Future Compatibility: You'll need to update to 0.1.12 to play cartridges made in 0.1.12 or later. This update is another attempt at eternal future compatibility (can handle any future carts). There were a few bugs in 0.1.11g that needed a cart version bump to fix, and so I also took the chance to tweak the API (more on that below).
Backwards Compatibility: The time() function (also aliased as t() for tweetjammers) now always means time in seconds even at 60fps. This breaks a couple of 60fps carts that I know of (sorry @rez and @jobe!) but I think it's worth biting the bullet now to be more consistent and to match Voxatron's t() behaviour. With any luck this will also be the last backwards compatibility breakage.
A less disruptive change is in the music mixer: both the drop (3) and vibrato (2) effects are observed when playing an SFX-instrument. This only affects carts using SFX instruments, and which happen to have those (previously) dormant values sitting around, but I couldn't find any examples in the wild yet.
The gfx, map and audio editors now have unlimited undo stack. Unlike the code editor which has one undo stack per tab, the other undo stacks are global to the cartridge. It also works during audio playback, so it's possible to make a bunch of changes to various SFX and/or song patterns, and then roll the changes back and forth while it is playing.
As well as diving code into tabs, it's now also possible to insert code from external text files each time a cartridge is run. This is particularly useful when using an external text editor (no need to modify the .p8 file directly), and also to share code across cartridges while still being able to modify it in one place. Note that this does not make a difference to size limits -- it is just a convenience when working with .p8 files. (When saving .p8.png, the external code is injected). From the manual:
Source code can be injected into a program at cartridge boot (but not during runtime), using `#INCLUDE FILENAME`, where FILENAME is either a plaintext file (containing Lua code), a tab from another cartridge, or all tabs from another cartridge: #INCLUDE SOMECODE.LUA #INCLUDE ONETAB.P8:1 #INCLUDE ALLTABS.P8 When the cartridge is run, the contents of each included file is treated as if it had been pasted into the editor in place of that line. Normal character count and token limits apply.
Copying a range of SFXes or song patterns will now copy them into the text clipboard in a format that can pasted into other cartridges, or into a BBS post (similar to GFX snippets). To select a range of SFX or patterns, click the first one you want, and then shift click the last one before using CTRL-C. When pasted into a post, it will show up like this: (doesn't work on mobile yet)
You can copy the snippet back into a cartridge by pressing the [ sfx ] button, CTRL-C, click the destination sfx or song pattern, and then CTRL-V. Note that songs that use SFX instruments will probably not work if you paste into a cartridge that already has data in SFX 0..7.
The default HTML template used for exporting now includes:
- Adaptive layout that also works on mobile
- Touch controls
- Gamepad support
- A controls help menu
- A start button with embedded preview image
- Fixed sound under iOS
- Integrated pause button / pause menu
The default shell and upload also works a bit smoother with itch.io now -- see the manual for uploading instructions.
Instead of exporting a .js and .html pair, it is now possible to also generate a Web Assembly (.wasm) file which contains the main player code.
EXPORT -W FOO.HTML
Web assembly is supported by almost all browsers and servers now, and is more compact and in theory faster to load. CPU cost seems around the same for PICO-8, but the total exported filesize when zipped is around 300k instead of 400k. This hasn't been tested much yet though, so it's not the default and is marked experimental for now.
Raspberry Pi Binary
The binary exporter now generates a Raspberry Pi binary. It is the version with statically linked SDL2 and dynamically linked WiringPi, that I believe works for most Raspberry Pi users. But let me know if you need to generate the equivalent of pico8_dyn.
To export cartridges from commandline, you can use the new -export switch, and operate on cartridges outside of PICO-8's filesystem. The parameters to the EXPORT command are passed as a single string:
pico8 jelpi.p8 -export "-i 48 jelpi.bin"
Serial() allows you to communicate with other devices via the Raspberry Pi's data pins (the things sticking out that various hats also connect to). There are 2 supported for now: raw GPIO accesss, and WiringPi's spi interface (not tested!). Accessing GPIO via SERIAL() is useful when higher precision timing is needed than manually POKE()ing the gpio memory addresses; transactions including delay instructions are added to a queue that is executed at the end of each frame.
Here's an example, controlling a string of 40 LEDs inside Pimoroni's plasma button kit for Picade:
Incidentally, 0.1.12 is also optimized to run well out of the box on a Picade, but more on that later!
You can now used Windows mode under Raspbian's desktop environment; Just hit alt-enter to toggle as usual. This only works in software blitting mode, so if you use "pico8 -pixel_perfect 0" it will force the the rpi driver to be used instead of x11. Running under the default driver (x11) now also resolves the issue of leaking keypresses and clicks to the desktop, but it is still present when using rpi.
Code Editor Shortcuts
CTRL-B to toggle commenting of a Block of lines
CTRL-W to jump to the start (the staWt?) of a line (CTRL-E for End of line)
CTRL-H for Hyper search -- search across tabs
Code Editor CPU
The code editor now uses less cpu by caching code highlighting information, so is noticeable when editing long files on older machines or devices with limited battery life. Napkin calculation: after 250k hours of combined use, this will save enough electricity to drive a Chevrolet EV around the circumference of the Earth once.
The default code editor background is now blue! If you'd like to (permanently) change it back, you can now alter it from inside PICO-8 (instead of using config.txt):
> CONFIG THEME CLASSIC
Themes only control the background of the code editor at present, but might do more in future.
When cel values in the map editor have corresponding sprites with only black pixels, or when only black pixels are visible when zoomed out, there is no way to see which tiles have a non-zero value. So for these cases, PICO-8 0.1.12 now displays a single blue dot for that cel to indicate this.
API changes that required a cart version bump:
- divide and abs sign flipping for 0x8000.0000
- sqrt(0x0000.0001) freezes
- "-1"+0 evaluates to 0xffff.0001
I took the opportunity to make some final adjustments to the API and CPU counting:
- cursor(x,y,col) can set the draw state colour
- t() / time() always means seconds even at 60fps
- line(x1,y1) can be used to draw from the end of the last line
- next() can be used to write custom iterators // core Lua thing
- Raw metatable operations: rawset rawget rawlen rawequal
- peek2() poke2() for writing/reading 16-bit values
all(), foreach() are now not much slower than pairs() or manually iterating with integer indexes. The CPU usage reporting is also slightly more accurate, but it will will never be very precise, because keeping track of virtual CPU cost can be expensive itself! And also the PICO-8 CPU costs are made up and essentially silly when looked at too closely.
PICO-8 0.1.12 is now a bit better at managing scaling to different screen sizes. You probably don't need to know any of this, but here's how it works..
When possible, PICO-8 uses "pixel perfect" scaling, which means it chooses the highest possible scaling factor that is a whole number for which the PICO-8 display will fit on the screen. This means that PICO-8 pixels are a nice regular size and without blurry scaling artifacts, but for smaller screen resolutions it means you can get quite wide black boundaries.
0.1.12 addresses this by automatically choosing when to run in pixel perfect mode by default. If the size of the margins is more than 10% of the smallest screen axis, it will turn pixel perfect off. You can still force pixel perfect with "pico8 -pixel_perfect 0".
0.1.12 also introduces another setting: preblit_scale. Instead of doing a filtered scale from a 128x128 image (super-blurry), PICO-8 first performs a non-filtered scale up to something like 384x384, and then lets the platform-specific blitter stretch that instead. The default value of preblit_scale is set to automatic, which attempts to find the best trade-off between regular pixel size and pixel crispness.
On a related note, PICO-8 is now better at deciding when it is running in the foreground. There was a bug in 0.1.11g and earlier under Windows that caused PICO-8 to think it was in the background and so sleep() longer each frame. So some Windows users might notice improvement when running 60fps cartridges under 0.1.12 using a desktop-sized window (the default fullscreen method).
Search for Author
Search for carts by the same author. You can find this option under the per-cart menu (hit the menu button while the cartridge you want is selected). It will send you over to the search list, with a search phrase of "by:authorname". This also works in the BBS search bar.
This will be the last major update for PICO-8's alpha, apart from some stray bug fixing. Later this year PICO-8 will go into beta with one last feature: online scores. It will take a while though, as I'm hoping to make the architecture scalable and flexible, and will take some time to get it right. The high score tables allow an extra small blob of data that can be abused to do interesting things that might not even be related to keeping track of scores :p
Until then, I hope you enjoy 0.1.12, and please post any bugs if you find them!
Added: #include a text file, or a tab from another cartridge
Added: Unlimited undo for gfx,map,sfx
Added: [sfx] snippets: copy and paste sound & music between PICO-8 instances and BBS posts
Added: (BBS) sfx snippet player
Added: CTRL-G in code editor to repeat search across all tabs
Added: Splore search text entry with cursor key button presses
Added: Custom tab widths (tab_width in config.txt)
Added: Web exporter template: joystick & touch support, preview image, menu buttons, adaptive size, controls screen
Added: .wasm exporter (use -w)
Added: Raspberry Pi binary exporter
Added: -export // run the EXPORT command from host commandline
Added: Toggle flags on multiple sprites at once by selecting them first
Added: Confirmations when loading/saving with unsaved changes
Added: Windowed mode support for Raspberry Pi
Added: serial() interface for Raspberry Pi // serial() -- spi, ws281x, direct bit banging
Added: api: peek2 poke2 rawset rawget rawlen rawequal next
Added: Comment/uncomment selected block with CTRL-B
Added: Can save screenshots and gifs from exported binaries via EXTCMD
Added: Can exit exported binaries after runtime error / stop(), and also via EXTCMD("SHUTDOWN")
Added: SHUTDOWN menu item added to pause menu when running via "-run cartfile"
Added: -kiosk to run in kiosk mode: boot into splore, favourites menu only, no cart menu
Added: -root_path to set root cartridges folder from commandline
Added: shift+space in song view to play from the current quarter of the selected channel
Added: CTRL-W, CTRL-E in code editor to jump to start / end of line
Added: -accept_future to load cartides made with future versions of PICO-8
Added: -preblit_scale (default: auto) for less blurry scaling with -pixel_perfect 0
Added: -pixel_perfect -1 (auto) only uses pixel perfect scaling when < 10% of the containing screen axis is wasted
Added: highlight all occurances when searching for text in code editor
Added: tab completion across directories
Added: In map editor, non-zero cels that are drawn all black are marked with a single blue dot
Changed: all(), foreach() cpu cost is now much cheaper (but still a little more than using a for loop)
Changed: cursor() can also set the current color with a third parameter
Changed: stat 24..26 return -1 when no music is playing
Changed: 3x4 font characters (uppercase in ascii) allowed in code editor (but not pasteable/editable)
Changed: time() / t() always means seconds since run (but still updated once per _update() / _update60)
Changed: line(x1,y1) can be used to draw from the end of the last line
Changed: del() returns the item deleted on success
Changed: single setting for audio volume (-volume switch, "volume" in config.txt)
Changed: allow '-' in cartdat() names
Changed: 8 and - only map to buttons 4 and 5 by default for CHIP build
Changed: Raspberry Pi pico8_dyn build does not support gpio/serial (and so does not require wiringPi)
Changed: Default theme is 1 (blue background in code editor)
Changed: When loading a cart from commandline, automatically set the current path if inside PICO-8's filesystem
Fixed: Code editor uses too much cpu / battery power
Fixed: cstore() with an external cart name broken when run from exported cart or as bbs cart
Fixed: Undoing changes to SFX after using pitch drawing tool clears SFX data
Fixed: Running headless scripts under Windows / Mac OSX crashes
Fixed: Running headless scripts with no video driver fails
Fixed: Can not load BBS carts in headless script mode (without auto-running)
Fixed: (Web exporter) mouse cursor doesn't work in fullscreen
Fixed: (Web exporter) mouse button 2 brings up context menu
Fixed: (Web exporter) Clusters of FS.syncfs calls causing error messages (and inefficient?)
Fixed: (Windows) PICO-8 behaves as if it is not the foreground application
Fixed: divide and abs sign flipping for 0x8000.0000
Fixed: sqrt(0x0000.0001) freezes
Fixed: "-1"+0 evaluates to 0xffff.0001
Fixed: shift-tabbing to unindent alters selection range
Fixed: background_sleep_ms reverts to default value
Fixed: "open in thread" option appears for local carts
Fixed: (code editor) undo markers in unexpected places
Fixed: root_path, desktop_path in config.txt doesn't work without trailing slash
Fixed: Audio sampling rate is wrong when device/driver doesn't support 22050MHz
Fixed: Loading cart with less than 5 pixel rows of gfx does not clear default white cross sprite
Fixed: cpu cycle exploit using peek4 with no parameters
Fixed: SFX keyboard editing operations (e.g. SPD +/-) sometimes applied to the wrong SFX
Fixed: Cursor behaviour when moving between song and sfx view, and when playing music
Fixed: Selecting SFX notes with shift + home/end/pgup/pgdown
Fixed: Vibrato (2) and drop (3) effects in SFX instruments not observed
Fixed: Can not place note at C-0 in pitch mode
Fixed: CTRL-F search in code skips matches that are close together
Fixed: (Mac) warning about unoptimized program (built with SDL 2.0.9, + now 64-bit)
Fixed: (Raspberry Pi) Keypresses leaking to desktop
Fixed: (Raspberry Pi) Keyboard layout fixed to US
Fixed: printh(nil) prints [false] instead of [nil]
Fixed: toggling audio mute twice returns to maximum volume
Fixed: alt+cursors moves cursor in code editor
Fixed: del does not work on first character of code or commandline
Fixed: preprocessor breaks on double slash in string s="\"
Fixed: sometimes code executing a little after point of runtime error
Fixed: Token count reported in editor is more than 0 after rebooting
Fixed: "Removed empty tabs" message displayed when loading cart with fewer tabs
Fixed: Member variables highlighted when same as API function names (e.g. actor.spr)
Fixed: Hot-plugged joysticks not recognized
Added: config command (e.g. CONFIG THEME CLASSIC)
Fixed: Windows sound resampling artifacts (moved to SDL2 2.0.9 audio:directsound)
Fixed: Glyphs stored as unicode can not load when #include'd
Fixed: Code highlighting is wrong after select and delete a line
Fixed: Last line endpoint not present in draw state memory
Fixed: Ubuntu 16.04 can not run because requires glibc 2.27 (reduced dependency to 2.14)
Fixed: stat(102) returns nil when run from binary instead of 0 (now 0)
Fixed: Loading cartridge from commandline fails when path contains "../"
Fixed: (OSX) Crash when reloading external changes with CTRL-R
Fixed: (Windows) Crash when running cart with included code
Fixed: Can not export or include extra cartridges outside of current directory
Fixed: Off by 1 when search for line 1 (affected ctrl-b, ctrl-l)
Fixed: html template -- mouse cursor showing over canvas (now hidden by default)
Fixed: CPU usage reported by stat(1) is higher than actual value
Fixed: Fail to load .p8 cartridges w/ BOM marker / CRLF endlines
Fixed: Syntax errors / crash caused by #including files containing BOM / CRLFs
Fixed: Can not save .p8 when contains unresolved #includes
Fixed: Can't open pico-8.txt in Notepad.exe (added CRLFs)
Fixed: Can delete null terminator at end of code (revealing previously deleted code)
It depends what you want to do though. For less real-time communication, you could set up a network drive and communicate via cstore/reload, for example.
Whoa. This is a huge update when you look at it all like this. I love all of the small QOL changes too. Simple things like the blue dots on the map are so useful! Thanks again! :D
Also, the staWt? hahahaha
Forgot to mention! THANK YOU for the Raspberry Pi changes! That will be hugely helpful this summer for the workshops I'm running! :D
@StinkerB06, I just now scanned the zip file with VirusTotal (which is uses 61 different anti-virus scanners) and they all reported clean. If you downloaded the installer version, that might be the problem. The installer version does set off 3 of the 61 scanners. However, not only is it only 3 out of 61, but those 3 are all reporting different things, which is usually a sign that that it's a false-positive.
If you want to be really safe, though, just grab the zip version instead and copy them over your currently installed version. (With a default Windows install, just type folder in the PICO-8 console and then go up one folder.)
This is a great release. Thanks for the prompt updates and looking forward to the possibilities with the (ab)use of online scores.
One small feature request: would it be possible to store somewhere in cart memory the current seed value of the pseudorandom number generator? It would be useful to be able to "pause" the state of deterministic randomness then later resume it.
There are probably many use cases, but here's an example hash function:
--let's say the current random seed is stored at 0xBEEF --returns the same normalized "random" value given the same (x,y) function hash(x,y) local curseed=peek4(0xBEEF) srand(bxor(x*1.031,y)) local h=rnd() srand(curseed) return h end
EDIT: @MBoffin: that does produce the same effect—thanks!
Thanks so much, zep! And thanks for the rapid fixes of the stuff I and others reported on Twitter after the first release :)
@StinkerB06: If I remember correctly how that stuff works, as more and more people download PICO-8 0.1.12, Windows SmartScreen (the program that scans and warns you that downloaded files might be unsafe) will learn that it is probably trustworthy and let it through without warnings.
> is the BBS going to get the same nice new features as the HTML export?
@kittenm4ster: most of them! I had trouble integrating the adaptive layout, but will add the controls button etc. next website update.
> I just want to communicate between PICO-8's locally on the host OS
@StinkerB06: it will likely be possible to do this at some point, as part of a more general solution. I don't want to promise anything yet though, because I'm still designing how / if it will work with other related features. I'll post in your other thread when I know more.
@JeremyRedhead a PocketCHIP build will be up Monday!
Seeing how this version will break compatibility with previous versions - how would I go about upgrading pico8 on my PocketCHIP? I managed to flash it to the newest image available via http://chip.jfpossibilities.com/chip/debian/ and got to v0.1.11, but now I guess I am stuck till the JF repo is updated..?
I've been having a lot of audio issues once exported to web. The audio will get laggy and sometimes clip when there's no reason for it to do so. The pixels also appear jagged, depending on where I'm looking at it from. This was a problem for me on my Chromebook, as well as my friend who was viewing with Firefox on Windows 10. This did not happen when exported from 0.11.
Here is a recording of the Pico-8 theme from a cart when exported to web, viewed on Windows 10 with Firefox: https://clyp.it/drwu5jn1
EDIT: Here is a screenshot of what I'm talking about when I say that the lines are jagged. You can see this is most prominent toward the upper half of the cart.
Thanks for the new background!
- Also the blue dots are really helpful, but I think I found a bug there:
it shows blue dots instead of my wall tiles when I zoom out
- the hyper search functions works perfectly, for all who also wonder:
press cmd+f, type your keyword to search for, then hit cmd+h to cycle thru tabs
- Also I am a bit curious about the hyper search function :D
on mac when I hit ctr+h or cmd+h it iterates through the code tabs.
It is not really a search function I guess.
Also the regular search function (cmd-f) always just finds one word,
how can I see the other results? A true search function would be really nice^^
Anyways thank you very much!
I really love the pico-8 and already learned a lot by using it!
@zep Two bug reports:
I'm getting odd error messages when including files. It seems like it could be related encoding issues or "invisible characters" that Pico-8 gets choked up on. Here is an empty p8 file that includes test.txt.
And here is what test.txt looks like in Notepad++
Here is a link to test.txt
It seems like uploading the HTML5 template it to itch.io shifts some things around which mis-aligns the touch control display. The buttons appear below from where they actually are. The issue occured to me on two Smartphones I had access to - iPhone 5C and iPhone 6S:
The template works fine when not embedded on itch.io.
Is there a way to turn off the Mobile functionality for those cases?
I see that there is now native support for "joystick" controls, but there doesn't seem to be a way to change these controls. I would love to play Tinysim with just my controller but I can't map Player 2 X and O to my controller.
EDIT: I managed to find a way to add custom controller mappings to sdl_controllers.txt, but it interprets x and y as fancier a and b's. Is there any way to make this map to player 2?
Hi, Zep! I just got a GameHAT for my RPi3, and I tried putting Pico-8 0.1.12 on it. But the controls don't work! They're accessed through GPIO, so is the GPIO feature interfering somehow? Is there a way to configure it?
If you've updated to 0.1.12c, you'll discover that GPIO joystick stops working. Took me a lot of digging and trial and error, but this is the solution:
Download libSDL2 Source: https://www.libsdl.org/download-2.0.php
(Note, you don't need to compile the whole thing if you already have libsdl2 installed!)
Unzip the source code and cd to the directory test and compile controllermap.
Now run controller map and follow the onscreen directions to get your config in a file.
./controllermap 0 >> controller.txt
Make a back up! You'll want this in the future!
Now copy it to ~/.lexaloffle/pico-8/sdl_controllers.txt
Run pico8 with joystick 0
pico8 -joystick 0
TLDR: My config file is this:
15000000010000000500000000010000,GPIO Controller 1,platform:Linux,a:b1,b:b0,x:b4,y:b3,back:b11,start:b10,leftshoulder:b7,rightshoulder:b6,leftx:a0,lefty:a1,
[Please log in to post a comment]