Skip to content
PigsInSpace raspberry pi demo app.
Java Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Hi all!

As promised, I've made the source of the PigsInSpace demo available at GitHub.

For those who were not at JFall 2013 or don't read Java Magazine (why not?!), I gave a presentation called 'Designing distributed programs on a Raspberry Pi cluster'. The demo app I used, called Pigs in Space, shows a huge map with spaceships flying around. The goal is to have as large a map and as many spaceships as possible, while doing collision detection.

The code is available at

To build it, you'll need to add some stuff to your build path in your favorite IDE:

  • the src folder
  • the resources folder
  • the hazelcast-2.6.3.jar, hazelcast-client-2.6.3.jar, lwjgl_util.jar, lwjgl.jar, slf4j-api-1.7.5.jar, slf4j-simple-1.7.5.jar jars found in libs

(It also contains some preparations for hazelcast 3.0 but that still had some rough edges.)

The application consists of three runnable parts:

  • server
  • gui
  • control

The servers are the main thing: they do all the work and are meant to run at different, well, servers. The gui displays the map and the control allows you to sent instructions to all connected servers, e.g. changing strategies or adding more ships. All applications can either run in multicast mode or on localhost. To run a server, you can e.g. do something like this:

java -jar PigsInSpace server -multicast

For the control, something similar:

java -jar PigsInSpace control -multicast

For the gui, you'll need to specify a platform library for LWJGL:

java -Djava.library.path=lib/native/macosx -jar PigsInSpace control -multicast

Have fun!

You can’t perform that action at this time.