Monthly Archives: November 2016

AirConsole RTS Devlog – Map Generation

I’m working on a Real Time Strategy game for Air Console. I’m working out the gameplay mechanics before deciding on the theme. There will be a map of nodes with links between them on the screen and players will control the nodes with their personal device and use them to attack other player’s nodes. Each player will see the data on the nodes they control on their controller and any ongoing battles will be displayed on the big screen.

My time so far has mostly been spent setting up my development environment and figuring out how to structure the project. I am using Brackets to write my Javascript and Closure to compile it. While Javascript is an interpreted language using this tool from Google will optimize it.

I have started work on the map generation:

RTS map

The map is a set of nodes with links between them. Nodes can attack other nodes if they are linked. Right now 2 planets are linked together if there are no other planets between them. In future versions I will add more complicated rules to link planets and try to position the planets so they look less like they’re on a grid.

Namespaces and classes in Javascript

I am currently working on a game for Air Console. It’s a cool platform for local multiplayer web games.

So far most of my time has been spent experimenting with HTML5 game frameworks. For this project I have settled on the CreateJS suite. It seems to be functional, minimal and up to date.

I have also been learning a bit more about how to organize a HTML/javascript application. Javascript doesn’t have special keywords for ‘class’ or ‘namespace’. Everything is done using functions, which left me scratching my head and wondering how you’re supposed to manage a large codebase without constantly running into name conflicts.

There were two articles I found helpful. The first is a simple rundown of some common ways to use Javascript’s functions like a class:

http://www.phpied.com/3-ways-to-define-a-javascript-class/

The second article explains a slightly more complex concept that allows you to create namespaces within Javascript. This allows you to encapsulate all the variables in your app within a single root var, which helps reduce the chance that one of your variables is defined in another module.

https://appendto.com/2010/10/how-good-c-habits-can-encourage-bad-javascript-habits-part-1/

The article features my new favourite piece of technical jargon: Self-executing anonymous function. It’s a phrase that would strike terror in a student’s heart if it appeared at the top of a lecture slide.