## Is the Moai game engine dead? It appears no, not quite

I have been a big fan of the Moai game engine for a long time, going back to when I created a tutorial series about using it. Lately though, things got quite, really really really quite. The forum activity really dropped off, and new commits weren’t being added to the github. I had personally written it off as a promising but dead end technology. I decided to take a look at the forums after a few months off and found this interesting post from Patrick at Zipline games a couple days back:

#### Thoughts on the future of Moai

Marko Pukari sent me an email yesterday asking for a comment on what's going on (or not) with Moai SDK from Zipline's perspective. As you know we've been heads down on internal projects for quite a few months now. It's been ages since I've looked at the forums or our pull requests - I just haven't had the time. Looking at them this morning I saw a lot of high quality pull requests and bug fixes (thank you!) but was a bit surprised that they hadn't already been merged in to develop. I went ahead and grabbed the obvious ones and will try to close out the rest when I have time to get back to the SDK.

The specific question Marko wanted me to address is whether or not Moai SDK is a 'dead engine.' It isn't (and it won't be) for a few reasons. The first is that we are actively using it to develop our own games and will continue to do so. The second is that Moai SDK started life as my personal code base and I intend to keep working on it no matter what happens. Third, there is a community branch so even if I get hit by a bus the project will continue.As of this writing nobody has productized the engine, so if you are a less experienced developer and not prepared to fully maintain the engine yourself then think seriously about going with a commercial engine or authoring tool instead. Open source is great because you won't get boxed in by a missing feature or a bug... but you have to be experienced enough to implement the feature or fix the bug yourself, or rich enough to hire someone to do it.

Regarding Zipline, our games are paying us right now but developing them takes up our every working moment. This should ease up in a month or three, but nobody should sit around waiting for us. The big project for me personally is going to be to merge our 'studio' branch back into develop. From that point I will continue to work on the SDK. In fact, I can hardly wait!

I can confirm that we do plan to offer products and services around Moai in the future. Moai Cloud didn't work out, but there are some other things I'm hoping to announce later this year. None of them involve taking Moai closed source.

I'm also glad to see there is a community branch; I'll keep an eye on it and pull features and fixes from time to time. Alternatively, I've asked before and I'll ask again: if anyone wants to volunteer to maintain Zipline's branch and CI then I would welcome them to do so. This extends to all aspects of community and project maintenance. Just contact me directly via email.

Thanks!

Later in the comments was this interesting tidbit:

3) Sure. The moment someone wants to pay me to do that, I will. Until then I cannot take time away from studio work. Every hour I spend not doing studio work I am losing money. Me personally. As in out of my pocket. Bread off my table. Etc. Don't get me wrong - I appreciate everyone's interest and contributions. But so far to date Moai SDK has paid me exactly $0.00. In spite of it being used to develop flagship titles by companies that received over $10m in venture capital. Just sayin'.

And no, Patrick isn’t whining, I get 100% where he was coming from. He published Moai and certain studios certainly benefited majorly from it and that didn’t trickle back. This of course is one of the joys of open source software. It’s a bummer, but to me not surprising, that the Moai cloud efforts didn’t turn into a revenue stream. There is no need to contribute upstream to the success of Moai… but karma’s a bitch!

What I did and do find incredible disappointing is the complete lack of contribution I have seen from studios other than Zipline. Harebrained Schemes made Crimson Steam Pirates and StrikeFleet Omega using Moai and must have made pretty extensive changes… but did they contribute anything back to the engine? There was some early promises, but I haven’t personally seen a damned thing. And that is a gigantic shame.

At the very least though, we will be getting Ziplines internal copy pushed to the git repository, so that is good news. I hope others decide to get more involved in the community and make Moai a success.

## Computer Graphics: Principles and Practices 3rd Edition. A trip down memory lane.

So today on Safari Books Online came a book that was a complete flash from my past. Computer Graphics: Principles and Practices 3rd edition has been released. What’s so special about this book?

Three things…

First, it was the textbook I used to learn computer graphics a very long time ago.

