LoveCodify - Wrapper Library to run Codify scripts on MacOSX, Linux, Windows
  • SiENcESiENcE November 2011

    I did some research and wrote a wrapper library for Love2D to run Codify scripts on MacOSX/Linux/Windows.

    You can get it from my Blog: http://crankgaming.blogspot.com/2011/11/lovecodify-wrapper-library-to-run.html

    cheers Florian^SiENcE

  • beebee November 2011

    I think TwoLivesLeft should take over this effort and make it official. Or at least help this guy complete the API. :)

  • DylanDylan November 2011

    This is a fantastic idea. Its community projects like this that will help Codea thrive.

    We plan to open source the backend of Codea for people to use however they want, hopefully that will help efforts like this.

  • blissappblissapp November 2011

    Delighted my moire toy was used as the example ;-p. I'll have a play with this later!

  • SimeonSimeon November 2011

    This is just amazing. Looking at your source, you seem to have a pretty good mapping from Codea -> Love. You even took care of parameters and mapping mouse clicks to touches.

    Some bits just don't seem to map well to Love though, vector graphics styles seem to be troublesome, as are ellipse/rectModes.

    You could potentially do ellipseModes as a stored state that offsets the transform in the ellipse() call, then pops the transform.

  • SiENcESiENcE November 2011

    Shure. I had very little time to write this. It's still a lot todo.

    But if you want to help, feel free to fork my github :-) or send patches. I will add them!

  • SiENcESiENcE November 2011

    I added a vector class and a oop class implementation and added Breakout as working Sample.

  • SimeonSimeon November 2011

    I'm going to sticky this thread as it's a pretty awesome project.

  • SiENcESiENcE November 2011

    Thx :)

  • GabrielMoreiraGabrielMoreira November 2011

    Excelent! I thought of doing this, but I lazy. Now I'm excited. thnks!

    Forked, and working on!

  • SiENcESiENcE November 2011

    Ah great, someone is helping. Just merged your changes.

  • hlshiphlship November 2011

    How closely is Codea tied to iOS? As in, I would gladly pay $8 to have that environment running on my MacBook Pro (I don't currently own an iPad, though Codea is making me think about it!)

  • SiENcESiENcE November 2011

    I dont understand!? If you have no iPad just take www.love2d.org and the IDE of your choice. Love2D is very similar to Codea/Codify and the runtime runs on MacOSX, Linux and Windows. And now you can also run Codea/Codify scripts.

  • MagaroMagaro November 2011

    Trying to run loveCodify on my MBP. Getting the following error:

    cannot open loveCodify.lua: No such file or directory

    Does this file need to reside somewhere special? I left it in its default location. Thanks.

  • SiENcESiENcE November 2011

    Just put it into the same directory as your codify script. I code on Windows and there i have to put it where my love runtime runs. Play around with the dofile path's.

  • drofnasdrofnas November 2011

    For anyone testing this out on a Mac, here's what I did to get it working:

    1. Followed the Love2D getting started guide (http://love2d.org/wiki/Getting_Started) and modified my "~/.profile"
    2. Extract the LoveCodify zip file anywhere you want (i.e. ~/Documents/Games).
    3. Browse to the above folder in Terminal
    4. Run "love MoireToy" (or any other sample provided)
  • drofnasdrofnas November 2011

    While messing around with the Space Invader game that was provided with Codea/Codify on the iPad, I noticed that "vec2(0,0)" seems to reference the Top Left of the screen in LoveCodify instead of the Bottom Left like Codea does.

    Unless there is a better way to handle coordinates, LUA is all new to me.

  • alexralexr November 2011

    Any of the Codify projects using the SpaceCute assets will break. Wondering how to work around that...

    EDIT: sorry posted too fast; I found the solution after digging around in the loveCodify samples

  • SiENcESiENcE November 2011

    I did several updates today, also to rotate and mirror the screenspace. But it's still unfinished and needs testing. Love2d has a different coordinate system as codify/codea.

  • drofnasdrofnas November 2011

    with regard to the SpaceCute assets, I just unzipped the entire spritepack.zip into the root of my game folder. This should create 3 folders for Planet Cute, Small World, and SpaceCute. Of course you only need to keep the sprites you area actually using, but while messing around, I kept them all in my project folder.

    I did this so I didn't have to change any of my code between what I can in Codify and using loveCodify.

    Hopefully something will come up with a patch that will translate the coordinate system between Love2d and Codify. Really looking forward to seeing more of this project, awesome job.

  • drofnasdrofnas November 2011

    @alexr I'm seeing the same issues with the latest version.

  • alexralexr November 2011

    I saw display problems with the Enduro and Breakout samples. Did you fix the cause of those? I didn't fetch your latest version yet but am hoping it will.

  • SiENcESiENcE November 2011

    Sadly Love2D does not support relative paths (because of security issues). So you have to copy all gfx into the your project folder.

    I would like to keep all graphic assets on one place in only one folder.

    If someone has an idea how to solve this problem, please share it.

    ps: Screenresolution is now fixed to Codify's 748x748

  • GabrielMoreiraGabrielMoreira November 2011

    Fork Love2D, and mount spritepack dir on PHYSFS. :) Look at boot.lua

  • SiENcESiENcE November 2011

    Oh yes thats possible. But i don't want a special solution just for me. People should be able to just download and run the Love runtime with LoveCodify.

  • BortelsBortels November 2011

    Observation: loveCodify rocks. I have my stuff on github, and I can test on my desktop, then publish, then load it into Codea and it just works. This is 99% of what I'd want/need from an OS X version of Codea - except it works on ubuntu too!

    Weird Quirk: I have some stuff that use math.sin(frame) to do periodic movement; when I try it on the ipad, I get a slow spinner - but when I try it on loveCodify, it's nearly a blur. I'd normally think it's degrees vs. radians - except when I print results, it's not. I'd also think that maybe it's just that the OS X box is insanely faster (and - it is!) - except it's based on a "frame" variable I increment at every draw, and that's not going up insanely faster. Is a puzzlement. Maybe I'll try to take a video of it to show the difference.

    Two Suggestions:

    First - It would be nice if code could work unchanged between Codea and loveCodify. Presumably this could be as easy as making dofile() be an existing but no-operation subroutine in Codify, so the lines are silently ignored if they're there. At least until dofile() support is added (and it appears unlikely to ever be?) that would be cool.

    Second, it would be nice to be able to set a global "LOVEHUD" or such - true, and the HUD shows, and false and it's suppressed. The hud stuff is useful for debugging and such, but if my app doesn't use watch/parameter/gravity - it would be nice if that all went away. I guess I could clone the repo and add this and submit a patch, eh? Figuring out how to do so would probably be a good exercise to go thru...

  • BortelsBortels November 2011

    Sent a PULL request for the boolean - it wasn't as difficult as I thought it might be. :-)

  • SiENcESiENcE November 2011

    Merged :)

  • SimeonSimeon November 2011

    You can probably run the code unchanged on both platforms like this:

    --
    if dofile ~= nil then
        dofile( "..." )
    end
    
  • BortelsBortels November 2011

    I use the word "awesome" too much; it no longer means as much when I see awesome.

    Yes, Simeon - that works. And now I can have code that is identical and works in both loveCodify and Codea - and life is good.

  • Andrew_StaceyAndrew_Stacey November 2011

    Just thought I'd record the myriad of libraries that I had to install to compile love2d on Linux (strangely, not everyone uses Ubuntu). Presumably there were more that I already had installed, but these were the extras. There's no list of dependencies at the love2d website, by the way.

    libopenal-dev
    liblua5.1-0-dev 
    libdevil-dev
    liphysfs-dev
    libphysfs-dev
    libmodplug-dev
    libmpg123-dev
    libvorbis-dev
    

    (Ah, good. You use MarkdownExtra. Seems fairly standard on Vanilla forums but you never know until you try.)

  • SiENcESiENcE November 2011

    You should post this on the love forum too.

  • jonbrojonbro November 2011

    Came across this today, it might be useful to get the sound objects working in the wrapper: http://love2d.org/forums/viewtopic.php?f=5&t=2734&p=30431&hilit=lfxr#p28641

    it is a port of sfxr to pure love2d.

  • SiENcESiENcE November 2011

    Thanks, but as you can see in the last post of the thread, i already know this :). Until now i didn't find the time to integrate it.

    Stay tuned!

  • AranirAranir November 2011

    Thank you so much for that wrapper, I finally could start coding on my mac to use later on on the ipad.

    But has any of you a good Tip which IDE to use with lua and love? The feature I mostly want is code completion, is there a good IDE or text programm out there which I can use, which incorporates my own classes and function and creates the autocompletes?

    Thank you for any advice

  • juaxixjuaxix November 2011

    Oh, I see you have used my code, it would be nice to edit the conf files to set the titles and authors propertly :) Thank you for your work!

  • SiENcESiENcE November 2011

    The credits are already in the main.lua Gems file.

    If you want to add it also in the conf.lua just do it. I'm to lazy change all samples, sorry. Fork it and send me a pull request.

    This is no repository for Codify/Codea Samples. I only need this Samples further develop LoveCodify.

  • juaxixjuaxix November 2011

    Ok, thanks!

  • PetroEkosPetroEkos November 2011

    Excellent project. Thanks!

  • SiENcESiENcE November 2011

    I just like to mention this news. This is an Love2D-API Port to Android. Still only alpha! So don't expect too much yet!

    So with LoveCodify your scripts/games should run on Android too ;-).

    https://twitter.com/#!/schattenkindnet/status/135839926729191425

  • Andrew_StaceyAndrew_Stacey November 2011

    On Linux then the filenames are case sensitive. The default Codea name is Main.lua but this system seems to look for main.lua. At least, when I renamed my file main.lua from Main.lua then I got something reasonable.

  • SiENcESiENcE November 2011

    Here are infos about love-android:

    http://ghoulsblade.schattenkind.net/wiki/index.php/Love2d-android

    https://github.com/hagish/love-android

    You need the LoveCodify wrapper to run your Codify/Codea scripts on Android!

  • cdentcdent November 2011

    Great work with the Love2D wrapper SiENcE, thanks!

    Question though about the oop class implementation, seems to differ from the Codify-version. Have you experienced any difficulties with this, or have I made some mistake?

  • SimeonSimeon November 2011

    For reference, here is the class() function definition that Codea uses:

    http://twolivesleft.com/Codea/Code/Class.lua

  • BlanchotBlanchot November 2011

    I'm also having trouble getting Love and loveCodify to run on my Mac. I can get Love's own demos to run and a 'Hello World' file... but I get the same message as @Magaro above whenever I try to use any of @SiENcE's loveCodified examples,

    "cannot open loveCodify.lua: No such file or directory"

    Anyone have any suggestions about what I might try?

  • jdanishjdanish November 2011

    Same problem as @Blanchot. Any suggestions are greatly appreciated. I tried the Love "hello world" app and that worked fine, so Love isn't the issue, I think.

  • SiENcESiENcE November 2011

    Hi there,

    i don't have a mac so i can't check this. I think you only have to reference the right path in the samples "Main.lua" files.

    This part:

    if dofile ~= nil then
    dofile ("loveCodify.lua")
    dofile ("Breakout/Game object classes.lua")
    dofile ("Breakout/Levels.lua")
    dofile ("Breakout/Numbers.lua")
     end
    
  • jdanishjdanish November 2011

    Looking through the Love forums, it seem that dofile may not be fully supported on the mac. So, I tried replacing dofile with require and then it seems to work so long as loveCodify is in the same folder as the main. Hopefully there is a cleaner solution, but that works for now. Thanks!

  • BlanchotBlanchot November 2011

    Ah yes that works now for me as well (replacing dofile with require) -- as long as loveCodify.lua AND vector.lua are in the same folder as main.

    Thanks @jdanish! Thanks too @SiENcE for making this possible at all.

  • cdentcdent November 2011

    @Simeon Thanks for the class implementation. There's a small difference in class c-tor, but nothing that seems to cause the different behavior that I experience. I'll investigate some more on my side.

  • cdentcdent November 2011

    Sorry guys about the misguided rambling about differences in class implementation. It's a bit hard to explain why, but the different experience I saw was due to that touch.state BEGAN never occurred in LoveCodify. The BEGAN state switches directly to MOVING in the function love.update(dt).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID Sign In with Google

Sign In Apply for Membership

In this Discussion

Tagged