Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm the author. I wrote the game and engine using the wonderful, and fast, Gambit Scheme (http://gambitscheme.org/).

I needed a lisp to manipulate the puzzles, because they aren't based in a strict grid. It ended up being way more natural to program the block structures as lists rather than traditional matrices.

Gambit compiles the Scheme code down to C, which I can then link to Objective-C for iOS, or port to Android or any other platform that Gambit supports.



Thanks for posting this, but the link is rather anemic for this audience; any possibility of a writeup (even a quick and short one) of how you did it? I've been looking at cross-platform solutions for apps, and the best I've come up with so far is Kivy (http://kivy.org) and haXe (http://haxe.org), which both still require a machine running OSX to package for iOS.


Thanks, that's a good point. I am definitely planning on writing up everything I learned in the process. It just launched a few days ago so I'm still focused on handling that at the moment.

If you like I can e-mail you in the future when the article is out. There's contact info on my website: http://asivitz.com/cloudbreaker/


Eh, no pressure; I'll keep an eye on your website and HN, but I'd be curious if anyone here has found ways to do cross-platform (Android, iOS, Linux, OSX, Win, etc) apps from the environment of their choosing. I'm not looking to monetize, so arguments of "investing" into platforms I don't already have are moot; this is mostly a hobby/side "what could I do if . . . " sort of thing right now, and just having scheme as another option is awesome :)


I've recently spend quite some time trying to figure out what's the best way to use a Lisp in order to write multi platform games. I'm still in the researching phase, but if you need to support more than iOS & Android, then ClojureScript on top of a Javascript Game Engine (possibly with native extensions) is the best bet.



I could be mistaken (as I haven't actually researched this), but I don't think there is any way around needing OSX to package for iOS. Even tools like cordova/phonegap hook into a base Xcode project when it comes to compiling and packaging.


Yeah, that seems to be the consensus. I don't want to exclude anyone, but since I'm a Linux guy, I don't run any OSX, and quite frankly it seems like an unnecessarily high barrier to entry to require a single platform to develop for a device. Android, for instance, has SDKs for the three major desktop platforms, plus I can sideload without rooting or having to pay a yearly fee.


I think you could use the Phonegap Build service to avoid running OSX.


If youre a Linux guy just develop for Android. They have a thriving game market and you dont have to compromise openness.


If you're making games for the fun of it, your advice is spot on. But it's a terrible way to make a business decision if revenue matters. It's really more of a question of whether he has good reason to believe that 70% of the revenue is enough to cover an investment in a Mac + Developer Program. I don't much like Windows, but the investment in a license for Windows and Visual Studio has been returned many times over. Nevertheless, Android is a great place to start—on any platform.


Just to clarify some things:

1) What I want to do is create apps that scratch itches I've had for years, and they're all outside of work, and even if there was something available off the shelf, I'd kind of like to be able to hack on it (have source), just for practicality and fun's sake.

2) I don't want these apps to be restricted to any one platform.

3) I never plan to monetize these apps.

You're right - if I was going in this to make money, it's a simple decision. Pitted against my time and potential revenue, a Mac + Developer Program is dirt cheap.

OTOH, I develop in Emacs and Linux for a reason, even when I'm developing software for Windows. Since investing in a Mac + Developer Program would be a net loss by definition, I'm looking for any way to still be able to make these apps available for iOS. Looks like Apple doesn't want that kind of hobbyist input to their ecosystem (and yes, while I'm a professional in that I get paid for same at the day job, I consider these apps as hobby projects).


Sounds like a web app would satisfy your requirements.


The nice thing about both Kivy and haXe is that web apps are a strong possibility, and one I was thinking of doing anyway. Of course, with enough dev time, I could take any language/framework and make a web app from it. I wouldn't be surprised if there is already a library (or it's trivially easy) to generate JS or HTML5 from Scheme or some other Lisp :)


for HTML5, check out Cordova, even Adobe offers a free iOS / Android / Win8 compiler


On iOS Cordova works great, not so great on Android (I'm talking about game programming obviously) especially on Android 4.4.


Works great? Show me some apps please! They all are garbage compared to native imho. Not even really usable, again, in my opinion. I wouldn't recommend Cordova for anything at this point, not because of Cordova per se but rather because of the state of HTML5 on these devices. And I have built a lot of Cordova apps because clients demanded it; now we downright refuse as it's bad for your portfolio to do so. Even if it looks nice it will take weeks (months) to get it working really smooth (stuff you get for free native) and then it breaks suddenly because of some update (especially on Android, but also on iOS, for instance after the 7 update) and you are right back in hell. For every app I have seen which was 'ok' on Cordova you could build it great 3 times native for ANdroid,iOS and WP8 in less time.


I've built an app that worked well with Cordova: https://play.google.com/store/apps/details?id=org.audreyt.di... ( Source: https://github.com/g0v/moedict-app/ ; Context: http://g0v.asia/tw/#Q1.2 ).

A dictionary — being text-based, with very few animations, and no background soundtracks — avoided most of mobile-platform-specific issues.


I've only said Cordova works great on iOS.

It doesn't work so great on Android, but I wouldn't go so far as saying that every Cordova app is garbage :). For some apps it works reasonably well, for others simply doesn't work.


