
Show HN: My current App Store Featured Game was written entirely in Scheme - rrradical
https://itunes.apple.com/us/app/cloud-breaker/id721767500?mt=8
======
Shivetya
After reading the story I just have to recall stories from the guys who flew
and serviced F4s, they joked they could fly without either wing simply because
it was just a rocket sled.

We had one guy knicknamed Major Cablecutter as he "clipped" the guidelines of
a radio tower one time. He also had come back more than once with branches
stuck to his F4. Being that they were only "Recon" they tended to be
aggressive during war games and this game guy over stressed his airframe
turning into some F18s trying to tag him.

So many military planes have such high thrust to weight ratios I do not doubt
that wings merely become the means to stable flight

~~~
curiousphil
This comment made me think this game must have some incredible unseen angle
not shown in the screenshots on the App Store. Brilliant!

~~~
motxilo
I wondered what Scheme dialect was F4. Epic!

------
rrradical
I'm the author. I wrote the game and engine using the wonderful, and fast,
Gambit Scheme ([http://gambitscheme.org/](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.

~~~
npsimons
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](http://kivy.org)) and haXe
([http://haxe.org](http://haxe.org)), which both still require a machine
running OSX to package for iOS.

~~~
rrradical
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/](http://asivitz.com/cloudbreaker/)

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

~~~
terhechte
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.

------
jlongster
Awesome work! I'm continually blown away that people still reference my old
work on porting Gambit Scheme for iOS.

Almost makes me want to play around with it again. :)

~~~
rrradical
Yes! So glad you saw this!

I had trouble getting the server based repl working, so here's the in-game
repl I ended up implementing as a Quake-type dev console:
[http://imgur.com/J6ozzT6](http://imgur.com/J6ozzT6)

(Obviously disabled in the App Store version.)

I may be getting ahead of myself, but I think it's a GREAT language for
writing games, and is going to take off at some point.

~~~
jlongster
Very cool! Hooking up the internal gambit REPL was finicky because it never
got much love. I think Marc polished it up somewhere though. Still, a quick
in-game REPL like that goes a long way.

The cool thing about having a real Gambit REPL was that you could use the
Gambit debugger in real-time. So if an error ever occurred, the debugger REPL
would pop up and you could step around. You also get all the builtin stuff for
inspecting cooperative threads and such.

Anyway, it would be a great minimalistic environment if it was fleshed out
more. Part of my mission in the JavaScript world is to bring these concepts to
more people, and hopefully lead them to Clojure/Scheme/etc.

Did you use a module system? Last I remember Black Hole was getting really
advanced. Did that ever take off within Gambit?

~~~
malandrew
I would love to hear more about what you're working on to bring these concepts
to the Javascript world, since we at famo.us are interested in the same.

~~~
jlongster
You can see a few things on my blog:
[http://jlongster.com/](http://jlongster.com/). Recently I've been helping out
with the sweet.js project ([http://sweetjs.org/](http://sweetjs.org/)) to
implement macros in JS. People really need to understand how macros transform
a language. It's going really well so far.

I'm also working on the idea of live evaluation. Most devs are used to writing
code and refreshing the page. There are tools that help with live evaluation,
but they all suck. I am working on something that will give you a better
connection with your code, and fully support the idea of incrementally coding
up an app.

I'm not focusing on specific Lisp/Scheme features, but more about the
philosophy behind them. Any project I do I try to expose the good stuff that I
learned from Scheme.

~~~
bsder
Interesting. How much of the JS infrastructure do you need for this stuff to
work?

I'm in the middle of creating a JS port for embedded systems (yes, I know
about Espruino. It made some fundamental decisions about object implementation
that I find unacceptable) and it would be nice to be able to lean into
something like this to avoid implementing huge chunks of the more advanced
language bits.

Side note: I'm the person who did the first Nintendo DS port of Gambit so its
interesting to see how all this comes full circle.

~~~
jlongster
I remember hearing about the Nintendo DS work. Great stuff!

What I'm working on relies on a full JS implementation. Performance is a
critical feature so I need to implement as _little_ as possible. I basically
implemented a very small VM that controls JS code using exceptions. What I've
done lets you run JS code with a 3-4x perf hit, but you get full stepping and
debugging abilities in user-land. I'm going to release it in a few weeks!

It sounds like it's not quite what you're looking for though. You're project
sounds cool!

~~~
malandrew
Is this project already public on github?

Outlet and Outlet-Machine look like what you're describing but the docs on
those say they are deprecated/frozen and the last commits are 1-2 years ago.

~~~
jlongster
No, not yet. I was exploring this indeed with outlet but discovered that
wasn't the right way to do it. My technique came together very recently and I
plan on releasing it soon.

------
keithflower
The Gambit interpreter (REPL) itself also runs on the iPhone

[https://itunes.apple.com/us/app/gambit-
repl/id434534076?mt=8](https://itunes.apple.com/us/app/gambit-
repl/id434534076?mt=8)

and on the Android platform (updating it with the latest version of Gambit is
on my todo list):

[http://apps.keithflower.org/?page_id=152](http://apps.keithflower.org/?page_id=152)

[http://apps.keithflower.org/?p=223](http://apps.keithflower.org/?p=223)

[https://play.google.com/store/apps/details?id=org.keithflowe...](https://play.google.com/store/apps/details?id=org.keithflower.gambit)

Note that this is just the interpreter itself - not a very good way of writing
games for Android.

~~~
weavie
If you could update it so you could make the scripts edit fields full screen
that would be awesome! it is really hard editing then in the tiny boxes they
are at the minute.

~~~
keithflower
Thanks for the feedback. The intent in that version was to mimic Marc's
(Gambit author Marc Feeley) past iOS version as closely as possible (via
webview) - I'll see what he's doing with his latest iOS version and also try
to include a full screen option.

------
matheusbn
Well done! Gameplay video link:
[https://www.youtube.com/watch?v=1T11wl70wjc](https://www.youtube.com/watch?v=1T11wl70wjc)

------
codegeek
Good stuff. Interestingly, the very first programming language offered in
introductory CS class at my college was Scheme at the time (2000). The power
of 'car' and 'cdr' still resonates in my head. At times, the parenthesis used
to give me dyslexia but good old days of doing stuff like:

    
    
        (car(cdr(car(cdr(cdr a)))))

~~~
latj
Get a copy of this for the kids!

[http://www.amazon.com/The-Little-Schemer-4th-
Edition/dp/0262...](http://www.amazon.com/The-Little-Schemer-4th-
Edition/dp/0262560992/)

~~~
mentos
One of the best CS classes I took in college was an introduction to scheme
that used 'The Little Schemer' as its text book. Having only worked in
imperative languages it really opened my head up!

~~~
dmix
The MIT course on youtube from the 80s using SCIP and Scheme was the single
best time investment I've made since learning programming. It still blows my
mind how much it changed my perspective on programming.

~~~
latj
From the 80's? You have a link to which one you mean?

~~~
dmix
1986
[https://www.youtube.com/watch?v=2Op3QLzMgSY&list=PLF4E3E1B72...](https://www.youtube.com/watch?v=2Op3QLzMgSY&list=PLF4E3E1B72A58B492)

A year before I was born :)

------
alvatar
Great work! :) Congratulations! For those who want to try developing in
Scheme, I'm working on a project that could help you get started. Currently
only Android is available, but as soon as possible iOS will be as well.
[http://schemespheres.org](http://schemespheres.org)

------
tokipin
I thought "non-Objective C" languages weren't allowed in the App store, or
something like that.

~~~
loumf
That was in the rules and quickly abandoned. What they care about is that you
don't load new code from the Internet. Ostensibly, the reason is security, but
the real reason is they don't want you to make an app store.

JavaScript in webviews is excepted because you couldn't show a website without
that.

If you don't get new code from the Internet (for example, someone types it in)
that's ok. It's even ok to copy and paste it from the Internet.

------
lumens
I love the originality on display with this game mechanic. Too many "samesies"
games out there for my tastes.

This developer has another puzzler in the App Store as well: Button Brigade,
also quite original, but more of an adventure style puzzle game.

[https://itunes.apple.com/us/app/button-
brigade/id542991688?m...](https://itunes.apple.com/us/app/button-
brigade/id542991688?mt=8)

[http://asivitz.com/button_brigade/index](http://asivitz.com/button_brigade/index)

------
Flow
Dear rrradical,

Tried your game, was not disappointed. :-) It's almost spooky that your post
came at this time, for I have read a lot about Scheme->C systems this week.
This PDF made a great impression on me of the gambit scheme system.
[http://www.iro.umontreal.ca/~gambit/Gambit-inside-
out.pdf](http://www.iro.umontreal.ca/~gambit/Gambit-inside-out.pdf)

I have a few questions for you:

1\. I installed Gambit-Scheme via Brew and compiling any scheme file results
in a clang segfault. How did you get around this? For now I use gcc instead.
:-/

2\. Why Gambit-Scheme and not Chicken-Scheme? I can't really decide which is
the better choice for writing a game.

3\. Do you use continuations to make coroutines in your game?

~~~
rrradical
1\. I think the segfault is explored in this thread:
[http://article.gmane.org/gmane.lisp.scheme.gambit/7068/match...](http://article.gmane.org/gmane.lisp.scheme.gambit/7068/match=xcode+5)

Basically, the problem is with the version of llvm/clang that Apple uses in
Xcode 5.

Some of the newer Xcode betas might fix it. I personally use the Xcode 4
compiler. You could probably also build your own clang from their SVN.

For more info you could probably ask the mailing list.

2\. I definitely looked at chicken, and I can't remember my exact reason for
going with gambit, but it was a practical one. I don't think I could get
chicken up and running on the iphone for some reason. Chicken did seem to be
better documented with better libraries. Gambit may be faster though.

(I started working on this about a year ago. The situation may be completely
different now.)

My game isn't too complex, compared to, say, a first person shooter. I'm not
sure if the GC implementation would start to matter in that circumstance. I
recommend trying one and then if you're happy with it, great. If not, most of
the code will be portable.

3\. No. I don't have much experience with them (besides learning the basics in
school). I did use a lot of closures, anonymous lambdas, and lambda builder
functions.

Glad you're enjoying the game!

------
eddieroger
Somewhere, deep in Lindley Hall at Indiana University, is an old professor
exclaiming, "I told them people used it!"

I wonder if I'd have taken more to Scheme if I were learning it now. At the
time, I was double majoring CS and Telecom, but the world of open source
hadn't been as friendly to Mac as it is now, and Macs were a prereq for TCom.
Getting Scheme running on my old iBook was a pain in the ass, let alone the
assignments (which still didn't match the untouchable stability of our
automated grading system). I conceptually understood why I needed to learn it,
and even grasped many of the concepts of what I was learning, but it wasn't
the language for me.

------
dogprez
I play around with this a bit, a few things I learned is that XCode 5.0's llvm
crashes when compiling Gambit-C 4.7.0's generated C code. The beta for 5.1 has
a fix. Here are a few demos that might help a few people:

scheme REPL over TCP using chibi scheme:
[https://github.com/clarkeaa/Scheme_iOS_REPL](https://github.com/clarkeaa/Scheme_iOS_REPL)

calling in and out of Gambit-C:
[https://github.com/clarkeaa/HelloGambit](https://github.com/clarkeaa/HelloGambit)

You can grab a precompiled Gambit-C library from the later project if you
want.

------
feeley
I just downloaded the game. Very cool! I wish I has written it... oh wait...
given that I wrote Gambit, in a sense I wrote most of the game! It gives me a
warm fuzzy feeling!

Your in game REPL is neat. For developing games, where there's a need to
explore variations quickly, it is a powerful tool. I'm currently working on a
remote REPL for Gambit-JS, so that you can remotely debug Scheme code
(possibly games) running in the browser.

------
hoprocker
It's truly inspiring to see a project like this completed. I've been wanting
to combine mobile (specifically Android) and some sort of Lisp dialect for a
while.

Am I interpreting correctly from some of the other components that doing the
programming in a language-once-removed (ie Scheme instead of Obj-C) opens an
easier path to compiling for both iOS and Android?

~~~
rrradical
That was part of my motivation for using Scheme, yes. Many indie developers
are using the Unity engine which can compile to many different targets. (But
that uses C# as far as I know.)

------
seivan
I am so jealous and incredibly happy that you shipped - nice work. I wish I
could do that as well.

~~~
rrradical
Thank you! No time like the present to start. Just do your best and then keep
redefining what your best is.

------
arms
Very cool! I always like seeing when something is built using a typically non-
traditional language for the environment. I downloaded the game to see how
well it performed, and I gotta say, it's a lot of fun. Great job!

------
xkarga00
Just downloaded and tried the app. Simple and elegant, very good work!

------
minikomi
Wow, I've been thinking about this a lot lately. I would pay for a good series
of tutorials or an ebook on this topic maybe implementing something well known
like Tetris etc.

------
elwell
It shows how spoiled I am that I expected a github link.

------
mjt0229
Nice work! I think I played ultimate with you this past summer, and we talked
about this on the way to a game.

~~~
Kiro
OT but what is ultimate?

~~~
mark212
a frisbee based game:

[http://en.wikipedia.org/wiki/Ultimate_(sport)](http://en.wikipedia.org/wiki/Ultimate_\(sport\))

my college football team played it as a spring sport during "optional"
workouts and it was brutal. Like rugby, only with a forward pass.

~~~
lumens
FWIW, OP has also made an Ultimate Frisbee game for iOS, sponsored by Major
League Ultimate, the biggest professional Ultimate Frisbee league going:

[http://asivitz.com/champ_ultimate/index](http://asivitz.com/champ_ultimate/index)

------
oliverlord
great work :) congrats

~~~
rrradical
thank you!

