Log In  
Page:
1
2


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.

https://github.com/ftsf/picolove

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.

26


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


This is AWESOME. Well done.

But how do I make it work?


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

There are differences on each platform.

https://love2d.org/wiki/Getting_Started


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


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


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 =)


Just the 1px out line still happening for me.


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.


@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 =)


Would you consider allowing hi-resolution screen modes?

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


@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.


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


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


now loads p8.pngs!


Can it reload the file when the file changes?


press CTRL+R just like pico-8


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.


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 :)

Link


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

https://github.com/ftsf/picolove/tree/sfx


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


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


@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.


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

https://www.youtube.com/watch?v=4Moq7MdihEM


Awesome work as usual.


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


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


Just sent a pull request! :)

Fixes an issue with cls (missing cursor reset)


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.


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

https://github.com/Rinnegatamante/lpp-3ds

I will try it soon.


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


@impbox OK, I'll skip then :)


This looks really REALLY promising. I'm going to try it out asap.
https://github.com/VideahGams/LovePotion


@MaikelOrtega oh wow, nice find!


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


@impbox:

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.


@impbox

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.


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.


wow, not sure why the screenshot is that big o0

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


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

issues and PRs on github are most welcome!


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:
--love.graphics.setPointStyle('rough')

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.


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.


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.


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.


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)


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


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.


pico love is a french comic...


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.


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.


Page:

[Please log in to post a comment]