Second, it was one of the only ( incredibly expensive ) books I had to purchase for school that I actually found valuable. ( Code Complete was the other book, if you were curious )

Third, it’s one of the only dead tree books I have kept. I am almost entirely digital these days, so you have to be a good book for me to keep you around, especially given the size of a few of the condos I’ve moved into over time, I’ve gone through a lot of book purges! When you consider how incredibly out-dated it had become, the world of graphics has changed a great deal since the second edition of the book was released in 1990! On top of that, all of the code examples where in Pascal, using a library I’d never heard of at the time, or used since.

Fortunately with the release of the 3rd edition, I now have one less piece of dead tree fighting for space in my house! There are a few things to know about this book, it’s has no code for OpenGL or Direct3D, it’s not really about that. The book actually uses WPF for it’s examples, but don’t worry, the concepts are easily applied elsewhere. The entire point of this book is to teach graphics programming concepts, not really about the implementation. If you don’t already know one of those APIs, you are going to want to pick up an additional book on your graphics library of choice ( if needed. ) That said, this will make you **understand** what you are doing with either of those graphics libraries. You will find when reading this book, it doesn’t really matter what programming languages or library you use, you will be able to digest and adapt to your tools of choice without a lot of effort. This book has been almost completely re-written at this point, and does cover the modern graphics pipeline.

What does it cover? Well, just about everything actually. That’s why I kept it around all these years. For example, here is the Table of Contents:

- Introduction
- Introduction to 2D Graphics Using WPF
- An Ancient Renderer Made Modern
- A 2D Graphics Test Bed
- An Introduction to Human Visual Perception
- Introduction to Fixed-Function 3D Graphics and Hierarchical Modeling
- Essential Mathematics and the Geometry of 2-Space and 3-Space
- A Simple Way to Describe Shape in 2D and 3D
- Functions on Meshes
- Transformations in Two Dimensions
- Transformations in Three Dimensions
- A 2D and 3D Transformation Library for Graphics
- Camera Specifications and Transformations
- Standard Approximations and Representations
- Ray Casting and Rasterizations
- Survey of Real-Time 3D Graphics Platforms
- Image Representation and Manipulation
- Images and Signal Processing
- Enlarging and Shrinking Images
- Textures and Texture Mapping
- Interaction Techniques
- Splines and Subdivision Curves
- Splines and Subdivision Surfaces
- Implicit Representations of Shape
- Meshes
- Light
- Materials and Scattering
- Color
- Light Transport
- Probability and Monte Carlo Integration
- Computing Solutions to the Rendering Equation: Theoretical Approaches
- Rendering in Practice
- Shaders
- Expressive Rendering
- Motion
- Visibility Determination
- Spatial Data Structures
- Modern Graphics Hardware

… so as you may be able to tell, this isn’t a short book. In fact it’s 1264 pages in length, which would be why this isn’t a proper review, I am not done the book. In fact, it’s one of those book I will probably never read entirely front to back. Instead I jump in to the areas I need, unless of course I struggle with the concepts being taught, then I tend to read the entire chapter until I’ve gotten the subject down. Of course, I read chapters from time to time just for something to do.

That’s another great part of this book. I am no math wiz, I have forgotten far too much, so with many pure math texts I struggle. This is why this book is very good. It’s not simple by any means, but it doesn’t just throw an equation at you and leave you scratching your head. Things are introduced in escalating difficulty, but if you have a late high school or first year university math education, you should be OK.

The math is fully explained over the course of the book. If you have trouble parsing out equations, they are explained fairly well in the book including how to decipher them. The book doesn’t magically make math easy, but it does do an effective job of explaining it, so that even a non-genius can make sense of things. Here for example is the excerpt on Euler Angles, and is typical of how things are explained:

### Example taken from book:

#### 11.2.2. Euler Angles

**Euler angles** are a mechanism for creating a rotation through a sequence of three simpler rotations (called roll, pitch, and yaw). This decomposition into three simpler rotations can be done in several ways (yaw first, roll first, etc.); unfortunately, just about every possible way is used in *some* discipline. You’ll need to get used to the idea that there’s no single correct definition of Euler angles.

