Code Monkey home page Code Monkey logo

picolove's Introduction

PICOLOVE

Run PICO-8 games and computer programs with free and open-source software.

On github at: https://github.com/picolove/picolove

Screenshot of PICOLOVE after startup

Requires LÖVE 0.10.2

What it is:

  • An implementation of PICO-8's API in LÖVE

What is PICO-8:

What is LÖVE:

Why:

  • For a fun challenge!
  • Allow standalone publishing of PICO-8 games on other platforms
  • Should work on mobile devices *
  • Configurable controls
  • Extendable
  • No arbitrary cpu or memory limitations
  • No arbitrary code size limitations
  • Better debugging tools available
  • Free and open-source software

What it isn't:

  • A replacement for PICO-8
  • A perfect replica
  • No dev tools, no image editor, map editor, sfx editor, music editor
  • No modifying or saving carts
  • Not memory compatible with PICO-8

Not Yet Implemented:

  • Memory modification/reading
  • PICO-8 cartridge versions > 8

Differences:

  • Uses floating point numbers not fixed point
  • sqrt doesn't freeze
  • Uses LuaJIT not lua 5.2

Extra features:

  • ipairs() standard lua function
  • log(...) function prints to console for debugging
  • error(message) bluescreens with an error message
  • warning(message) prints warning and stacktrace to console
  • setfps(fps) changes the consoles framerate
  • _keyup, _keydown, _textinput allow using direct keyboard input
  • _touchup, _touchdown allow using touch input
  • _getcursorx(), _getcursory() allow access to the cursor position
  • _getpicoloveversion() returns the version of picolove
  • _hasfocus() window focus state (only false on first blur frame in _draw)

Development requirements:

  • Runtime: LÖVE 0.10.2
  • Building: make
  • Formatting: sed and stylua
  • Linting: luacheck
  • Packaging: zip

Development:

  • Run in endless loop: make dev
  • Modify code
  • Press ctrl+q to reload

Before pushing:

  • Run make format
  • Run make lint
  • Run make test
    or
  • Run make all

Android Packaging:

Replace the default cartridge (nocart.p8) with your game. Text (P8) or PNG (P8.PNG) is supported.
Follow the Android Game Packaging steps.
Optionally, for orientation rotation support (Portrait and Landscape), remove android:screenOrientation="landscape" in the AndroidManifest.xml

picolove's People

Contributors

ftsf avatar gamax92 avatar gingerbeardman avatar hrobeers avatar josefnpat avatar robloach avatar samhocevar avatar shoozza avatar thormme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

picolove's Issues

Identify matching pico8 version

It would be nice to identify what version of pico8 that picolove will run. It looks like it's currently 0.1.1*

The current version is 0.1.2.

What would be nice is if there was a way to read the version from the file header, so that appropriate regressions could take place.

*From the readme, it mentions that sqrt crashes pico8. From this list of known bugs it looks like the sqrt bug was in 0.1.1.

No longer seeing text output from print?

function _init()
end

function _update()
end

function _draw()
  cls()
  --color(6)
  print("can you see this?")
end

It seems that color is being set to black somehow?

you can see this if you uncomment the color(7) command. this does not work if color is _init or _update

Use of pal() not reseting transparency

Hi, a call to pal() should also reset palette transparency flags (like a call to palt())
In the same spirit, the start of _draw() should reset both pal() and palt()
With those changes, the cart I tested worked perfectly.

Issue with patching shorthand if

The current patcher for shorthand if's will put "end" after a comment if there is one:
if (expression) expression --comment
becomes
if expression then expression --comment end

It should detect if the line contains a comment and place the end before the comment.

EDIT:
I've also noticed the line regarding or reads b:find('%f[%w]or%f[W]'), should it read b:find('%f[%w]or%f[%W]') like the others?

Fix luacheck errors

There are a lot of errors when running make check or make lint.
Fix them by updating .luacheckrc and/or the source code.

Missing player input keys

In the manual for 0.1.2, it says:

Player 1 keys: Cursors + ZX / NM
Player 2 keys: SDFE + tab,Q / shift A

from the keymap defined in main.lua:

__keymap = {
    [0] = {
        [0] = 'left',
        [1] = 'right',
        [2] = 'up',
        [3] = 'down',
        [4] = 'z',
        [5] = 'x',
    },
    [1] = {
        [0] = 's',
        [1] = 'f',
        [2] = 'e',
        [3] = 'd',
        [4] = 'q',
        [5] = 'a',
    }
}

it looks like the nm/lshift/a is missing.

This would be nice to add for familiarity with the picolove system!

newMesh expects texture and gets string

Just cloned the repo and ran love ./ on the folder. I got this:

Error: main.lua:37: bad argument #2 to 'newMesh' (Texture expected, got string)
stack traceback:
    [C]: in function 'newMesh'
    main.lua:37: in main chunk
    [C]: in function 'require'
    [string "boot.lua"]:360: in function <[string "boot.lua"]:241>
    [C]: in function 'xpcall'

PNG detection

Maybe png detection should be done not by the extension of the file but by the png magic string?

How to run my cart? Getting error.

Hey there!

I'm new to Lua and Love stuff. I've installed Love and have successfully run a "hello, world." How do I use picolove to run my pico-8 cart?

Currently, if I just run love . in the picolove directory, I get this screen:
picolove error

Any help is appreciated, thanks!

Maths/rounding error?

I wonder if this is a maths/rounding error?

code (called with integer values)

function draw_card(s,x,y)
  spr(s, x,y, 2,2) -- main sprite
  line(x+1,y-1, x+14,y-1) -- top edge
  line(x+1,y+16, x+14,y+16) -- btm edge
end

Interesting that only one of the two lines is drawn in the wrong place? Both coordinates are 1px out vertically.

Also, badly mapped/missing = (equals) sign in font?

compare
picoLove screenshot
VS

pico-8 screenshot

PNG loading doesn't support v8 files

PNG loading doesn't support v8 files

And maybe other versions?

Matts-iMac:picolove matt$ love . 26413.p8.png 
Loading /26413.p8.png
version 8
codelen 27094
Error: main.lua:598: unknown file version 8
stack traceback:
    [C]: in function 'error'
    main.lua:598: in function 'load_p8'
    main.lua:1705: in function '_load'
    main.lua:352: in function 'load'
    main.lua:888: in function <main.lua:878>
    [C]: in function 'xpcall'

Some compatability issues

Celeste: Random corruption, multiple players, skipping levels
Tomb of G'Nir: Random 8 and 4s are visible
Rolly: Doesn't Start

Some colors are not displayed

Hello!
Was playing around your awesome project!
One thing I found, that it doesn't display colors 15 and 14:

I did not modify the source code or something else.
Thanks, Egor.

Need help getting a game to work

Hey picolove folk! When trying out this project on a cart that I want to expand a bit code wise, most of the things don't work and there seems to be some buttons that are held by default?

I'm looking for someone to help me fix these issues. I'm willing to financially compensate for the time invested. I've included the cart in this message, a clear difference can be seen when being ran from pico8 vs picolove.

clarice p8

GLES error on Raspberry Pi

Hi,

I have been trying to run picolove on the Raspberry Pi platform.
It's running raspbian and SDL2 is built with GLES2 support. Many SDL2 games work on it using the GLES2 renderer.
On the LÖVE side of things, the SuperToast demo works perfectly too.
Howeve, picolove gives me this:

pi@raspberrypi:~/pico $ love picolove/
Error: Cannot link shader program object:
ERROR:CUSTOM-14 (fragment shader, line 5) Support for indexing array/vector/matrix with a non-constant is not mandated in the fragment shader
stack traceback:
    [C]: in function 'newShader'
    main.lua:244: in function 'load'
    main.lua:659: in function <main.lua:647>
    [C]: in function 'xpcall'

Any idea on what could be wrong here?

thanks!

Help not implemented

When I try to run the help command, it says "Help is not implemented yet". It's really not implemented or is an error?

Error when playing music from loaded png

Hi, @ftsf ! @felipebueno from the PICO-8 BBS here.

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)

rename some things to be more pico8ish

warning -> warn
setfps -> fps
_keyup -> keyr
_keydown -> keyp
_textinput -> keyc
_touchup -> touchr
_touchdown -> touchp
_getcursorx -> curx
_getcursory -> cury
_getpicoloveversion -> ver

Project dead?

Hi, are you still working on this?
There are still a few open pull request without any feedback.

Would be sad to see this die because of inactivity.

pget crash, (love 0.10.1 Incompatibility)

I'm trying to run a game called light bikes http://www.lexaloffle.com/bbs/?tid=2501
that uses pget as a test collision mechanism, so I looked on the code of pget and I found it calling :getPixel(x,y) on the screen canvas, in love 10 this function has been removed, and now you have to do Canvas:newImageData( ), And that will drop fps a lot .

The solution is that you create 2 things: canvas, imagedata
then whenever something get drawn on the canvas you will have to do imagedata:setPixel

Doesn't work with love 11.5.1

image

At first, a pop-up appeared on when I tried to run picolove.
Then colors are abnormal like above, then when I try to type help or load a game the screen becomes black.
What should I do ?

More maths differences

Contrast the following cart in pico8 and picolove

http://www.lexaloffle.com/bbs/?tid=2464

14153 p8

It's set to tween using ease_in_out_cubicwhich gets great results in pico8, but bad results in picolove. Other easing functions are also affected.

function ease_in_out_cubic(t,b,c,d)  -- cubic easing in/out - acceleration until halfway, then deceleration
  t /= d/2
  if (t < 1) return c/2*t*t*t + b
  t -= 2
  return c/2*(t*t*t + 2) + b
end

I've ruled out short operators by manually expanding them. No difference.

Perhaps an issue with expression parsing?

unknown file version 5

I get this error when loading .v8.png files, which makes sense considering I'm guessing picolove is for 0.1.1 and not 0.1.2.

http://i.imgur.com/bthFCkK.png

I mention this because it is inconsistent with the .v8 files.

Might make more sense to show a warning instead for both filetypes, and then attempt to run it anyway?

Include license information for libs folder in distrubution

To make distribution easier, a ready to copy & paste license.txt for the third-party dependencies (the libs folder) would be helpful.

See löve license.txt for a template.

While most of the libraries don't require attribution in a binary release at least the optional lust library (MIT License) does.

Additionally the strict.lua is possibly taken from https://github.com/moai/moai-dev/blob/develop/3rdparty/lua-5.1.3/etc/README and was further modified afterwards. It has no license information (was public domain initially). This would be easier to track with a license file.
Optionally a newer version of strict.lua could be taken as it is/was part of the lua source code distribution which since has updated the license of strict.lua to be the same as the lua license.

Load carts that are version > 8

Most of the carts nowadays are version later than 8, and it is really starting to cause the emulator some issues with functionality. Most carts that I own are unplayable, due to an incorrect version. Please add support for it sometime in the future.

Something went wrong?

Hello! Just found your awesome project. Downloaded it, and compiled (I mean zipped it up). But here is a thing: I can't install demos. It says:

syntax error
'=' expected near '<EOF>'

Maybe i'm doing something wrong? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.