Show HN: My current App Store Featured Game was written entirely in Scheme
itunes.apple.com
itunes.apple.com
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
Just the first that comes to mind.
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.
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.
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.
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/
A dictionary — being text-based, with very few animations, and no background soundtracks — avoided most of mobile-platform-specific issues.
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.
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).
((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.
There's a basic explanation of the method in another comment I've written here though.
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!!
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.
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.
Is this an online source? I would love to see a compiler course by someone like Marc Feeley!
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?
Almost makes me want to play around with it again. :)
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
(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.
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?
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.
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.
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!
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.
Your code probably isn't what I'm looking for right now. But single stepping and debugging in user-land is exactly what embedded systems need.
I'll keep an eye out for your stuff.
I reworked the same technique to make it a debugger instead of continuations.
I couldn't get Black Hole to install and gave up. I remember the docs being pretty bad, even for Gambit. I use the builtin namespacing system, which works pretty well. Hopefully R7RS will make the whole scheme world a bit more user friendly.
You sound like you know how to code. Can you talk a little more about how the algorithm you were confronting made the effort of getting a Scheme platform working worthwhile? Understood if the answer is "not that big an effort". :)
Part of my question is that a solid lisp (of any ilk) programmer can program non-lispy languages in a lispy way.
It is great work, and I think there's value in making other languages that don't require huge runtimes viable for ios development.
Just today I found a Clojure/ObjC bridge: https://github.com/galdolber/clojure-objc
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/?p=223
https://play.google.com/store/apps/details?id=org.keithflowe...
Note that this is just the interpreter itself - not a very good way of writing games for Android.
(car(cdr(car(cdr(cdr a)))))http://www.amazon.com/The-Little-Schemer-4th-Edition/dp/0262...
A year before I was born :)
I tried reading the book a few years ago, I remember being irritated by the QA style it uses and dumping it because of it. On my second attempt I realized that it's only irritating if you know the answers very well and skipped to the chapter I didn't have so much confidence in understanding. And it was very pleasant experience, especially when I stopped to think a little before reading the answers. It felt like I was having fun.
So I'd advise to give a book a go, even if you are confident in your Scheme and FP skills. Just skip the parts which seem too obvious to you and get to the interesting stuff, you won't be disappointed.
Now it's time for The Seasoned Schemer, I guess :)
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.
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...
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
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?
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!
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.
scheme REPL over TCP using chibi scheme: https://github.com/clarkeaa/Scheme_iOS_REPL
calling in and out of Gambit-C: https://github.com/clarkeaa/HelloGambit
You can grab a precompiled Gambit-C library from the later project if you want.
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.
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?
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.