The most commonly used definition in graphics describes a rotation by Euler angles (φ, *θ*, ψ) as a product of three rotations. The matrix **M** for the rotation is therefore a product of three others:

Thus, objects are first rotated by angle φ in the *xy*-plane, then by angle *θ* in the *zx*-plane, and then by angle ψ in the *yz*-plane. The number φ is called pitch, *θ* is called yaw, and ψ is called roll. If you imagine yourself flying in an airplane (see Figure 11.1) along the *x*-axis (with the *y*-axis pointing upward) there are three direction changes you can make: Turning left or right is called **yawing,**pointing up or down is called **pitching,** and rotating about the direction of travel is called **rolling.**These three are independent in the sense that you can apply any one without the others. You can, of course, also apply them in sequence.

Writing this out in matrices, we have

With the proper choice of φ, *θ*, and ψ, such products represent all possible rotations. To see this, we’ll show how to find φ, *θ*, and ψ from a rotation matrix **M**. In other words, having shown how to convert a (φ, *θ*, ψ) triple to a matrix, we’ll show how to convert a matrix **M** to a triple (φ′, *θ*′, ψ′), a triple with the property that if we convert it to a matrix, we’ll get **M**.

The (1, 3) entry of **M**, according to Equation 11.14, must be sin *θ*, so *θ* is just the arcsine of this entry; the number thus computed will have a non-negative cosine. When cos *θ* ≠ = 0, the (1, 1) and (1, 2) entries of **M** are positive multiples of cos φ and – sin φ by the same multiplier; that means φ = atan2(–*m*_{21}, *m*_{11}). We can similarly compute ψ from the last entries in the second and third rows. In the case where cos *θ* = 0, the angles φ and ψ are not unique (much as the longitude of the North Pole is not unique). But if we pick φ = 0, we can use the lower-left corner and atan2 to compute a value for ψ. The code is given in Listing 11.1, where we are assuming the existence of a 3 × 3 matrix class, `Mat33`

, which uses zero-based indexing. The angles returned are in radians, not degrees.

1 void EulerFromRot(Mat33 m, out double psi,

2 out double theta,

3 out double phi)

4 {

5 theta = Math.asin(m[0,2]) //using C# 0-based indexing!

6 double costheta = Math.cos(th);

7 if (Math.abs(costheta) == 0){

8 phi = 0;

9 psi = Math.atan2(m[2,1], m[1,1]);

10 }

11 else

12 {

13 phi = atan2(-m[0,1], m[0,0]);

14 psi = atan2(-m[1,2], m[2,2]);

15 }

16 }

It remains to verify that the values of *θ*, φ, and ψ determined produce matrices which, when multiplied together, really *do* produce the given rotation matrix **M**, but this is a straightforward computation.

Write a short program that creates a rotation matrix from Rodrigues’ formula (Equation 11.17 below) and computes from it the three Euler angles. Then use Equation 11.14 to build a matrix from these three angles, and confirm that it is, in fact, your original matrix. Use a random unit direction vector and rotation amount in Rodrigues’ formula.

Aside from the special case where cos *θ* = 0 in the code above, we have a one-to-one mapping from rotations to (*θ*, φ, ψ) triples with –π/2 < *θ* ≤ π/2 and –π < φ, ψ ≤ π. Thus, the set of rotations in 3-space is three-dimensional.

In general, you can imagine controlling the attitude of an object by specifying a rotation using *θ*, φ, and ψ. If you change any one of them, the rotation matrix changes a little, so you have a way of maneuvering around in **SO**(3). The cos *θ* = 0 situation is tricky, though. If *θ* = π/2, for instance, we find that multiple (φ, ψ) pairs give the same result; varying φ and ψ turns out to not produce independent changes in the attitude of the object. This phenomenon, in various forms, is called **gimbal lock,** and is one reason that Euler angles are not considered an ideal way to characterize rotations.

If you can make sense of the above, you will be good with this book. This sample is pretty typical of how things in this book are covered. So if you are looking for a text for learning or brushing up on computer graphics Computer Graphics: Principles and Practices is probably one of the best. With the exception of Physics, and library specific instructions, this book has pretty much everything you might need to know.

## Awe6 framework release 2.0.572RC. Now supporting Haxe 3 and OpenFL

I took a look at the Awe6 inverted game framework a couple months back and was quite impressed. Shortly after I decided to go with Haxe the NME project announced the rebranding to OpenFL and move to Haxe 3, something I looked upon with some doom and gloom. Fortunately it’s not that bad after all. A couple days ago, Awe6 announced a new release supporting OpenFL and Haxe 3, among other things.

From the release notes:

## RC 2,0,572

Major release, some breaking changes. Includes:

- Haxe 3 compatible (refactor to new syntax and conventions)
- NME drivers replaced with OpenFL drivers
- Optional paramaters refactored (Floats, Ints, Bools made non-nullable)
- Run script NME references replaced with OpenFL references
- FlashDevelop templates updated for above
- API docs not yet revised, due to chxdoc compatibility

Good news and good work.

So, I guess I have to eat some crow about the move to OpenFL. At this point in time, Aw6, Flixel and Haxepunk are all compatible with OpenFL. So it appears the move hasn’t fragmented the landscape as much as I expected.

## Just starting out, what games should I make?

Way way wayyyyyy back when I created I want to be a game developer… now what? I wrote:

*So, you’ve picked a language, the libraries you want to use and now you need to, you know… do something. The following are a list of suggested projects for a new developer interested in games, with a ( fully my opinion ) difficulty rating attached*

Then I completely neglected to actually provide the list. Oops.

As this is one of those questions that comes up so often with new developers, I’ve decided to finally answer it. Basically this is just a list of progressively more difficult game projects that you can work on when just starting out, as well as details of *why* to do each project. Of course, you don’t need to do any or all of these projects, it is simply a logical ( to me! ) progression of projects for a new game developer to work on.

For each example, I've linked some random tutorials that you can refer to if you have trouble. I would suggest trying to do it without the help of a tutorial the first time, you will learn more that way. That said, there is no reason to bang your head against the wall over and over if you run into difficulty. Although occasionally satisfying, head banging is rarely an effective learning method. If there was a new concept introduced with the game, I often also add other links that should prove of some use to you.

The tutorials were discovered mostly using Google, then I took a brief look at the code to make sure it wasn't awful. If you have better recommendations for linked tutorials, let me know in the comments and I will edit them in! If you run into trouble, also let me know in the comments and I will see what I can do. I hope some of you find this guide useful!

## Games you should make when just starting out, in chronological order

### Adventure/Zork/Simple text adventure

**Why?**

It's about as simple as you can get and still call it a game. You are going to learn string handling, something you will be doing A LOT. You will also implement a rudimentary game loop ( get input, update world, display result ). Also, you don't have the added complexity of graphics.

**Examples:**

Javascript text adventure sourcecode

### Hangman

**Why?**

If creating a text adventure isn't your thing, Hangman is another simple game concept that doesn't require graphics. In many ways, the process will be virtually identical to a text adventure, so if you do the one, you won't really learn much by doing the other and vice versa.

**Examples:**

### Tic Tac Toe

**Why?**

One word… AI. While not having made the jump to graphical programming yet, you are now going to have an opponent to program. The nice thing about Tic Tac Toe is, you can start of brute forcing the logic, but after some time you can look at implementing a more elegant solution.

**Examples:**

**See Also:**

Once you've got Tic Tic Toe going, consider looking at a more elegant way of solving the board. A very commonly use algorithm in AI development for making decisions is the MinMax algorithm. After you licked MinMax, there is an optimized version called AB ( alpha-beta pruning ).

MinMax and AB pruning explained ( pseudo code )

C# implementation of Tic Tac Toe using Minmax and AB pruning.

### Pong

**Why?**

