
Repro:
- fire up PICO-8
- switch to code editor
- type something like 123456789 and hit enter
- copy and paste that line few times to give yourself something to cursor through
- using the keyboard, navigate to the middle of one of these lines
- cursor up and down: should work normally
- click near the start or end of the line
- cursor up or down: will change the row properly but maintain the column from before the click
Demo:

This is probably as easy to fix as just setting both the current and virtual column on mouse clicks.



So I find that organizing my code with data structures and functions adds a lot to the runtime cost in PICO-8.
For example, doing vector math with objects like {x=1,y=2}, and functions like
function vadd(v1,v2) return {x=v1.x+v2.x,y=v1.y+v2.y} end |
greatly increases the readability of my code, but at the cost of significant performance hit.
Coming from a C++ background, this really upsets me. Modern C++ compilers are extremely good at optimising, and it's often possible to write very expressive code with almost zero overhead. While in PICO-8, if I want my code to go fast, I have to write it in a rather repetitive and messy way.
I like how PICO-8 is deliberately restrictive, but is there a way to write clean code without hurting performance too much? What are your thoughts?


i've been running into some strange errors involving a project using #include while running it on windows instead of my usual linux environment. i've isolated the problem to line ending convention: an external file that uses the windows CrLf convention, but is otherwise the same as a file that works with no problems, will cause errors. here is the text of the external file i used:
local function _draw() cls(1) end |
to see the problem, save this with an external text editor using windows line ending convention (wordpad works, as do many programmer text editors) and use #include to include it in a cart.

The heavens receded like a scroll being rolled up, and every mountain and island was removed from its place. Then the kings of the earth, the princes, the generals, the rich, the mighty, and everyone else, both slave and free, hid in caves and among the rocks of the mountains. They called to the mountains and the rocks:
“SAVE US FROM THIS DEMON!"
.....
Score the number of the beast
to release the world from
PONGATORY!
Controls:
Left & Right to move.
X to serve.
Check it out on itch!








Turn with the left and right arrows keys.
If you fall to the ground you can restart the cart (⏸ -> "reset cart").
x=9y=9u=0v=0 function _update60()cls(7)v+=.07l=sqrt(u*u+v*v)a=atan2(u,v) if(btn(0))a+=.014 if(btn(1))a-=.014 w=.03-cos(a*2)/50u=l*cos(a)v=l*sin(a)x=(x+u+8)%144-8 y+=v if(y>120)u*=.9v/=-2y=120 for b=a-w,a+w,w*2 do e=x-8*cos(b)line(x,121,e,121,6)line(x,y,e,y-8*sin(b),0)end end |
Annotated:









This is just a small loop I've been working on which I plan to put in one of my games, but thought I'd upload it to see what others think. It doesn't use any custom instruments and so far any additional layers I've attempted to add (drums, other melodies, etc.) haven't really sounded right. I'm curious if folks think this loop stands on its own enough or if it would become annoying to listen to after a while. Any general feedback is welcome.
.png)






Right now if you want to draw a line loop with the cool line(x,y) continuation method, you still have to do at least one line(x0,y0,x1,y1) first to make it work:
-- draw a simple triangle line(32,96,96,96) -- base line(64,32) -- right side line(32,96) -- left side |
This isn't so bad if you're drawing the figure manually as I just did. But if you're, say, drawing an algorithmic figure's loop, you have to handle that first line conditionally within the loop:
-- draw a simple segmented circle local cx,cy,r=64,64,32 for a=0,1,0x.01 do local x,y=cx+cos(a)*r,cy+sin(a)*r if a==0 then line(x,y,x,y) -- sets the continuation point else line(x,y) -- continued from the last point end end |
Or (not shown) you can remove the condition from the loop, but it requires doing math to get the first point outside of the loop and then calling line(x,y,x,y) as above before looping over the subsequent points.




With many thanks to packbat for helping me in the forum, I can finally say my first real cart is complete!
I give you: BASTARD SQUASH.
I don't have any training in programming or math, so this isn't as impressive as most debut carts. Still, we all have to start somewhere! I hope you find something to enjoy in it. Also, don't mind the unused sound samples, and general code inelegance...
Description
Have you ever thought your game of squash needed to hate you a little more? Then do I have a cart for you!
Your paddle shrinks with each successive hit. Past certain point thresholds, it also begins to creep toward the ceiling. Extra lives are granted every 300 points, because I love you, even if my game doesn't.
I'm looking for some advice on how to grant the player extra lives after the score crosses a certain point interval.
I've checked a few carts that do this, but I'm not able to make sense of the functions they use, and I was wondering whether anybody had a simple method handy.
At the moment, I only have a brute-force method. My cart uses two straightforward variables: "lives" counts the player's lives, and "score" counts the score. Let's say I want to give the player an extra life for every 300 points they score. Right now, I only have this:
function gainlife() if score=300 then lives+=1 elseif score=600 then lives+=1 elseif score=900 then lives+=1 end end |
It kinda works (assuming the player loses interest in the game after around 1,000 points). But I figure there HAS to be a way to capture the interval in a neater function. Unfortunately, my stupid brain can't figure it out!
Thank you for whatever wisdom you have to share.

.png)



For some reason, I forgot to post this cartridge when it was originally made during the 2018 Demake Jam. Well, here it is now! This is the minified version, but the .p8 source is available on the itch.io page: https://krajzeg.itch.io/low-knight.
The game is a demake of and a homage to Hollow Knight. It was made in 6 days, so it's kind of rough around the edges, and the difficulty level is over the top. It is what it is, though, and still happy with how well it holds up given its development time :)










This is a prototype from a gamejam that the some of the folks in CoNDOR Season 9 are participating in. We have 24 hours to make a game with the theme of "NecroDancer/CoNDOR/etc"
Update 2020-03-28
Spent more time after the GameJam was completed to flesh out more of the mechanics. Feels like most of it is in a good spot, outside of some weird collision stuff that I haven't spent enough time on.
Music, which is kind of the biggest piece of Necrodancer, is hard and I have no idea how to compose Memento Mori into anything resembling what DannyB or any of the other composers did. Maybe one day I'll figure it out.
If anyone is willing to take a stab at it, I'd love to have it in. Comment/reach out if you are interested.
Once again using Dylan Bennett's Game Development with PICO-8 as the backbone, I've rolled out a new project based on his "Lander" recipe. Presenting Red Planet Mission:


I've tweaked the sprites, added a start screen (with art!), and managed to put together menu and gameplay themes.
I couldn't figure out how to randomize the star background each time you start up the game, but I'll keep trying.
It's quite exciting to have put all the features of PICO-8 to use in a cart! The next step is to do something using my own code next time.


In classical cryptography, the Hill cipher is a polygraphic substitution cipher based on linear algebra. Invented by Lester S. Hill in 1929, it was the first polygraphic cipher in which it was practical (though barely) to operate on more than three symbols at once. The following discussion assumes an elementary knowledge of matrices.
https://en.wikipedia.org/wiki/Hill_cipher
I have added the space after the 'Z' in the alphabet so each symbol is represented by a number modulo 27.