Category Archives: Games

Securely run a low memory/low CPU Minecraft server

If you’ve got next to no memory and CPU available to run a Minecraft server, don’t fret. Cuberite is what you’re after. At them moment, Cuberite isn’t bug-free, nor indiscernible from a genuine Minecraft server, but it’s quite usable – and instead of needing 4GB+ of RAM, it needs less than 300MB. And it needs next to no processing power: some people run Cuberite on their Raspberry Pi and have plenty of CPU available.

I would at this point go on about how this is a significant point of difference between C++ and Java, but Java optimizes for something different to C++.  I got into an interesting discussion with Cathy about this after reading a question someone had about what Java was trying to be good at. I used to think that VB was the new COBOL, but clearly Java is the new COBOL; those Java programs are going nowhere, they’re verbose and easy to understand and maintain.

A point to note: The Minecraft protocols are bandwidth heavy, I found if I wanted to run a server at home I’d be able to have one, perhaps two players. Thus is Internet in Australia. Instead I’ve dropped this onto a free AWS VPS instance and bandwidth is no problem.

Still, it’s a random piece of software off the Internet, so we’re going to give it its own user account for our own safety. Let’s install the software:

curl -sSfL https://download.cuberite.org | sh
sudo mv Server /usr/local/cuberite
cd /usr/local/cuberite

Cuberite allows configuration through a web interface.  We now enable webadmin.ini
[User:admin]
; Please restart Cuberite to apply changes made in this file!
Password=yourstrongpassword
[WebAdmin]
Ports=8080
Enabled=1

Port 8080 is the alternative html port (http/https).  You could cd into webadmin and run GenerateSelfSignedHTTPSCertUsingOpenssl.sh and get https serving, but your browser will barf on the certificate. Instead, let’s use a LetsEncrypt certificate, one that we installed earlier. First we make our one-line shell script for running the daemon:

sudo useradd -c "Cuberite server" -f -1 -M -r cuberite
chown -R cuberite:`whoami` /usr/local/cuberite/
sudo nano /etc/init.d/cuberite.sh

#!/bin/sh
### BEGIN INIT INFO
# Provides: cuberite
# Required-Start: $local_fs $network
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: cuberite
# Description: Cuberite server, a Minecraft server lookalike
### END INIT INFO
cd /usr/local/cuberite
sudo -u cuberite /usr/local/cuberite/Cuberite -d &

Next we set it going when the box starts up:

sudo chmod +x /etc/init.d/cuberite.sh
sudo update-rc.d cuberite.sh defaults

Before we can go to the website we need to allow user cuberite to get to the certificates:

sudo groupadd privkey_users
sudo usermod -aG privkey_users cuberite
sudo sudo chmod g+rx /etc/letsencrypt/live/
sudo sudo chmod g+rx /etc/letsencrypt/archive/
sudo chown root:privkey_users /etc/letsencrypt/archive/
sudo chown root:privkey_users /etc/letsencrypt/archive/example.com/
sudo chown root:privkey_users /etc/letsencrypt/archive/example.com/cert1.pem
sudo chown root:privkey_users /etc/letsencrypt/archive/example.com/chain1.pem
sudo chown root:privkey_users /etc/letsencrypt/archive/example.com/privkey1.pem
sudo chown root:privkey_users /etc/letsencrypt/archive/example.com/fullchain1.pem
sudo chown root:privkey_users /etc/letsencrypt/live/
sudo chown root:privkey_users /etc/letsencrypt/live/example.com/
sudo -u cuberite ln -s /etc/letsencrypt/live/example.com/cert.pem /usr/local/cuberite/webadmin/httpscert.crt
sudo -u cuberite ln -s /etc/letsencrypt/live/example.com/privkey.pem /usr/local/cuberite/webadmin/httpskey.pem

Changing these permissions doesn’t affect apache2’s ability to get them.
The reason we’ve used a group here is to allow both Cuberite and any other app (for example, exim) to access the private keys; just add any other user that needs to use the private keys to the privkey_users group.

Remember to punch a firewall hole for port 8080. Fire up Cuberite now:

sudo service cuberite restart

And check if that worked, there should be about one entry:

ps -aux | grep cuberitps -aux | grep cuberit

If not, you can check in the logs directory to see what’s wrong.

So now:

sudo lsof -i :8080
https://example.com:8080/

should be secure.  Note the https is mandatory, as your browser will use http if you fail to specify a protocol.

Where do you wake up from a bed in Minecraft?

After issuing many /time set night commands, I can tell you the waking-location algorithm for Minecraft. This presumably also affects your spawn point.

Two locations are checked, and if they fail to select an acceptable location the pillow-location is used regardless of consequences of picking this location. An acceptable location is on the same level as the bed, and has two transparent-non-solid blocks above it (i.e. you will be standing next to the bed without your head or body embedded in something that’s killing you).

The process is the same for each of the two locations:

Sweep x-1 to x+1:
  Sweep z-1 to z+1:
    if the location is acceptable, we're done

The locations are checked in the order: pillow-part-of-bed, non-pillow-part-of-bed. The effect is:
From the Minecraft wiki:

For a bed to be usable as a spawn point, the player must be able to stand next to the bed at the same level as it. There must be a solid block at the same ‘floor’ level as the bed, with 2 transparent blocks of space (for example, air) for the player to stand in, in one of the ten blocks that surround the bed. It doesn’t matter if the bed itself has blocks above it.

Diablo I (yes, Diablo 1) LAN play on Vista or Windows 7

– and presumably 8.