Would really like an end-to-end guide on compiling C with objective C (and possibly some example code in gambit that shows the interfacing you did).

I'd love to be able to do this with ECL (http://ecls.sourceforge.net/) to build apps in common lisp for iOS (possibly android). I know about MOCL, but I'm a pretty cheap guy, so would rather stick to open technologies and do the work myself.

I'm not a scheme guy, but until you get a writeup done, would you mind posting any info you have on interfacing gambit with iOS?

Good work, and thanks for sharing!!


I did an ECL port to iOS a while back, which you can read about in the ecl links here:

http://kriyative.github.io/tags/

I vaguely remember someone adapting it with an ECL to android cross compilation effort. Can't find that link now.

The LGPL license of ECL is something to keep in mind as you consider your options.

Good luck.


The standard Gambit distribution actually comes with an example iOS project. It also has a script for building the Gambit runtime for ARM (the phone) and x86.

It's definitely not a 10 minute process, but shouldn't be too hard.

I think I also remember some projects popping up the Gambit mailing list to make all of this easier. It might be worth searching the archives.


Oh? How do you traverse vertical and horizontal structures that are wider than one block? If you have vertical lists, following a horizontal row wild involve lots of find-nth-position calls, which I wouldn't call "natural"


The basic data structure is this

((0 (73 84 92)) (1 (17 95 31)))

Where the 2 digit numbers are id numbers for the blocks. The single digit number to left of each row is the horizontal offset.

So, shifting a row, the most elementary operation in the game, just requires incrementing the offset.

Vertical shifts are done with a 90 degree rotation operation, then a horizontal shift, then a -90 degree rotation.

Sometimes traversing the lists is necessary, but the most common operations are fast, and then rest are fast enough.

The limiting factor in performance is definitely rendering, not the game logic.


My lisp experience has been largely restricted to writing elisp. I would really love to write something in Scheme though. How well maintained and diverse are the GambitScheme libraries? I see three different sets on their packages page, do you have any experience with those or would you have some better suggestions?


> How well maintained and diverse are the GambitScheme libraries?

The library situation in Gambit is.... very bad. Last time I tried it (~6 months ago) you had to compile from a different branch to get Blackhole to work.

Chicken Scheme has a much better ecosystem. It also compiles to C and is fast. Gambit is known for its speed so I won't say Chicken is as fast but it is "fast enough" and the ecosystem is worth the difference IMO.


Seconded. I recently evaluated quite a few Scheme implementations for a very simple web scraping project and found Chicken to be both fast and great with its packages. chicken-install feels almost like pip or npm and it works really well. The packages are many and most of them are nicely documented. If you need a Scheme with compile-to-C capability and a bunch of batteries included then Chicken Scheme is the way to go.


I didn't use many libraries. It's pretty straightforward to interface with C code, so instead of writing a whole OpenGL wrapper, I just call into some C code to handle the rendering.

It was somewhat tricky to get it all setup, but I followed in the footsteps of James Long (http://jlongster.com/s/jlongster-old/pages/blog/write-apps-i...) and a few others.

I hope to contribute back what I learned and make it easier for others to use it for games in the future. It's seriously a great language for game writing.


I agree. I would love to someday be able to build on mobile using games. It would be amazing if you could share a writeup or maybe a hello world starter template on running Gambit on iOS or android. This seems like a lovely project. Congratulations and good luck.


Would love to see it! I ran across Long's page some time ago, but unfortunately it's way out of date.


As soon as I saw the game, I thought about Gambit-C. I'm currently following a compiler class with its author.


> I'm currently following a compiler class with its author.

Is this an online source? I would love to see a compiler course by someone like Marc Feeley!


No, it's at the Université de Montréal.


Does the course have a public page for us to see?


I did some digging before I ask chm originally, here is what I found:

There are some lecture notes for the compiler class in French: http://www.iro.umontreal.ca/~feeley/cours/ift3065-ift6232/ Chrome automatically translated that resource for me.

Here is Feely giving a talk about a Scheme to javascript compiler: http://www.iro.umontreal.ca/~boucherd/mslug/meetings/2004102...

chm: Lucky... it would be awesome to do a compiler class in Scheme! Could you please tell Feely that some people on Hacker News would be thrilled if he made his lectures available online?


OK, I will mention it to him. Some of the suggested readings were from PG, so I'm sure he knows HN.


Me too! That would be amazing!


Since you mentioned it, I'd love (to download & play) a port to Android at some point :)


Thanks! I'm planning on releasing for Android soon. Hopefully in the next month or two.


Any chance you'd write a technical article on your algorithms? I'm in love with puzzle manipulation code. Seeing the sort of things you're doing would be a lot of fun.


Yea, I'd love to write about some of that stuff. There's unfortunately a big problem with indie games getting cloned out of existence by some big publishers, so I'm a little hesitant to put all of the logic out there. I do think it would be pretty hard to implement in a traditional OO language though.

There's a basic explanation of the method in another comment I've written here though.


Awesome work in so many ways. Congratulations!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: