Log In  
Log In  

Hi y'all!

I've been working on a reimplementation of Pico-8 in Love2D (Another lua game framework)
Mainly because I wanted to keep working on my games after I hit the token limits in Pico-8
but didn't want to lose the pico-8 feel and start from scratch.

So I'm sharing picolove with you, can grab the source on github.


Requires Love2D 0.9.x from https://love2d.org

Can run a p8 cart with

love . cartname.p8

You can modify the love.load function to load a specific cartridge and package it into a .love file (renamed .zip) to distribute.

Have fun!!

Let me know about any bugs you find.

I know there's some issues with removing stuff with del in a foreach loop (causes a bug in celeste.p8), but not sure what's going on there.

Working on adding SFX and Music support as well as p8.png loading.

P#13912 2015-09-09 08:50 ( Edited 2018-05-22 18:49)

:: Ivoah

Yay! Congrats on getting this polished enough for a release, now we can play PICO-8 games on mobile devices.

P#13913 2015-09-09 09:07 ( Edited 2015-09-09 13:07)
:: matt

This is AWESOME. Well done.

But how do I make it work?

P#13917 2015-09-09 09:37 ( Edited 2015-09-09 15:30)
:: matt

This may be of help to others, Getting Started with Love2D

There are differences on each platform.


P#13927 2015-09-09 15:19 ( Edited 2015-09-09 19:29)
:: matt

Just filed an issue (two issues in one, sorry)

P#13928 2015-09-09 16:01 ( Edited 2015-09-09 20:01)
:: impbox

@matt thanks! would you be able to send me the .p8 to test your issue with?

P#13972 2015-09-10 07:01 ( Edited 2015-09-10 11:01)
:: impbox

pushed an update, now api.p8 renders correctly (other than the extra precision from the floating point numbers)
added missing text characters, hopefully got them all now =)

P#13973 2015-09-10 07:34 ( Edited 2015-09-10 11:34)
:: matt

Just the 1px out line still happening for me.

P#13976 2015-09-10 11:52 ( Edited 2015-09-10 15:52)
:: Rhys

It works! Approximately...

Had to change all ifs like this tho:

if (true) doStuff()

to this

if (true) then doStuff() end

Very nice work tho. I can see this being useful if you want an infinite cpu power pico, but that defeats the purpose a little.

P#13977 2015-09-10 12:40 ( Edited 2015-09-10 17:06)
:: impbox

@Rhys great! I'll look into that error you're getting, picolove is slightly more fussy about things like accessing pixel data outside of the screen or map data out of the bounds or nonexistent sprites, which often shows bugs that are hidden by pico8, but i'll try and make it more compatible, perhaps an optional strict mode =)

P#13992 2015-09-10 20:46 ( Edited 2015-09-11 00:46)
:: matt

Would you consider allowing hi-resolution screen modes?

Maybe 256x256? or 320x240 for the GameKid device?

P#14002 2015-09-11 06:14 ( Edited 2015-09-11 10:14)
:: impbox

@matt since it's open source you can modify it to have whatever limitations you want, changing the resolution would just be changing a line in picolove, likewise the palette and fps.

@Rhys, I got it working, had to make foreach return if you pass it a nil table, throws a warning instead of error now. I was able to play through the whole game =)

unfortunately the if shorthand is a real pain to parse correctly, basically I need to match it and replace it with the expanded equivalent, but that is hard without implementing a full parser, i've tried to handle most of the cases, but there are some that break it.

P#14003 2015-09-11 07:30 ( Edited 2015-09-11 11:30)
:: Rhys

I also had a problem with %=, but += and friends worked fine.

P#14006 2015-09-11 09:08 ( Edited 2015-09-11 13:08)
:: impbox

@Rhys yep, I've just added %=, missed that one before

P#14007 2015-09-11 09:28 ( Edited 2015-09-11 13:28)
:: impbox

now loads p8.pngs!

P#14011 2015-09-11 10:57 ( Edited 2015-09-11 14:57)
:: matt

Can it reload the file when the file changes?

P#14014 2015-09-11 11:56 ( Edited 2015-09-11 15:56)
:: impbox

press CTRL+R just like pico-8

P#14016 2015-09-11 12:17 ( Edited 2015-09-11 16:17)
:: sta64

Hi impbox!
I saw the picoemu post earlier and I saw you were doing a love2d
reimplementation but ... this is awesome ! :) Never imagined it was so advanced. Fair play. Gonna experiment a bit.

P#14019 2015-09-11 12:41 ( Edited 2015-09-11 16:41)
:: sta64

I have been messing around with sound in Love2D. I managed to generate a square wave and use it for a little melody and jump effect in runtime. Nothing serious. You can see it in action here :)


P#14021 2015-09-11 14:07 ( Edited 2015-09-14 00:29)
:: impbox

hey @sta64, i've been working on audio for picolove, nearly there =)

it's probably been the hardest bit to get right since it's harder to compare visually except through an oscilliscope.

with lots of help from asterick we've figured out most of the oscillators, or at least close approximations:

0 = triangle
   return abs((x%2)-1)-0.5 * 0.5
1 = uneven tri
   local t = x%1
   return (((t < 0.875) and (t * 16 / 7) or ((1-t)*16)) -1) * 0.5
2 = saw
   return (x%1-0.5) * 0.333
3 = sqr 50%
   return (x%2 < 0.5 and 1 or -1) * 0.25
4 = sqr 25%
   return (x%2 < 0.25 and 1 or -1) * 0.25
5 = tri + half frequency tri / 2
   return (abs((x%2)-1)-0.5 + (abs(((x*0.5)%2)-1)-0.5)/2) * 0.333
6 = noise
   zep says this is brown noise, haven't quite got this right yet
7 = detuned triangle
   return (abs((x%2)-1)-0.5 + (abs(((x*0.97)%2)-1)-0.5)/2) * 0.333

i've pushed a branch to github with some basic sound support, no music yet


P#14033 2015-09-11 23:59 ( Edited 2015-09-12 03:59)

This is all very useful, thanks for all the work reverse-engineering. =)

P#14038 2015-09-12 03:17 ( Edited 2015-09-12 07:17)

Great work there. Will you also implement tools, like Pico have?

P#14047 2015-09-12 10:16 ( Edited 2015-09-12 14:16)
:: impbox

@darkhog, I have no plans to implement tools at this stage, but it's certainly possible to make your own.

I've exposed functions for raw keyboard input and i plan to add ones for mouse input so you can make your own devtools, so I can imagine that people might make developer tool carts.

P#14055 2015-09-12 11:11 ( Edited 2015-09-12 15:11)
:: impbox

now supports setfps(newfps) to change the framerate
and music/sfx is pretty much working now, although not perfect

here's a modified celeste running at 60fps


P#14099 2015-09-13 03:04 ( Edited 2015-09-13 07:04)
:: matt

Awesome work as usual.

P#14101 2015-09-13 05:54 ( Edited 2015-09-13 09:54)
:: sta64

Hi. Congratulations ipmbox. That music and sound effects sound great. I am making a sprite editor pico8 compatible and I will introduce more tile banks beyond the limitation. Afaik there is no editor for that at the moment and that might be useful for Picolove users. What do you think guys? By the way is it possible to use bigger banks in Picolove?

Here is the link BBS Link

P#14130 2015-09-14 10:28 ( Edited 2015-09-14 14:31)
:: impbox

@sta64 at the moment picolove only supports the same spritesheet and map as pico8, but it'd be quite trivial to expand that.

P#14138 2015-09-14 12:00 ( Edited 2015-09-14 16:00)
:: matt

Just sent a pull request! :)

Fixes an issue with cls (missing cursor reset)

P#14149 2015-09-14 18:49 ( Edited 2015-09-14 22:49)
:: sta64

Hi impbox,

Just to let you know. I have incorporated PicoLove in my sprite editor. There is a little heart on the top right corner and if you press it runs PicoLove to see the changes :) You can see it in action in the editor thread.

P#14364 2015-09-19 13:19 ( Edited 2015-09-19 17:19)
:: matt

Have you tried running this on Nintendo 3DS using Lua Player Plus?


I will try it soon.

P#14716 2015-09-28 18:17 ( Edited 2015-09-28 22:17)
:: impbox

@matt, I think it would require a lot of changes to target that.

P#14722 2015-09-29 02:03 ( Edited 2015-09-29 06:03)
:: matt

@impbox OK, I'll skip then :)

P#14725 2015-09-29 06:49 ( Edited 2015-09-29 10:49)

This looks really REALLY promising. I'm going to try it out asap.

P#14726 2015-09-29 06:59 ( Edited 2015-09-29 10:59)
:: matt

@MaikelOrtega oh wow, nice find!

P#14768 2015-09-30 18:07 ( Edited 2015-09-30 22:07)
:: sta64

Wow x 2 :) That's amazing. Did you have the chance to try it?

P#14812 2015-10-01 19:32 ( Edited 2015-10-01 23:32)
:: sta64


I am messing around with the new version of PicoLove. I am using a mac computer and when running jelpi.p8 it works great until it's game over and then I get this error :

main.lua:1214: attempt to index upvalue'__pico_current_music' (a nil value)

I was wondering if anybody had the same issue.
I also noticed that in celeste.p8 the music stops looping and goes to screen 3 after 1. Thanks in advance.

P#14937 2015-10-03 16:54 ( Edited 2015-10-03 20:54)


fantastic job! I've opened a few issues on github, so address them however you please :)

picolove works really nicely! I only had to change a few things, considering I was using some of pico8's undocumented features (such as math.min/math.max/math.floor).

Mind you the work around was easy:

math = {
  max = max,
  min = min,
  floor = flr,

If you'd like to see picolove in action, you can download it here with my game.

P#15285 2015-10-11 18:49 ( Edited 2015-10-11 22:50)

Hey @impbox that's a really cool project you have there :)

I saw the video where you play Celeste on PicoLove at 60fps and it's preatty neat. So I cloned your repo and tried to run it here but it's throwing an error: Error: main.lua:1227: attempt to index local 'm' (a nil value)

Maybe I'll try to debug this later.

P#15306 2015-10-12 10:42 ( Edited 2015-10-13 00:27)

wow, not sure why the screenshot is that big o0

You can get the original here: http://i.imgur.com/eSfAqN5.png

P#15307 2015-10-12 10:48 ( Edited 2015-10-12 14:49)
:: impbox

thanks for all the issues! i'll try and deal with them all soon!

issues and PRs on github are most welcome!

P#15328 2015-10-12 19:59 ( Edited 2015-10-12 23:59)

It's an impressive implementation! Well done.

I've started a small project in pico-8.

With Löve 0.9.2, it works well. It also helped me to fix some wrong code which was accepted by pico-8 ;) (if I call a map with map(0,0,0,0), instead of map(0,0,0,0,128,128) for example)

It doesn't work with Löve 10. It seems they often break API with new releases, I started a game in Löve and after next update it was no longer compatible...

It's good you stated it was for Löve 0.9.x in the readme. I think you should also add the usage in the readme (love . cartname.p8), like at the beginning of this thread, and also for the love.load function for autoloading a game (even if people can copy their game on the no_cart.p8 file).

(Edit) I managed to make it work with löve 0.10.1 by commenting line 280 in main.lua:

and changing line 100 to:

local lineMesh = love.graphics.newMesh(128,"points")

So far it works for my project. Maybe it's not enough. For example it doesn't work with the android version of Löve.

It's a bit frustrating Löve people are doing this kind of things:

"Available since LÖVE 0.9.1 and removed in LÖVE 0.10.0" (for example for love.graphics.newMesh)

Thanks a lot for this work.

P#22499 2016-06-08 07:09 ( Edited 2016-06-08 11:14)
:: impbox

Hey farvadin, sorry I've kind of neglected picolove recently, gamax has continued improving it in his fork.

https://github.com/gamax92/picolove should work with love 0.10 as well as some other fixes.

P#22501 2016-06-08 07:18 ( Edited 2016-06-08 11:18)

ah, thank you for the information, I'll have a look at this. Maybe you could also mention this fork on the github project?

I think you should talk about picolove on the löve2d forum ;)

(edit) I've managed to export my game to android with this new picolove library. I had to remove / comment all my printh calls because it's no longer supported. It seems to be supported on android, except for the controls which are missing. But it's quite an achivement.

P#22507 2016-06-08 08:18 ( Edited 2016-06-08 12:55)

I apologize for sorta hijacking this, but I've recently added a basic touchscreen overlay for Android, would like input on it.

If it works well or not, things you'd think would improve it, etc.

P#22646 2016-06-10 22:41 ( Edited 2016-06-11 02:41)

hello Gamax92,

it's amazing. I was looking for this kind of addition (I tried to use Gööi with no success).

I've packaged my game with your new code. I works well (on my asus zenfone2), it's perfect like that. The only addition I could think of (but maybe it's not possible), is a way to rotate the screen 90° so we use the phone / tablet in portrait mode (as pico8 games are square), like on a gameboy. But it's already very good. Thanks you very much! (and also thanks for adding printh in the code)

P#22658 2016-06-11 02:23 ( Edited 2016-06-11 07:07)

This is sadly something that is being forced in the AndroidManifest.xml. When packaging your game, remove
from your GameActivity and then the screen will support rotating. I'll make a note for this in the README

P#22686 2016-06-11 13:24 ( Edited 2016-06-11 17:24)

ok, thank you for letting me know about this. By "packaging", at the moment if was only for getting the .love "package", I've only tried with the default löve runner for android.

I'm already much pleased with this touchscreen overlay.

P#22704 2016-06-11 18:19 ( Edited 2016-06-11 22:19)
:: jihem

pico love is a french comic...

P#22760 2016-06-12 10:57 ( Edited 2016-06-12 14:57)

I experimented with this a bit and it was really easy to set up. I wonder if the sound generation could be improved or does it already push the limits? Easy to use .wavs in place of sounds if it's an issue, though.

Excellent work.

P#22766 2016-06-12 13:15 ( Edited 2016-06-12 17:15)

It can be ... I don't think the music and sfx interoperation works correctly (when on the same channel)
Songs with different looping speeds on the channels seem to quirk out some times
The noise waveform has the wrong volume system and could potentially be entirely inaccurate (but the new noise generation seems okay)
Oscillator positions don't reset after each pattern, found that behavior by looking at the 7th(?) waveform.
The sound tends to have a popping noise which is probably because:
The frequency spectrum shows that it has content above 22050 for some reason, as if it were doing nearest neighbor resampling.
Pretty sure it'll still crash if there is no music loop start marker.
The sfx and music data isn't hooked up to peek and poke.
None of the 4 new music effects we discovered are implemented, and I dunno if they could be implemented besides distortion, the rest would need a reimplementation of the sound system to support such a thing.

P#22767 2016-06-12 13:28 ( Edited 2016-06-12 17:33)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2018-12-12 17:09 | 0.106s | 4194k | Q:133