I began using pico-8 and joined the lexaloffle community in late August 2019; I had not previously used Lua. My first pico-8 game was snake using circles for the body segments.
I like to write my own code, then once my code is working I look up other implementations to see ideas I could try next time I code something similar.
I'm looking forwards to Picotron.
A few links of programming interest
(This section still in progress.)
Usborne 1980s computer books as PDFs
The publisher Usborne, who publish books for children, have put some of their 1980s programming books up for free download as pdfs via Google drive: https://usborne.com/gb/books/computer-and-coding-books
Found via Chris Alcock's Morning Brew: https://blog.cwa.me.uk/
About my comments (or lack thereof)
If I don't comment on a great game, I probably gave it a like but I had nothing more to say than wow!. And I didn't want to add a comment to the BBS with nothing more than wow!.
About questions I answer
If I have written code in answer to your question, I probably tried to suit it to the style of code you had already put up. If you are following a tutorial, I will have mistaken the style of code used in the tutorial for your own style, and may have given an answer you can't follow; I apologise here for this - but I sincerely hope the tutorial you are following is explaining the code it is using sufficiently that you can follow my answer.
I also try to make my comments (inside and outside the code) reasonably accessible to all - if I have explained something you already knew, it's because it's there for others to read as well.
Other users to look at the profiles of
A very short list of people who have interesting carts to look at.
enargy (hosts jams)
MBoffin (makes video tutorials)
Mot (has almost instant 3d code for some 2d games through redefining map and spr)
Edit (30th Dec 2021):
I have tested this further, and it happens only when the laptop is running on battery power. On mains power, the Pico-8 window continues to draw new frames.
I have looked through the power and sleep options and power plan settings and (other than telling the screen to never turn off) do not see anything that stands out as relevant.
Original post below.
Workaround: Minimise and restore Pico-8.
I recently set my laptop to turn the screen off when it wasn't in use for a couple of minutes.
When the screen comes back on, Pico-8 appears frozen. The first couple of times this happened I thought Pico-8 had crashed, but then I realised I could minimise and restore it to get it to start refreshing its screen again.
As this can look like a crash, it's probably something that should be fixed if possible.
I'm presuming there's a missed screen event handler, but if it's a more complex issue, and if it's any help tracking this down: I'm running pico-8 0.2.4, on a Windows 10 machine. It's a Dell laptop with an i3 processor.
I doubt it's relevant but I run Pico-8 with: -windowed 1 -width 520 -height 520 -gif_len 10 -volume 0 -accept_future 1
Probably more an undocumented (as far as I know) or unexpected behaviour / feature, rather than a bug, but in case it is a bug, I'm posting it in the bug forum. This is something that people who are constructing long audio strings (>31 or 32 notes) with P8SCII should be aware of.
The point at which characters begin to be printed seems to vary; for me it's somewhere around the 40th character, which is likely around the 32nd of the notes in the string. (I feel it should be consistent in this - that always after the 32nd note plays it should drop back to printing text, but unless my tests or count are off this doesn't seem to be the case.)
The behaviour likely exists because the sfx playback is written for 32 note sfx lengths. For those who haven't read about the audio P8SCII: "If an sfx index is not specified, a non-active sfx between 60..63 is selected automatically. To fill the SFX with data before playback, the following commands can then be appended." Pico-8 manual
Examples of the feature
At command line (the last "a" will print):
Or in a cart:
function _init() cls() ?"\aspv1c0eac1eac2eac3eac4eac5eac6eac7eaeaeaeaehello world!" end function _update() end function _draw() end
As a feature, I don't know that it gets you anything more than printing text before the audio command, e.g.:
Which as expected will print "hello" and make the specified sound.
I'm running pico-8 0.2.4, on a Windows 10 machine.
I've just used the music() command (other than the game loop, that was the extent of my code) to play two music tracks (with 7 sfx).
function _init() music() end function _update() end function _draw() end
When I came back to the sfx editor - silence. Pressing keys on the keyboard entered notes, but without the usual and expected sound.
I tested muting and unmuting to no effect.
Pressing space bar for playback had a positive effect - the track played back, and I was able to enter notes and hear them after that.
Tested running the cart again, with the same resulting silence.
I'm running Windows 10 and Pico-8 0.2.4.
Just tried to notify someone with a dot in their username.
Upon posting, the underlining and link was only for the start of their name, upto the dot, which makes me concerned that the wrong user will have been notified.
If the right user was notified, the less serious bug is then that the underlining and linking in the post are in error.
Problem can be seen on this thread: https://www.lexaloffle.com/bbs/?pid=79116
A one player bat and ball game in 560 bytes (by Pico-8's count).
(The code is of course not particulary readable or maintainable. A note of caution for people new to coding, this isn't a code style to emulate when you're starting out, and is done only to make the code size small.)
I'm reluctant to call it a Pong clone (in the exact in every detail sense) or remake because it doesn't try to look exactly like a previous version of Pong (or rather, I know some coders go a lot further in getting their carts to look and play exactly like one or another version), although it is of course derivative of Pong.
You are the right hand player; you control your bat with the up and down cursor-keys/d-pad-buttons.
- AI bat as second (left) player
- Random starting direction for ball
- Increasing ball speed after a number of bounces
- Bat speed increases with ball speed
- Limiter on AI bat speed so it is beatable
- Score display
- First to 3, wins
- Pauses at announcement of winner
- New game after winner announcement after non-d-pad button press
All in 560 bytes.
I don't code tweet(tweet)carts (a. I don't tweet. b. I add features. c. I like more readable code) but I decided to code a couple as a coding exercise.
(I keep thinking I've overlooked something. Let me know if I have. Thanks!)
Changing which SFX you are viewing does not always change which SFX is edited by the shortcut keys (for the number of ticks per note, at least). So trying to use the shortcut keys can cause a different SFX's ticks per note to change, which is undesirable.
I am presuming this is because a previous SFX has been selected, and the selection has not been updated to the visible one either when the current SFX was changed or when a shortcut key is pressed.
Sometimes it seems to work fine, then sometimes the bug occurs - I am unable to determine the exact sequence to reproduce it.
Pressing ctrl+s then ctrl+r in swift succession caused pico8 to freeze.
This did not resolve, and as a result the file was not saved, and was corrupted.
(I had a very recent backup so only lost a very short SFX. This was actually the third time I've had this issue, although the other two times it either resolved or the file wasn't corrupted.)
This was with Windows 10 and pico8 0.1.12c.
On Android, using Chrome, the cartridges (at least those on the BBS - I haven't looked further afield yet) have constantly crackly audio, and the distinction between ticks is very audible so each tick sounds burbly or garbled, and some instruments sound particularly off in tone from what they should sound like.
I am using an Android tablet. It's low end, but I believe that to be not the main issue because I can get near perfect audio in Firefox with the same tablet (it could still be a contributing factor if Chrome isn't very efficient with delivery of audio but Firefox is).
The tablet runs Android 8.1.0; Oreo go.
I am using Chrome (version 77.0.3865.92 - I just updated it to make sure the issue happened with the latest version available to the tablet).
I can't say whether this is a general problem or limited to this device (I don't have extras to try it on).
I feel this is worth mentioning on the pico8 forum as a bug in case people are expecting everyone accessing their cartridges to be getting a near equal experience. This won't necessarily happen, and the delivery of the audio content that I'm experiencing is so bad that I wouldn't expect anyone to keep a cartridge open for more than 20 seconds.
Here is a link to a cartridge with music in if anyone wants to make a comparison on their own device (in Chrome then in Firefox) try:
The Snowman by gradualgames
Or hunt around for something more to your taste.
I doubt everyone is affected by this, because if they were there would have been a post about it already, but all I find is the occasional mention of crackly audio, with no one noting it as a bug.
Even if I suspect the problem lies mainly with Chrome for Android, I would still wonder if pico8 could tweak anything to get better playback.
Thanks for reading! And thanks @zep for pico8 which I'm enjoying greatly.
Editing in some threads which may have noted this or another issue with Chrome sound before: