Is there any way to make Cargo-Bot running on Mac?

As title, I tried the newest loveCodea.lua from wiki. but it doesn’t work and just leave me a blank window.
Can any one give me some advice?

Thank you in advanced!

It’s beyond me, but I suppose you could compile it in Xcodeysing TLLs template and play it on the iPad simulator… Overkill perhaps… :slight_smile:

Hi, @Fred! Actually I did what you say. but I loved to see how to make it run with Love.

No idea, sorry… But there were some folks here adding features to a wrapper for this kind of thing. BTW, how did you find the process with Xcode?

I can think of many problems, mainly perhaps the missing support for the physics API. I didn’t have much time in the last few weeks to improve loveCodea and I have to thank Mike Pilgrem for his nice move to put the wrapper up on the wiki, its usual pastebin copy should have expired by now. I also have sound files from JockM laying around, so I think I have to move to github anyway in the near future.

If I find some time I will learn a bit about meta tables in order to construct object properties, I think I’ll need them for the physics API.

Stay tuned.

If someone ports the runtime to OSX, then it should just work. That wouldn’t be the hardest thing either, since a lot of it doesn’t really rely on Cocoa Touch but you’d need to be experienced in both. The two biggest issues would be video recording and text rendering, which both rely heavily on iOS specific libraries.

If Codea will release a Mac version, then I’m surely will purchase it.

This is perhaps not the right place, but I’m here at the moment, so let’s talk a bit.

After some experiments I found out how to add properties to objects, so I’m at the physics API and already have a small wrapper.

I can run Cargo-Bot until the level selection screen, then, when I click on something, I’m prompted about a missing “meshIt” function. And indeed, a quick search didn’t reveal its whereabouts. Ruilov, where is it?

And while I’m talking about running Cargo-Bot with loveCodea … are there objections against it, if I will ever manage to get there?

And another (general) thing: loveCodea makes it possible to run Codea projects on Windows, too. And on Linux, but Löve seems to act like a diva there, anything more difficult than drawing some shapes gives me nothing more than a black screen.

@codeslinger, are you using the code from the repo:

does it say in what file the call to meshit is made? Def remember writing a function called something like that at some point, but just looked at the code and don’t see the definition or any calls to it. Does the code work on the ipad?

Also, no objections about getting cargo bot running in loveCodea. It’s great!

Oblivious me! No, I got the source directly from the app (at which point I’m wondering about the differences; looking into it …).

The repo source works great! Have some minor issues with the intro boxes not rotating and some text wrapping, but nothing that keeps me from playing. Looks like I have to put something together for a great weekend, and be it on pastebin again for the sake of simplicity.

OooHhh, it seems that we can have Cargo-Bot run on mac soon… :X

@Codeslinger, sounds awesome!

Is it possible that the code from the app has classes that I created at some point during development, and later on deleted? And that meshIt was a function in one of those classes…I think in codea beta, which I used, files stick around when you delete them from a codea project

Because it is especially made for Cargo-Bot, I post the latest loveCodea pastebin link here.

I assume that you indeed want to use it with Cargo-Bot (it also works with Mágica Gems and Battle Chips …), but you have to take care about the class hierarchy. This is what you have to put at the top of Main.lua:

if require ~= nil then
    LOVECODEAHUD = false

Because I was so excited about playing Cargo-Bot with loveCodea, I’ve put it again up on pastebin for the sake of speed (of my workflow). Future releases (on github?) will include a script that does the work of determining the hierarchy.

You will also need the sprite pack. Extract it directly from the app.

Noteworthy notes:

Use shift+up/down to see the bottom part of the window if you have a small screen.

There are some render errors with the texts, mostly because of the missing wrapping functionality.

The physics API is in its infancy, the intro boxes don’t fall properly and don’t rotate. Luckily, this is just for fun and doesn’t affect the game. I’m glad that I finally managed to add properties to objects. The first time that I thought I understood classes and metatables I created _ _ index lookup loops until the stack blew up. The second time that I thought I understood classes and metatables I created class properties. After a sheet of paper and some colored pens I think I’ve got it now.

Aaaaaaand … your game is NOT saved. No complaints, please.


I just registered to report my experience on making this run in Linux. After a bit of tinkering, I’ve been able to run CargoBot quite flawlessly, so congrats to Codeslinger for making this possible !
As a teacher, I’m quite interested in using, promoting and customizing CargoBot for teaching programming, so it’s wonderful news that it’s portable to most platforms.

A few things I’d like to mention :

  • Ctrl+8/9/0 to resize screen (as mentioned in the README) doesn’t work at all. It may be because CargoBot prevents it to work ; it may also be because I don’t have a qwerty keyboard… Shift+up/down works as expected.
  • As far as I can tell, falling and rotating blocks (in the menu screen or in a failure) work as expected.
  • Savegames work ! Changing your player name is quite cumbersome (I couldn’t figure how to delete a letter) but your stars and solutions are indeed remembered.

However, when trying to load a previous game, I stumbled upon a bug for which I’m not sure who’s to blame : LÖVE stops on line 192 of LevelSelect.lua because of a comparison between a string and a number (namely, the number of stars I had been granted on that level). So, I wasn’t able to replay any level (in fact any pack) I had scored on before.
I’ve solved this by inserting “tonumber(…)” on line 188 of LevelSelect.lua, so I’d like to suggest this simple fix to ruilov ; same thing on line 72 of IO.lua for overwriting a previous record.
But I’m wondering if that’s ruilov’s mistake, or an issue with the way loveCodea parses the savegame, or if it’s inherent to the way LÖVE deals with typing and coercions.

I checked Ctrl+8/9/0 and it works for me on Linux. I can hardly imagine any keyboard layout that does not produce a plain number (maybe a Thai keyboard?).

The savegame problem is in fact on the side of loveCodea, I had too much Tcl in my blood when writing the persistence wrapper. Here’s a hot fix that will radically interpret everything as a number if it looks like it. This isn’t necessarily the cleanest way, but at least it will give you your stars back:

-- In Persistence.lua, function loco.readPlist(filename)

    while key ~= nil do
        local v, n
        pos, v = loco.nextValue(m, pos)
        -- Reading hot fix. Interpret as a number if it looks like a number.
        n = tonumber(v)
        if n ~= nil then
            dict[key] = n
            dict[key] = v
        pos, key = loco.nextKey(m, pos)

Thanks for reporting, I’m glad that you like my achievement with loveCodea.

Thanks for your answer !

I’ve tried changing “8”, “9” and “0” for plain letters in love.keypressed(key) and it works like a charm. My azerty layout (mainly used in France) requires you to press Shift to type a digit, that’s why I thought it could be keyboard-related. However, changing my layout to a standard qwerty did not solve the problem, so maybe my hardware is to blame…

Français est à la mode dans ce forum, n’est-ce pas?

Thanks again for your report on the string/number problem, because it came up with Cargo-Bot on the Codea 1.5 beta right now which apparently treats all data as strings. I don’t know how it will resolve but I reported it to Simeon.

I didn’t know about keyboard layouts where you have to press shift to get a number. LÖVE is very simple in this regard, it reports the bare key that has been pressed plus all modifiers. So if you press ‘A’ you’ll get ‘shift’ + ‘a’, so if I said to press ‘ctrl’ + ‘8’ you’re really pressing ‘ctrl’ + ‘shift’ + ‘_’. Maybe I’ll switch to F-keys.