Welcome to the wonderful world of graphics! You will have to learn about the render loop, how you draw the world each frame. This will also be your first taste of collision detection, although with Pong this can be faked. You will also have to learn how to make an AI that isn't perfect! Of course, you will also be taking your first steps into 2D game math, although you can minimize the math required a great deal, depending on how you implement Pong. You may also encounter a state machine for the first time, depending on how you implement it. Pong represents a project you can start simply and make a great deal more complex as you get comfortable.

**Examples:**

Over-engineered pong in C++ using SFML ( on GameFromScratch.com )

**See Also:**

At this point you are going to need to select a graphics library for your language of choice. Pong is simple enough you can often get buy using the native drawing library of your programming language ( if it has one, C or C++ do not ). Otherwise you need to select a library. This post should help you in the selection process if you are using C++, C#, Java or Python. If you are using Lua, this post should help. If you are using JavaScript, select a library here.

Now might be a good time to brush up on the concept of a game loop.

**Breakout**

**Why?**

Well, it's basically Pong for one player with slightly more sophisticate math. Purely optional, but if you completed Pong, Breakout/Arkanoid should be a pretty easy progression. Granted, you won't really learn much new.

**Examples:**

Breakout in JavaScript using Canvas

**Asteroids**

**Why?**

Math baby math. The process is going to be very similar to Breakout or Pong, but since the player can move and shoot in many directions, the math is going to be very different. The collision detection is also going to be more complicated. Don't let math scare you off, it's not really that complicated, and I've got examples/tutorials for basically everything you need to know!

**Examples:**

Asteroids in Python with PyGame

**See Also:**

For the math, I've created a series of math tutorials that cover everything you need to know to implement Asteroids.

**PacMan**

**Why?**

PacMan introduces a couple interesting concepts. First is the concept of a level file or map. Next is the AI controlling the ghosts, commonly implemented using a State Machine, a very common algorithm in game programming. PacMan also introduces the concept of levels.

**Examples:**

**See Also:**

Finite State Machine in PacMan (PDF Link)

**Platformer**

**Why?**

Now would be a good time to try and implement a platforming game, be it a single screen game like Donkey Kong, to a side scroller like Super Mario brothers. You will be faced with implementing some kind of physics ( jumping, falling, not-falling ) and more advanced collision detection than you have to date. You will also have more difficult level requirements. Optionally at this point, you can implement physics in your game, don't worry, it's not as scary as it sounds.

**Examples:**

JavaScript platformer tutorial (link to part two is in the comments)

Android platformed with Java/libGDX

**See Also:**

A big requirement to creating a platformed is a level creation tool. Now might be a good time to check out Tiled one of the most popular, and free, map editing tools available.

For 2D physics, Box2D is the most popular library and it has been ported to dozens on languages. Here is a tutorial on creating a platformer using Box2D and Cocos2D with Objective-C.

**What now?**

That will have covered off most of the basics. The only thing glaringly missing from the list of things covered that I can think of is advanced pathfinding, such as learning the A* (A-star) algorithm. You can learn more about it by reading this Stanford article. The next logical jump would probably be to work in 3D, if that's where you want to go next ( you could easily spend your entire life just working on 2D games if that was your preference ). If you want to go 3D, I highly recommend using an engine to start. If you are struggling with how to create art for your game you may want to check out A Programmer's Guide to creating art for your game.

Once again, this page was simple meant as a list of suggestions for games to create for developers that are just starting out. Feel free to do them in whatever order you want, or to skip them entirely, but as listed above, the difficulty progression does make a certain amount of sense.

## Project Anarchy tutorial series now officially a series…

I have finally put together a single page for Project Anarchy tutorials.

Basically, it’s just a static page where you can access all current and future Project Anarchy tutorials on GameFromScratch. There are a couple advantages to this though. First, it makes it easier to find things than using tags. Second, since the tutorial series is in order, I suppose it’s nice to actually put them in order, eh?

Finally and perhaps most importantly, it gives a great place to leave suggestions, feedback and comments on the series as a whole. So, if you have a question that isn’t specific to an individual tutorial, or you want to request a specific thing be covered, this page is the perfect place to post them.