Bytesize Adventures
Crafting bite-sized digital worlds

Moai – Part 2


So, after my last post on Moai, I’ve continued to play with the framework (and with Lua). Its all leading me towards a second game.

I’m still hard at work on PPRPG, its not vapourware, I promise. :) This Moai project won’t impact the development or timeline for PPRPG and It’s actually having a positive effect (acting as a creative diversion to prevent burnout).

The two games are being developed in two very different ways. With PPRPG I have a clear vision of the final game and how it will feel. Development is pretty much planned out and, whilst I still have lots of game design problems to overcome, it’s pretty much a case of ploughing through the work.

This second game is much more organic. Its doesn’t have an aim. In fact the mining mechanic is something I just started to program, I didn’t really choose it. I’m just kind of throwing ideas at it and seeing what sticks. I’m programming in a very immediate fashion and refactoring code (frequently) as needed.

I won’t make you read all of the text below if you don’t want to. Here’s an updated video demoing my progress.

Since my last prototype video I’ve introduced a few new concepts. The first was the concept of streaming chunks of dirt. The way I’m doing this is to generate 1/2 screen of dirt as the player reaches the previous chunks edge – this is generated on the fly and stored in a very simple data table. As the earth is mined and block added, the data table is updated. Moving out of a chunk into a new chunk removes the old props (Moai’s terminology for a placeable instance – a bit like a CCSprite in cocos I think) from the screen. When you move back into a chunk, the engine reads from the data table and regenerates the props.

Obviously the final game will generate and stream content 3×3 to ensure that you don’t see the objects streaming in. I just found it was helpful to limit it to 1×1 whilst debugging.

Outside of that, I’ve added a few other features…

You can currently only dig left, right, and down. Ladders allow you to traverse previously explored places. They are automatically placed when you press “up” and have empty space above you.

“Gravity” has been added to the main player controlled “character”. There are no physics involved. It just detects empty space below and moves you down 1 layer/row.

On the tools front, I’ve found that the best combination is Sublime Text 2, Command Prompt, and the built in Windows Process Monitor (to show memory consumption and CPU load). Originally I had been using Sublime’s built in build command to run the game but switched back to command line because Sublime suppresses the output (which means you can’t print debug info on the fly).

I still have a lot to learn about both Moai and Lua. I’m currently rocking a single Lua file which represents the whole game (not sure if this is correct). I still need to look into spritesheets and animation.

I’m thinking about tweaking my chunk generation a bit more (utilising threading if I can). I’d generate chunks ahead of time and stream row-by-row rather than chunk by chunk.

Anyway, this game is about fun development so next up its a single ore type and bombs! (Not for a few weeks though since I have a bit of an PPRPG Sprint to get into :).