-
03 Sep
Announcing RubyMotion 4.0: free Starter edition, cross-platform games, watchOS 2.0
We are very excited to announce the immediate availability of RubyMotion 4.0. This is the first release of the 4.x series, which will include several important features. Let's cover a few of these today!
RubyMotion Starter: 100% free
We are happy to introduce RubyMotion Starter, a fully-featured version of RubyMotion, available for free. Download it today!
RubyMotion Starter comes with full support for iOS and Android development. You can call into the entire set of public APIs, test locally on your machine and your devices, and submit to the respective app stores.
As with the other versions of RubyMotion, Starter will statically compile your Ruby code into optimized machine code, and let you use 3rd-party libraries, with CocoaPods on iOS and Gradle on Android.
Applications built with Starter include a RubyMotion-branded splash screen. To remove the splash screen, a paid subscription can be purchased. Also, Starter does not come with support for OS X and watchOS development.
Cross-platform games
RubyMotion 4.0 now comes with a brand-new, 100% cross-platform engine to write mobile games. You can now write games for iOS and Android with a single code base and using a pure-Ruby API.
Here is the traditional Hello World:
class MainScene < MG::Scene def initialize label = MG::Label.new("Hello World", "Arial", 96) label.anchor_point = [0, 0] add label end end class Application < MG::Application def start MG::Director.shared.run(MainScene.new) end end
(For a more complete sample, check out Flappy Bird written in 100 lines!)
Our cross-platform game API is fully-featured. It covers audio, sprites, animations, particles, device sensors / events, scene graph / director, UI widgets, and more. It is based on well-tested and solid foundations, such as cocos2d-x and box2d.
Since the API is based on RubyMotion, games are fully compiled into machine code, are able to call into public native APIs for iOS and Android, and can use 3rd-party native libraries. Exactly like regular RubyMotion apps.
At the time of writing, the API is distributed free of charge as a gem, named motion-game, and available in beta. The gem requires RubyMotion 4.0.
$ gem install motion-game
After installing the gem, you can create games from the command-line using the
motion-game
template.$ motion create --template=motion-game Hello $ cd Hello
motion-game projects are quite different from traditional RubyMotion projects, in the sense that they are cross-platform. The
app
directly contains code that will build for both iOS and Android, and theRakefile
exposes all iOS and Android tasks under the respective:ios
and `:android: namespaces.For instance, to build your game for the iOS simulator then the Android emulator, use the following tasks.
$ rake ios:simulator $ rake android:emulator
That's it! For more information, check out the following resources:
We are very excited about motion-game. We are releasing an early preview and hope you will give it a try and report us problems you may find.
Holy shit! I know what my next game will be written in.
— Amir Rajan, author of A Dark Room for iPhonewatchOS 2.0
Apple introduced WatchKit in November of last year, allowing developers to write apps for the Apple Watch. (And we supported it a few days later.)
In the first version of WatchKit, apps were actually running on iPhone devices and were not using true native APIs. Apple addressed these limitations when previewing watchOS 2.0 at WWDC.
As of 4.0 RubyMotion now provides support for this new platform. You can create new projects targeting watchOS 2.0, utilize all the native APIs, deploy them to your Apple Watch, and prepare App Store submissions.
We have been working hard on this and while the support is still in beta, we would like you to start using it, and report us issues you may find. Please refer to the new Apple Watch Guide on our developer center.
We will be improving the watchOS support over the following months. watchOS 2.0 itself is currently still in developer beta and presumed to be released later this year.