Unity Minecraft Voxel Engine

After playing A Game of Dwarves (and despite the super-shallow gameplay, loving it), I decided to build a similar story-driven game with minecraft-style environments. It’ll be a top-down shooter where the player destroys blocks to find resources and weapon upgrades in a procedurally generated world (but with designed areas).

This was being built with a friend, with him taking care of the movement and shooting mechanics, and me doing the world generation and rendering. My focus for this voxel “engine” was to have it be performant, and integrate into Unity as seamlessly as possible. It uses a tree of map generators to allow alterations of procedural maps, and an Editor Script which allows modification of the world through the scene view. I’m hoping to add the last few features and submit it to the asset store. It can optionally generate an optimised set of box colliders for the terrain, making any existing player controllers work unchanged.

Play (Webplayer)

I hope to use the same system to port (and improve) Portals 2D to Android and iOS.


Escape 51 Updates

Been working on the infinite runner a little more; I added a new stage for escaping the lab (which I’d like to also use in the tunnel sequences) and fixed up the dogfights a little more (I may scrap them and replace them with a Space Invaders sequence instead though). It also has a cute little menu and the staging system was rewritten to allow nicer transitions between stages.

Play in browser


Escape 51

Unfortunately, I’ve started yet another project, this time a (hopefully) quick infinite runner. You play as an alien weaving through a canyon while being chased by people. The game is broken into two distinct stages, first weaving through the canyon, trying to collect as many nuts and bolts while avoiding the walls, then a dogfight with aeroplanes. Use the WASD keys to move, and space to shoot.

While designing the game, I attempted to simplify the movement as much as possible. Games like subway surfers make it difficult to move between far lanes, however distinct lanes seem to make games easier feel more polished. This game allows movement to any lane with a single gesture, and tries to reduce diagonal movements. I tried to keep things feeling digital/retro by having the enemies move and fire in distinct patterns, which also seems to simplify gameplay.


These releases were roughly daily, progress slowed pretty heavily after the 4th release:

I’ll be working with Rosie to get the graphics looking much nicer and flesh out the gameplay some more, but I’m still unsure where to take it. Please feel free to post any ideas!



Unity RTS Updates 2

I havent done much this update, but thought I should have the latest version up. This update is primarily just touching up the fog of war, it is now blocked by trees and cliffs (and any other high objects). The ambient occlusion was also changed, not sure if its an improvement. And theres been a ton of code cleanup to get the fog of war code into something that would be more easily plugged into a new project.

If you want to build an RTS of your own, Elgar’s Code Musings is a decent place to start, he’s written up his findings while developing an RTS in Unity.

Unity RTS game

I’ve been getting a bit annoyed at the slow progress on the WebGL RTS4 project. I know what the problem is; I’m over-engineering it, trying to design it to be very general purpose and flexible, but as such it becomes very difficult to make progress.

I decided instead to see how far I could get building in a more purpose-built way. Over the last few weeks I’ve been putting together a model pack for Unity, to be released on the Asset Store along with a sample project to see the assets in action; this would be my sample project. The models were created in a hand-drawn cartoony style.


The current version was built over about a week:

  • Day 1: Pathfinding and unit movement
  • Day 2: Resource management, gathering, and melee combat
  • Day 3: Town Centre model, buildings as pathfinding obstructions
  • Day 4: Placement of buildings, terrain fog of war
  • Day 5: Hydra, Unit fog of war, FOW fading to grayscale over time

Some of the code is designed similarly to the WebGL RTS4 port, but with more stuff assumed (ie. only 1 action can be active at a time, terrain is a heightmap, buildings are rectangular).


Play in your browser (Unity)

ModHQ and UI Editing

I’ve integrated the UI viewer/editor into ModHQ and fixed up some performance problems. It now loads in about 2 seconds on my (fairly low specd) laptop. It also has a nice new loading screen.


The program is essentially read-only at this stage, any changes you make with the unit prototypes or UI wont be saved back to your data files. However, all changes made through the Data Files tab will.


In this screen, double click any item to convert it to XML and open it, you can then make edits in your xml editor, and save it back to have it compiled and inserted back to the data file. Textures can be viewed through this tab, but will not successfully save back to the data file.

As before, you can check and uncheck items in the UI Editor tab to see their contents


Download: ModHQ (.Net 4 + source)



RTS4 UI Viewer

I put a little more work into the UI viewer; moved it to WPF and added some slight editing capabilities (but no way to save the file back). It will let you see a number of different UI files at different resolutions, and see all of the hidden elements from the AOM alpha.

It does not yet capture all of the data in the files, so its not possible to save back without data loss. But its probably not worth finishing off.


Download (.Net 4 + Source)


RTS4 – WebGL

I’ve decided to move RTS4 to JavaScript and WebGL instead of some C# environment. Specifically, the game is being developed in TypeScript, a JavaScript-like language which adds common object oriented features to the language. The game is using the same “engine” as the WebPA demo, ported to TypeScript and improved with better separation between resources and WebGL interfaces, and added animation / DAE support. This move brings a heap of new abilities and challenges, summarised below:


  • Can access the game from anywhere by visiting the URL in a newer browser (can also run on mobiles)
  • Much less likely for WebGL to be discontinued
  • Built-in standard and high performance UI framework (HTML/CSS)


  • Very difficult to load external resources (require expensive upload or local storage options)
  • Mathematical inaccuracies make multiplayer and game replays much less stable, require error correction
  • Overall slower loading and rendering performance
  • Impossible to protect the game code from hackers, though security measures can be added to prevent cheating in multiplayer.

After designing enough of the game, I will likely build a native Windows version of the game as well. The current version is quite underwhelming, but can be played below.


Play in Chrome

Retina compression

I somehow ended up at a video describing how our eye compresses the images we see down 125-to-1 before sending it to the brain. Its quite a simple process (excuse my poor terminology), each ganglion cell connects with a group of photo receptors in a receptive field, and provides a single output value for that information. The receptors in the centre of the receptive field increase the output, the outer receptors reduce the output.

I’ve attempted to build an image compression application that works the same way, a series of receptor fields are randomly generated and processed to determine their output. The picture below shows the overlap and value of these fields.


A decompressor then takes this data and enforces the constraints of each receptor field, changing the values so that the output of each field is as it should be, reproducing something resembling the input image. This is shown below, with a similarly-sized jpeg compressed image to the right (both ~10kb, a compression rate of ~20-to-1)


A lot of the noise could likely be reduced with further tweaking. A few unique features of the way this method works:

  • As the compressed data only contains differences, the overall colour balance is lost.
  • As the compression enforces constraints, the image can be variable detail (the centre of the above image is intentionally higher detail than the edges), and any shape.
  • As I’m using an iterative approach for decompression, it takes a LOT of processing power.

EDIT: Wanted to leave it at that, but I ended up doing some more tweaking to it, its getting very difficult to push it any further, but these fixes give it slightly better colour and higher contrast. It really needs a pass to smooth areas of the image where appropriate, but I cant seem to figure out a reliable way of doing that (so the subtle gaussian blur will have to do):


Edit: Download Source