Raspberry Pi Two player Robot game

Royal Treasure Island

Install Instructions

Royal Treasure Island

Royal Treasure Island Thingiverse Thingiverse 3d printable parts for Royal Treasure Island two player game

Royal Treasure Island is run with Java and sends PWM control signals to Raspberry PI pins. Currently tested versions Raspberry PI 3 B+ model. Raspbian 4.9 Please test with your Raspberry device and send feedback to gigabrain@tuta.io

How to setup the two player game ?

                  3D Print yourself the parts. Follow the printing instructions 
                  You will also need:
                  - Raspberry Pi
                  - Two of 9g micro servos
                  - 3mm / 4mm / 5mm Neodyum magnet balls if you want extra weight for the cannon balls
                  - 3d Printer and PLA material
			 	  
Build a robot game with your Raspberry Pi and play with your Mobile phone, 
battling with two players using your favorite slingshot ammo 
to shoot off enemy pirate boat before it gets built. 

The game works with a Raspberry Pi and a Mobile phone, Pad or any touch screen.

Each player build their board that carry either a treasure or a stigmata 
and tries to get the boat ready on time before the turns end.
The player gets to shoot the opponent's ship and sink it.

Play instructions:

- Each player takes a turn and either builds a part of the ship according to the card that he draws
- If a player gets a target card, player draws the sling and releases it, trying to hit the opponents ship
- End of each throw count amount of resources that have fallen to ground on opponents field and add to your points
- When the player draws a chest card, the treasure is hidden inside the chest
- When the player gets the full ship ready, place the chest on top of the ship

Game ends when either one get his ship built or the turns end.

Build cards:


Resource cards and points:

Corn, Barrel 1p

Leaf, Flour 2p

Gold crate 3p

Action card, shoot opponent ship:


Treasure card:

Diamond 5p, Skull Stigmata 4p

Target card:


Assembly: Print all parts, connect the spiral sling with a 9g micro servo, 
add additional screw to hold the servo better. 
Slide the servo inside the servo holder with the wire upwards. 
Adjust the servo when the servo is in middle position the sling cup is balanced horizontally.

Add 3mm / 4mm / 5mm Neodymium magnet balls if you want extra weight for the cannon balls.
                  

How to install manually ?

Manually install - Download newest version 
Access GigaBrain
Install the PiBlaster from https://github.com/sarfata/pi-blaster
Setup two Micro Servos: Control YELLOW/WHITE to Raspberry Pi Pins: 
Physical GPIO#11 (BCM17 / GPIO17)
and Physical GPIO #12 (BCM18 / GPIO18)
And the servos + RED wire to +5 and - BLACK wire to Ground


You can see different board references here 
You may use different boards as long as you can setup the pins according to PiBlaster configuration

If you are running with Pi Blaster make sure that you do not use any GPIO pins for input devices.
The reserved GPIO pins for output are 4,17,18,27,21,22,23,24,25

How to run the game with PiBlaster ?

The configuration parameters for PiBlaster pins:
CONTROLLING_ENABLE_PIBLASTER = Boolean (true or false) Turn on Raspberry Pi PiBlaster configuration
CONTROLLING_PIBLASTER_OUTPUT_TAGS = String separated with , List the hashtags that are mapped to pins in the same order as PINS
CONTROLLING_PIBLASTER_OUTPUT_PINS = String separated with , List the pin numbers that are mapped to output GPIO ports in the same order as TAGS
CONTROLLING_USERNAME = String User username
CONTROLLING_PASSWORD = String User BCrypted password 
CONTROLLING_STOPTIME = After the movement cycle how long to wait before the movement stop signal is sent, default 3000 ms 
CONTROLLING_DELAYTIME = How much delay there is between single movements, default 10 ms
CONTROLLING_SHUTDOWNTIME = How long the controller is on from the last control movement, default 300000ms 5min

Run command:
java -jar ~/gigabrain/blocks/blocks-0.3.0-RELEASE.jar --CONTROLLING_ENABLE_PIBLASTER=true --CONTROLLING_PIBLASTER_OUTPUT_TAGS=p1,p2 --CONTROLLING_PIBLASTER_OUTPUT_PINS=17,18 --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$10$AkKVjmFjr.eTCxiUK5XGr.iD/lFSfs64gU7LhcNz2NbOVAKh0Zp6i' > /home/pi/gigabrain/blocks/logs/treasure.log 2>&1 &

How to run the game with PCA9685 board ?

Connect the PCA9685 board to Raspberry Pi with these instructions. Note that you are required to have an additional power source for the servos. With the configuration you can change the PCA9685 pin numbers, in the run command below there is pin 0 for player 1 and pin 1 for player 2.

Adafruit Raspberry Pi PCA9685 instructions

Enable the I2C to connect with the PCA9685 board

Enable I2C on Raspberry Pi
The configuration parameters for PCA9685 pins:
CONTROLLING_ENABLE_PCA9685 = Boolean (true or false) Turn on Raspberry Pi PCA9685 I2C port configuration
CONTROLLING_PCA9685_OUTPUT_TAGS = String separated with , List the hashtags that are mapped to pins in the same order as PINS
CONTROLLING_PCA9685_OUTPUT_PINS = String separated with , List the pin numbers that are mapped to PCA9685 pins (0-15) in the same order as TAGS. The default I2C bus is 1 and address is 40.
CONTROLLING_USERNAME = String User username
CONTROLLING_PASSWORD = String User BCrypted password 
CONTROLLING_STOPTIME = After the movement cycle how long to wait before the movement stop signal is sent, default 3000 ms 
CONTROLLING_DELAYTIME = How much delay there is between single movements, default 10 ms
CONTROLLING_SHUTDOWNTIME = How long the controller is on from the last control movement, default 300000ms 5min

Run command:
java -jar ~/gigabrain/blocks/blocks-0.3.0-RELEASE.jar --CONTROLLING_ENABLE_PCA9685=true --CONTROLLING_PCA9685_OUTPUT_TAGS=p1,p2 --CONTROLLING_PCA9685_OUTPUT_PINS=0,1 --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$10$AkKVjmFjr.eTCxiUK5XGr.iD/lFSfs64gU7LhcNz2NbOVAKh0Zp6i' > /home/pi/gigabrain/blocks/logs/treasure.log 2>&1 &

How to Generate a BCrypt password hash ?

Create a BCrypted password manually
	in Command line see reference BCrypt Hash from command line
	in browser JavaScript Browserling Javascript BCrypt tool
	Notice that Browserling uses a local JavaScript BCrypt script
	BCrypt JavaScript library
and add a {bcrypt} in front of the property eg. --CONTROLLING_USERNAME=john --CONTROLLING_PASSWORD='{bcrypt}$2a$04$dl...' In the above run command example username is john and password is "hello"

How the application security is implemented ?

The security is implemented using standard Spring Security libraries to ensure the security and stability of the application.

How to install with a script ?

Access GigaBrain

How to use GigaBrain ?

Make sure that you have Raspbian 4.9 installed on your SD card Install the newest Raspbian official installation

Share the Wifi hotspot with iPhone or iPad, Android phone or tablet, PC with a touch screen and after that connect your Raspberry Pi to the same Wifi with your mobile phone

You can also connect your touch screen and Raspberry Pi with the same Wifi hotspot device, as long as the devices see each others IP addresses.

One option also is to create a Wifi hotspot with your Raspberry Pi and connect your mobile device to that Wifi. This is an advanced option

Find the IP address of your Raspberry Pi with Command line command: host raspberrypi

Install GigaBrain to your Raspberry Pi and setup the device. If you are running with Pi Blaster make sure that you do not use any GPIO pins for input devices. The reserved GPIO pins for output are 4,17,18,27,21,22,23,24,25

Open up the browser from your mobile phone and type the address for example: http://192.0.1.23:5800 Make sure that the port number :5800 is added after the IP address of your Raspberry Pi

Log in with the same username and password that you installed GigaBrain with and start your show!