This is the development repo of Moai SDK. Current, but not necessarily tested or stable.
C++ Lua C Objective-C++ Shell Batchfile Other
Switch branches/tags
v1.7.6 mf_v0.1 gc_mods_pre_squash freedom_fall_release failing-from-cli archive/1.4-stable archive/1.4-development archive/develop Version-1.5.2 Version-1.5.2-binary-desktop Version-1.5.1 Version-1.4p0 Version-1.3-Build-160 Version-1.3-Build-150 Version-1.3-Build-149 Version-1.3-Build-143 Version-1.3-Build-98 Version-1.2-Build-56 Version-1.2-Build-36 Version-1.2-Build-35 Version-1.1-Revision-2 Version-1.1-Revision-1 Version-1.1-Build-3 Version-1.0-Revision-4 Version-1.0-Revision-3 Version-1.0-Revision-2 Version-1.0-Revision-1 Version-0.95-Beta-Revision-3 Version-0.95-Beta-Revision-2 Version-0.95-Beta-Revision-1 Version-0.9-Beta-Revision-10 Version-0.9-Beta-Revision-9 Version-0.9-Beta-Revision-8 Version-0.9-Beta-Revision-7 Version-0.9-Beta-Revision-6 Version-0.9-Beta-Revision-5 Version-0.9-Beta-Revision-4 Version-0.9-Beta-Revision-3 Version-0.9-Beta-Revision-2 Version-0.9-Beta-Revision-1 Version-0.8-Beta-Revision-8 Version-0.8-Beta-Revision-7 Version-0.8-Beta-Revision-6 Version-0.8-Beta-Revision-5 Version-0.8-Beta-Revision-4 Version-0.8-Beta-Revision-3 Version-0.8-Beta-Revision-2 Version-0.8-Beta-Revision-1 Version-0.7-Beta-Revision-1 Version-0.6-Beta-Revision-2 Version-0.6-Beta-Revision-1 Version-0.4-Beta-Revision-14 Version-0.4-Beta-Revision-13 Version-0.4-Beta-Revision-12 Version-0.4-Beta-Revision-11 Version-0.4-Beta-Revision-10 Version-0.4-Beta-Revision-9 Version-0.4-Beta-Revision-8 Version-0.4-Beta-Revision-7 Version-0.4-Beta-Revision-6 Version-0.4-Beta-Revision-5 Version-0.4-Beta-Revision-4 Version-0.4-Beta-Revision-3 Version-0.4-Beta-Revision-2 Version-0.4-Beta-Revision-1 Version-0.3-Beta-Revision-3 Version-0.3-Beta-Revision-2 Version-0.3-Beta-Revision-1 Version-0.2-Beta-Revision-4 Version-0.2-Beta-Revision-3 Version-0.2-Beta-Revision-2 Version-0.2-Beta-Revision-1 Version-0.1-Beta-Revision-42 Version-0.1-Beta-Revision-41 Version-0.1-Beta-Revision-40 Version-0.1-Beta-Revision-39 Version-0.1-Beta-Revision-38 Version-0.1-Beta-Revision-37 Version-0.1-Beta-Revision-35 Version-0.1-Beta-Revision-34 Version-0.1-Beta-Revision-33 Version-0.1-Beta-Revision-32 Version-0.1-Beta-Revision-31 Version-0.1-Beta-Revision-30 Version-0.1-Beta-Revision-29 Version-0.1-Beta-Revision-28 Version-0.1-Beta-Revision-27 Version-0.1-Beta-Revision-26 Version-0.1-Beta-Revision-25 Version-0.1-Beta-Revision-24 Version-0.1-Beta-Revision-23 Version-0.1-Beta-Revision-22 Version-0.1-Beta-Revision-21 Version-0.1-Beta-Revision-20 Version-0.1-Beta-Revision-19 Version-0.1-Beta-Revision-18 Version-0.1-Beta-Revision-17 Version-0.1-Beta-Revision-16 Version-0.1-Beta-Revision-15 Version-0.1-Beta-Revision-14
Nothing to show
Clone or download
Latest commit 2e48d2c Jul 18, 2018

README.md

Moai SDK is an embeddable cross-platform game development SDK written in C++ and scriptable in Lua. You can use Moai to write games or apps, or you can embed Moai in other programs. You can also use Moai as an overlay in your apps.

Multiple build systems are supported in this project. Sourcecode is kept in a common folder. There is a separate folder for each build system in the project root.

For IDE build systems (Xcode, Android Studio, Visual Studio), reference projects are provided. Cmake is also supported for Android and HTML5.

Third party libraries are included as git submodules (in some cases). The rest are vendored in. As a rule, we do not make any code changes to third party libraries. If functionality must be configured or replaced, we use a header injection pattern to do so.

A goal of the project is one-step build for the reference binaries. We don't want users to have to download and configure dependencies, or build parts of the SDK in advance. If you open the xcode/osx project (for example) and click 'build,' then Moai SDK should build for you in its entirety. This goal isn't always realized across all platforms, but it is something we strive for and if you want contribute build process improvements, please keep this goal in mind.

The project's principal developer (patrickmeehan) primarily works on OSX these days. As a result, the xcode/osx project is typically the most actively maintained. (For major releases, we update and test all projects.)

pito

pito is a command line toolbelt for automating some aspects of the project. pito is just a bootstrapper that use command line Moai to run lua scripts. To use pito, make sure moai-dev/pito is somewhere in your path. When you first run pito, if the Moai binary is missing, pito will attempt to build it.

At the Moai SDK project level, pito does very little beyond generating the HTML documentation for Moai's Lua interface and running some build scripts that can be used for CI. If you want to extend pito with other commands, type 'pito help' on the command line and you will see an explanation of how pito searches upward through the directory hierarchy for extensions.

Project Structure

  • 3rdparty - Submodules and third party source.
  • 3rdparty/contrib - Third party code snippets included in Moai.
  • android-ndk - Android JNI build project.
  • android-studio - Android Studio reference project.
  • bin - Moai executables, organized by OS type, generated by the various build systems.
  • cmake - Cmake build project.
  • docs - Legal notices and attribution images. Run 'pito make-lua-docs' to generate API reference.
  • legacy - Old stuff kept for reference. Unless you are a moai maintainer, you can ignore this.
  • lib - Moai static libraries, organized by OS type, generated by the various build systems.
  • pito - Moai command line utility.
  • samples - Moai SDK desktop and mobile samples.
  • src - All Moai SDK source code for Moai libraries and hosts.
  • test - This is a legacy, Lua-based test runner. Will be replaced by Google Test.
  • vs2015 - Visual Studio reference build system and reference project.
  • xcode - Xcode build system and reference projects.

Be sure to check for README files in these folders.

Reference Projects

Reference projects are the projects we use for day-to-day development work on Moai. We do not provide any kind of Moai project generator or IDE templates (though this functionality is somewhat provided by Cmake). The usage pattern for Moai is to copy one of the reference projects, manually update the paths to either the Moai source or libraries, and tailor it to your needs. This might sound onerous, but in our experience, if you know how to use the IDEs it should only take you a few minutes.

In the past, members of the community have provided extensions to pito that generate high quality IDE projects from project templates. We don't maintain these in moai-dev; the moai-community repository was created to hold them.

Hey, there aren't any docs! How do I use this thing?

Start with command line Moai. Add moai-dev/bin/ to your path then run some of the samples. We try to keep these up to date, but don't always have time (though for official releases of the SDK they all should work).

The samples are very, very simple. You will find Moai to be unopinionated and low-level. It is very much intended to be an SDK. You can piece it together however you want to make your game or app.

Once you get the hang of using Moai, start your project using a window size that uses a resolution/aspect ration you are comfortable with. You can adapt this later to handle multiple resolutions and aspect ratios. It is fine to prototype on desktop; mobile support is robust enough that you can port your work once you have something going.

How do I get help?

There's no official support for the project right now. Check the forums or see if you can get an invite to the Slack team.

If you have lots of money and want to hire someone to work on features for you or help you with your Moai project, you can try your luck by emailing 'moai-sdk' at fallguyconsulting.com.

Tips

  • For any kind of serious app, you will need to figure out how to handle transitions yourself (screen-to-screen or level-to-level). There is no official way of doing this.
  • Don't get too wrapped up in writing class systems of abstractions on top of Lua or Moai. At least not at first. A light touch is usually the way to go.
  • Moai does not attempt to hide or abstract low-level graphics concepts. To get the most out of Moai, you will need to understand coordinate systems and shaders. Game development is hard. Our goal is to provide convenience, flexibility and power, not to simplify.
  • You will eventually need to manage the garbage collector and hunt down objects that get left in scope. Don't worry: when you get there you will find that there are powerful mechanism in Lua and some memory analysis tools build in to Moai that will make this tractable.
  • Once you understand Moai viewports and scale settings, you will understand how you can write your app to use a device-independent coordinate system. For 2D games, you will be able to update your assets to use higher or lower resolutions without changing object dimensions. In our projects, we typically use at our highest targeted resolution for all assets and downsample for lower resolution devices.
  • Plan your letterboxing scheme early. You will want to decide up front if you will reposition UI elements or draw extra UI to avoid black bars.
  • Prototype on desktop, but test (a bunch) on device, well ahead of release.