Want to Make a Native Mobile Game? Try Solar2D

The open-source game engine offers a slew of features and a good DX

David Hockley
4 min readOct 3, 2021

Some of you may want to develop a video game. I spent a lot of time as a teenager creating games, and to be honest that’s how I learned to code.

There are many different options depending on what you want to do. I’m going to introduce you to one that I’ve been having fun using for almost 10 years.

If you want to develop 3D games, there’s a very accessible option called the Unity engine. It can be difficult to set up when you’re on your own if you’re starting out as a developer or if you are on your own. You need to have access to 3D objects — i.e. the help of a 3D graphic designer. There is a 2D option in Unity but the complexity inherent to 3D remains.

If you can make do with a 2D gameplay there is a simple, fun, and free solution that I’ve been using since 2012.

This solution (previously known as Corona SDK) is now called Solar 2D. I’ve had a lot of fun with its game engine. With it, I’ve developed a wide range of games and applications (including a streaming platform). So what is the point of Solar 2D, and what you can do with it?

What can you do with Solar 2D?

A lot of things. First of all, Solar 2D creates executables for Android and iOS. It also allows you to build for Windows, for Mac (so to OSX), for Linux, and to export to the web. (And they are working on a Switch version).

Despite all these platforms, Solar 2D is a cross-platform 2D game engine for mobile that is great fun to use.

What does that mean?

It means that Solar 2D caters to mobile development first. All mobile-specific features (e.g. Touch, GPS, gyroscope) are part of the core engine and are easy to use.

Solar 2D is cross-platform. The beauty of Solar 2D is that it abstracts away the specifics of iOS or Android development. To do so it implements a 2D both in Objective C and in Java / Kotlin. This game engine exposes a single API. One LUA script can then control that API, and the resulting app will work the same on Android and iOS.

Finally, Solar 2D is a game engine.

It offers a physics engine using Box2D. It also offers a particle engine that allows fluid management.

It has a graphical particle engine.

It has a sound engine, both one-shot and streamed.

It allows you to manipulate graphical objects, group them, move them and animate them. It manages sprite animations, timers, scene changes, and rendering frames. It also implements transitions that allow you to vary any property of a graphic object over time.

React Native or Flutter position screen elements based on the way layouts work on the web. In Solar 2D, if you want a 20-pixel wide square at the top left of the screen, that is precisely what you write. Everything is both simple and direct.

For example, at one point I coded a puzzle made of different puzzle pieces. I used puzzle images to detect their outline. I then created a polygon and mapped a texture on it based on the position of the puzzle piece. That sounds complex, but it’s actually only a few lines of code. The engine does all the work.

The library for managing network communications to call web APIs is also easy to use. The same is true of writing and reading files locally, which is useful for saving game state.

Solar 2D can also handle in-app purchases for Apple, Google, and even Amazon stores.

It has a built-in video player, which reads videos locally or over the network.

What about the DX?

Solar 2D offers a simulator (on Windows and Mac) that allows you to test your code in real-time. There is no need to wait for it to compile, everything is immediate. If you want to test your applications on a mobile device, live mode synchronizes the code between the computer and the phone. This allows you to see your code on your phone, in real-time.

Unlike React Native or Flutter, there is no state to manage. There are simply variables stored in memory, and graphical objects the LUA manipulates. Solar 2D renders all that in native code.

And therein lies LUA’s advantage. It’s an easy-to-learn language that controls native code with very low overhead. (Unlike the Javascript bridge in React Native for example).

Is Solar 2D for me?

If you want to create a 3D game, you should look elsewhere, like Unity or even better, Godot. And if you want to create an application that is not a game, it may be more efficient to use React Native or Flutter.

But if your game is 2D, and you want to release it on both iOS and Android, Solar 2D should be very high on your list. Because it’s simple, efficient, and most of all very pleasant to use.

--

--

David Hockley

Solopreneur, Youtube creator, writer. I help people discover how & why code can be fun