There’s various convoluted steps to get LAN play working on more recent versions of Windows.

Mount the ISO on your hard drive, and use the somewhat unstable Microsoft supplied ISO mounting program to fool the program into thinking you CD is in a CD drive.  Install Diablo from here.  This step is not strictly necessary, but it’s so much quicker and cleaner than the alternatives.

Fetch and apply the patch to bring Diablo 1.00 up to version 1.09.  It may also be helpful to pull up the properties of the .exe and enable compatibility mode with WinXP Service Pack x. When fetching patch, get it for the version you’re installing – much confusion is caused if you get the spawned Diablo patch and apply it to the full version.

Go and get IPXWrapper, and per the instructions drop the DLL files into your Diablo directory. If you have a heterogeneous environment, all machines need to use this wrapper – IPXWrapper is a translation layer than transforms IPX into UDP, and without it IPX aware OSes like WinXP won’t see the network traffic of the IPX unaware OSes like Vista.  Punch a hole in your Windows Firewall to allow UDP port 54792.

To fix the palette issue, you might want to wrap the exe in a batch script to kill Windows Explorer whilst you’re playing Diablo.  However a better idea is to download the registry patch, which seems to work under Vista as well:

32-bit Windows 7 – http://ftp.blizzard.com/pub/diablo/d109_x86.reg
64-bit Windows 7 – http://ftp.blizzard.com/pub/diablo/d109_x64.reg

See?  Easy.  Doesn’t take more than a few hours if you don’t know what you’re doing.

LEGO nerds: Brickvention 2011 is coming!

If you’ve got nothing planned for Sunday, January 16th head on down to Melbourne town hall to have a look at the largest collection of LEGO models ever seen in Australia. For example, The Love Boat

Entry is $6/adult, $3/child, or $15/family – details at Brickventures

Open 10am-5pm

Doctor Who games

The Good Game reviewers have spoken:

‘a steaming pile of garbage’. The first real Doctor Who game on the DS isn’t just bad; it’s one of the worst misuses of a license I’ve seen.

…and…

Set a few hundred years after the DS game, Return sees the Doctor and Amy investigating some strange signals coming from the vicinity of Jupiter. They come across the strangely deserted SS Lucy Grey. They then have to fight for their lives against shoddy gameplay mechanics and one of the worst cameras I’ve endured in years.

Sounds like they both pale in comparison with the PC games put out earlier in the year. What a shame.

God says: LEGO bad

LEGO bricks can make you gay, because they go together so many ways and encourage experimentation.

You’ll probably be okay if you’ve only got them for “research purposes”.

Donkey Kong on 12 different 80s platforms

Part 1: Atari 2600, Intellivision, Colecovision, NES, Commodore 64, IBM PC (DOS), Apple II

Part 2: Vic 20 (dodgy emulator?), TI-99/4A, Atari 8-bit computers, Amstrad CPC, ZX Spectrum, Atari 7800

With adaptions from an arcade original that had a screen that was higher than it was wide, there’s an obvious compromise to be made between the clarity/resolution of the characters, their aspect ratio, and the number of girders to the top — eg compare the Atarisoft Commodore 64 version with the Ocean one. Some versions look very squashed.

Most surprisingly good I reckon was the TI version.

Via Retroist

Google Pac-man!

To celebrate Pacman’s 30th anniversary, Google’s banner today is not only Pac-man-based, it’s a playable game if you wait for a few seconds.

Google Pacman

And yes, if you clear the first two boards, you get the traditional cut-scene.

Google Pacman

Google Pacman

Is that totally awesome or what?

Am I correct in thinking it’s not actually written in Flash, but in some clever HTML-type thingy?

Update: Yes. CNet reports: ccording to Germick, the company worked with Pac-Man’s publisher, Namco Bandai, to make the project as realistic as possible. Yet the Google team, with the inspirational lead of Marcin Wichary, a Google senior user experience designer, built their version of the game from the ground up using JavaScript, HTML, and CSS.

Update 4pm: If you click Insert Coin twice, you get a two-player game (W/A/S/Z controls Ms Pac-Man). And there is one minor bug I’ve noticed — sometimes when chasing ghosts after eating a power pill, you can pass right through them.

Update 9:30pm: Google Pac-Man: The FAQ + Kill Screen Winners — contains more details on how it was written, where to find it when it’s gone from the main Google page, and a picture of the”kill” screen.

Update Monday: It’s gone from Google’s home page now, but is still online here: www.google.com/pacman

Elite turns 25 years old

BBC: Classic video game Elite turns 25

Elite co-developer David Braben takes the BBC’s Daniel Emery on a flight in the BBC Micro computer game.

The space fantasy involved trading in slaves, narcotics and minerals as you flew around a fictional universe.

Pirate and police ships threatened to disrupt your journey or kill you.

I never got to the rank of Elite, but I did make it to Deadly.

Pac-Man Championship Edition for mobile

Turns out I don’t need an XBox to play the new(ish) Pac-Man Championship Edition; it’s also available on mobiles.

I’ve had a go of it… great graphics, and the gameplay is a really clever twist on olde Pacman. Very cool. Though oddly the sound doesn’t seem to work…

The problem is the controls. You can either use the phone’s numeric keypad (2/4/6/8 for up/left/right/down… pretty logical)… or the directional buttons. But on my Nokia N95 phone, it’s hard to find the right numerics to direct Pacman, and if you use the directional buttons you’re at constant risk of pressing one of the surrounding buttons, some of which will unceremoniously throw you out of the game.

I expect I’ll get used to it.