Installing and running Node.js on a VPS

Introduction

I recently had the requirement to implement a global none app store specific leaderboard system that can track scores and players for a mobile game that I am developing in Unity3D. After much investigation node.js seems to be the technology to use to create a server to handle it. I want it to be as quick as possible without having to resort to C++, plus I’ve been looking for an excuse to play with node.js in more detail. Ok, so I went to ovh.net and purchased one of their super cheap VPS (Virtual private server). I opted for Debian 8 LAMP (this is the Debian 8 Linux OS with, Apache web server, MySQL and PHP). After reading up the set up instructions, I managed to get logged into my VPS using PUTTY on Windows.

Installing node.js on a VPS

First thing to do is install node.js to the VPS. In the Putty terminal type the following:

Download and run the Nodesource PPA (personal package archive) installer script:

cd ~
curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh

Install node.js:

sudo apt-get install nodejs

Install the build essentials for some packages that require compilation

sudo apt-get install build-essential

Testing out the node.js installation

Ok, so now we have node.js installed, its time to create a hello world and run it to ensure that it works. In terminal create hello.js:

cd ~
nano hello.js

If you do not have the nano text editor installed then you can install it as follows:

sudo apt-get install nano

Once the file is open add the following code:

#!/usr/bin/env nodejs
var http = require('http');
http.createServer(function (req, res)
{
    res.writeHead(200, {'Content-Type': 'text/plain'});
    res.end('Hello World!\n');
}).listen(8080, 'localhost');
console.log('Server is running at http://localhost:8080/');

Make the script executable:

chmod +x ./hello.js

Run the script:

./hello.js

Note that the script is blocking because it is sat in an infinite loop waiting for connections, so you can no longer type anything into terminal. To test, run another instance of terminal (Putty on Windows) and enter the following to test the script:

curl http://localhost:8080

You should see “Hello World” printed out which is the response from the hello.js script.

Installing and using Process Manager (PM2) for node.js

The next issue we need to look at is how to make our script run in the background so it does not block. To do that we need install a tool called PM2 (process manager for node.js):

sudo npm install -g pm2

Once installed we can set our script off running as a background process with:
pm2 start hello.js

And to make PM2 re-run when the server reboots:

pm2 startup systemd

Note that when PM2 restarts it will restart all of its running processes.

Getting node.js to work with Apache

The general idea is to run the node.js server on a different port and forward requests to a specific url to this port using a reverse proxy. To do this we need to update an Apache config file httpd.conf. Note that if you do not find this file in the /etc/apache2/ directory then you will need to create it and add the following text:

ProxyPass /node http://localhost:8000/
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

And add the following line to /etc/apache2/apache2.conf to ensure that the file gets included

Include /etc/apache2/httpd.conf

Note that it is likely that the proxy module is not enabled on Apache, in which case enable it using:

a2enmod proxy_http

Now requests to http://www.yourdomain.com/node will be forwarded to localhost:8000, adjust the original hello world node.js script to listen on port 8000 and give it a test.

Hiding UI elements in Unity!

Ok, so recently I tried to find a way to hide UI elements in Unity 5, looked far and wide and apparently its not possible to do something like element.visble = false. So, the easiest solution I found was to set the game objects localScale to 0, e.g:

transform.localScale = new Vector3(0, 0, 0);

And to make visible again use

transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);    // Or whatever original scale the object had

 

Tiny Bombs Boom! is a Go for Android, iPhone and iPad on Google Play

Tiny Bombs GO Icon

Tiny Bombs GO for Android

Tiny Bombs Boom! – Save the holiday inn hotel

Available FREE for Android on Google Play

Available FREE for iPhone and iPad on the App Store

Bad guys have hidden bombs on every floor of the holiday inn hotel, your job is to find and defuse them and save the hotel. Tiny Bombs Boom! mixes match-3 style game play with action creating a tense addictive mix as the player chases over 1000 floors eliminating explosives, new and unique ways of helping or punishing the player are added to the mix by way of power-ups and hazards.

Tiny Bombs GO in-game screen shot

Tiny Bombs Boom in-game screen shot

Tiny Bombs GO in-game screen shot

Tiny Bombs Boom in-game screen shot

As the player progresses from floor to floor of ever increasing difficulty, the game is expanded by unlocking mini-games. Each mini-game is unique and completely different from the main line of play. Each mini-game features progressive difficulty play that puts the player under ever increasing pressure to complete the next round.

Tiny Bombs GO in-game screen shot

Tiny Bombs Boom in-game screen shot

Tiny Bombs GO in-game screen shot

Tiny Bombs Boom in-game screen shot

Ten mini-games are available at launch with plans to add more as time goes by.

Special level unlock codes can be added to unlock the extra features, these will be released to the press over the coming months.

Marmalade SDK 8.4 out now

The latest and greatest version of the Marmalade SDK is now available here
Highlights

  • C++11 support now available.
  • Apple Pencil pressure reading is now supported on iPad Pro in addition to existing 3D Touch support.
  • Slide Over and Split View multitasking now available to Marmalade apps on supported iPad models.
  • Compression of assets in APKs on Android is now supported.
  • Windows 10 ARM builds can now be directly deployed to any attached device without any special configuration.
  • s3eCamera can now return high quality still images on Android, rather than the viewfinder preview.
  • s3eWebView updated to use newer version of Chromium Embedded Framework on Windows Desktop.

A full list of changes is available here.

Marmalade SDK 8.2 is out now

The latest and greatest version of the Marmalade SDK is now available here.

Highlights

  • IncrediBuild support for ARM architecture
  • Improved video support for Windows Desktop
  • Updated version of ZeroBrane Studio for Quick
  • Multidex support for Android

A full list of changes is available here.

Developing games for mobile and desktop? Then why not go cross platform and try out the Marmalade SDK, its now free. Available in C++ and Lua flavours.

The Jazzlers for Android out on Google Play

Well, I decided to take a step back (literally) in game development, back as far as the 80′s. Remember the old Atari style games? well I wanted to create something like that, so the game is pure and simply about game play. Lets take a look at a quick screenshot:

Jazzler Android Game on Google Play

Jazzler Android Game on Google Play

Now this is how I remember games looking on the old Atari 2600, blocky graphics and vivid colours and I loved them.

Ok, so the basics of the game is that a Jazzle drops down the screen and you simply tap the screen to catch it. Each round the Jazzle moves a little faster and becomes a little shorter. The catching mechanism also becomes a little shorter, although it resets in size every 50 rounds or so. If you fail to catch a Jazzle then its Game Over and you have to start from scratch. 

New backgrounds colours are unlocked as you progress, because well I love all the different colours. Also the Jazzle will taunt you, but as you progress you begin to change the Jazzlers taunts from negative to positive.

In case you’re wondering, I can get to around level 50 so far.

Jazzlers is available for both Android tablets and phones on Google Play.

There are no plans for an iOS version yet, because iOS free games are pretty much dead without a big old marketing budget, maybe after Christmas, who knows.

Marmalade Asset Store Offer

Calling all content developers, the newly opened Marmalade Asset Store have an opening offer. Register as a seller now and earn an 80% revenue until the end of 2015 (usual revenue share is 70%).

From 2D / 3D art assets such as backgrounds, textures, sprites, animations, meshes and high quality sound effects, to project files and templates, plus any great integrations you’ve developed and would like to sell or share: all are welcome in the Asset Store.