Home Game-development Developing Mobile Games with Moai SDK

Developing Mobile Games with Moai SDK

By Francisco Tufró
books-svg-icon Book
Subscription
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
Subscription
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Why Moai SDK?
About this book

Moai SDK is a fast, minimalist, open-source Lua mobile framework for pro game developers. Moai is built around Lua, a common programming language for games, and offers a single open-source platform for both the front-end elements seen by consumers and the back-end infrastructure.

Developing Mobile Games with Moai SDK will guide you through the creation of two game prototypes in a step-by-step way, giving you the basic tools you need in order to create your own games.

Developing Mobile Games with Moai SDK introduces the basic concepts behind game development, and takes you through the development of a tile-based memotest, and a platform game prototype as well. You'll end up with a good codebase to start writing your own games.

You will learn some tricks that come from real life experience while creating a small framework that will allow you to display images, play sounds, grab input, and so on. You'll also learn how to implement physics using Box2D bindings, and everything in Lua, without having to use any compilations. After doing this, we'll take a look at how to deploy your game to iOS and run it on an iPhone.


With this book, you should be ready to go and create your own game, release it to the Apple Store, and have enough tools to dig deeper into Moai SDK.

Publication date:
March 2013
Publisher
Packt
Pages
136
ISBN
9781782165064

 

Chapter 1. Why Moai SDK?

Over the last two decades we've witnessed explosive development in software platforms, mostly represented by the mass adoption of Linux and Mac OS, and in the last few years, Android and iOS. In this chapter we'll see what this entails and why Moai SDK is here to help us all, and that for free.

 

Multi-platform development


So you want to make games. You probably have this great game idea and you're planning to release it for the Web, iOS, and Android platforms, and probably if you get traction, publish it on Steam. I bet you already have some concept art, or your Game Design Document (GDD) in place. But, have you planned on how are you going to make your game in order to be able to support all those platforms?

Nowadays you have three options to handle this problem:

  • Build the game n times, where n is equal to the number of platforms

  • Forget about multi-platforms and focus on one or two

  • Use a library/framework designed to support multiple platforms

The first option has an advantage in that you can optimize your game for each platform, ensuring it runs smoothly. Also, you can take care of platform limitations and change how your game looks according to them. But have you thought about the implications of having, say, four different code bases? Each one with their own bugs and ways of implementing logic. Additionally, you may need to hire multiple programmers if you can't find one with in-depth knowledge of all platforms. It's a nightmare.

Forgetting about multi-platforms could be a good choice for you, but in the end, if you make a really successful game (and a probable way of making a game successful is to have it available on as many platforms as possible, since this increases awareness), you'll want to port it to different platforms at low cost, and porting is expensive if the code is extremely tied to a specific platform.

This leads us to the last option, embrace a library or framework that supports multi-platform development. The basic idea is that you detach your code from specific platforms, using a widely-spread language (such as C, C++, JavaScript, or Lua) and build your game for different platforms using a single code base.

Note

A real-life example on the benefits of multi-platform development is Zipline Games' Wolf Toss. It had a 3-month development cycle and was released simultaneously on iOS and Android. If it were to be built for each platform, it'd have taken about three months for each platform, or a team twice as big. So, by developing Wolf Toss with Moai SDK, the studio spent half of the money that it would take with a platform-specific approach.

This approach has been gaining popularity lately because of its simplicity and powerful consequences. Many game development environments and frameworks that take this approach have seen the light of day in the last few years. One of them is Moai SDK.

 

Why Moai SDK?


It's safe enough to say that almost every single platform nowadays supports C++ and some flavor of OpenGL. That's the starting point for Moai SDK.

Moai SDK is a multi-platform game development framework. It's been developed in C++ and all of its features are accessible through Lua. What does this mean? That you can build your game completely in Lua (taking advantage of the flexibility of this amazing language) and, in case you need low-level access, you can always switch to C++ and do whatever you want. You can even bind your C++ libraries to use them in your game, in Lua. It has built-in access to Moai Cloud as well, which is a cloud service that allows you to deploy server-side code written in Lua, with databases, support for push notifications, leaderboards, and other fancy stuff. Note that the language is the same for your game and for your server-side code, nice.

In short, if XYZ platform supports OpenGL and C++, Moai SDK is likely to be supported by it.

Currently Moai SDK works on Windows, Mac, Linux, iOS, Android, and Native Client.

Anyway, there are many game engines that support multi-platform development. Many of them come with flashy interfaces, others with half of your problems solved, such as one-click deployment. So, what does Moai SDK bring to this world that has not been done yet? Freedom.

  • It's open source, you can download the code and do whatever you want with it.

  • It's free, no hundreds of dollars in licenses.

  • It doesn't tell you how to do things. It's aimed at pro developers who want to do things their way.

  • It has been used by several large-scale commercial games.

So these are the main principles behind Moai SDK's philosophy. A great mix for a great game.

 

Summary


Nowadays, to be able to develop games it's important to take into account multi-platform development. Moai SDK is a game development framework that helps us deal with this problem in an easy way using standard technologies that are available in almost every platform. Not only that, it's free and open source.

About the Author
  • Francisco Tufró

    Francisco Tufró has been captivated by computers and the possibility of using them to create new worlds since he was six years old. At age 14, he sort of hacked into a chat demo in Visual Basic and transformed it into a full-feature RPG chat, with support for maps, character sheets, and dice rolls. The years went by and he learned many things along the way, as any curious person does. Suddenly he found himself collaborating in various open-source projects, including Musix (a Linux distribution for musicians) and CLAM (working on the project for Google's Summer of Code 2008). He co-founded quov.is and worked as a Ruby on Rails developer for about 5 years while never forgetting about what drove him to computers in the first place, games.

    He put together a team and created The Insulines, an old-school graphic adventure about rock 'n' roll and diabetes. It was thanks to this game that he first came into contact with Moai SDK. It took about 8 months of development. He fell so deeply in love with Moai SDK that now he's working full-time on it with Zipline Games.

    He likes to call himself a developer, noting the difference from a programmer who is a person that has broad knowledge (not only in programming, but also in art, music, and other disciplines), perhaps not as deep as a specialized person does, but enough to tackle and solve problems in their entirety.

    Browse publications by this author
Developing Mobile Games with Moai SDK
Unlock this book and the full library FREE for 7 days
Start now