# HOW TO Ludobox
**Create your own [Ludobox](http://ludobox.net) on a Raspberry Pi**

### What we will do
1. Setup a Raspberry Pi with WIFI
2. Install the Ludobox software
3. Start your Ludobox
4. Download Games
5. Make a custom Case
# 1. Prepare the Raspberry Pi
### What you need
- 1 Raspberry Pi
- 1 Internet connection
- 1 SD Card
- 1 Linux computer with Internet and a SD card reader
### Install the OS
Download the [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) Linux image
Copy the image to a SD card using the `dd` command
sudo dd bs=4M if=2017-01-11-raspbian-jessie-lite.img of=/dev/mmcblk0
sync
[Enable SSH](https://www.raspberrypi.org/documentation/remote-access/ssh/) on your Raspberry Pi (add an `ssh` file to the `/boot` disk )
sudo touch /media/MY_CARD_ID/boot/ssh
`MY_CARD_ID` should be replaced by the partition ID of your card.
### Configure a Wifi network
> Read also the [WIFI instructions](https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md) from Raspberry Pi's official documentation
You need to edit a WIFI config file called `wpa_supplicant.conf` to add the password and name of your WIFI network.
sudo nano /media/MY_CARD_ID/etc/wpa_supplicant/wpa_supplicant.conf
**hint**: `MY_CARD_ID` should be replaced by the ID generated by the system when you mounted the SD card.
Add your WIFI network info to `wpa_supplicant.conf`
network={
ssid="My WIFI"
psk="mypassword"
key_mgmt=WPA-PSK
}
Test your wifi connection
ping ludobox.net
**hint** You can setup multiple networks - see [this thread](https://raspberrypi.stackexchange.com/questions/11631/how-to-setup-multiple-wifi-networks)
OK we got the WIFI now :+1:
### Connect to your Pi
There is two main ways to connect and input commands into a machine like Raspberry Pi :
- using screen and keyboard
- using your own machine via SSH connection
#### SSH Connection
> Read also the [SSH instructions](https://www.raspberrypi.org/documentation/remote-access/ssh/) from Raspberry Pi's official documentation
Find the Raspberry Pi's local IP on your router (sth like `192.169.1.XX`)
Connect to your pi
ssh root@192.169.1.XX # your IP
The default password is `raspberry`
### Update the system
Update everything
sudo apt-get update && sudo apt-get upgrade
Install [Python](https://en.wikipedia.org/wiki/Python_(programming_language)), [git](https://en.wikipedia.org/wiki/Git) and some softwares used to build dependencies
sudo apt-get install build-essential git python-pip python-dev
Configure your pi properly
> Read also the [raspi-config instructions](https://www.raspberrypi.org/documentation/configuration/raspi-config.md) from Raspberry Pi's official documentation
raspi-config
**Hint** You can expand the size of your filesystem to occupt the whole space of your card.
Fix language issue
export LANGUAGE=en_GB.UTF-8
export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
locale-gen en_GB.UTF-8
dpkg-reconfigure locales
Congrats ! Your Pi is now ready :sunglasses:
# 2. Install the software
### What you need
- 1 Raspberry Pi with Raspbian and WIFI connected
- 1 Internet connection
### Setup your environment
Install Python `virtualenv` ([why?](http://python-guide-pt-br.readthedocs.io/en/latest/dev/virtualenvs/))
sudo apt-get install python-virtualenv
Create a folder where you will install everything
mkdir MY_LOVELY_LUDOBOX_FOLDER
**hint** replace `MY_LOVELY_LUDOBOX_FOLDER` by your own folder name
Enter the new folder
cd MY_LOVELY_LUDOBOX_FOLDER
Create your virtual environment (called `venv`)
virtualenv venv
### Get the code and install the software
Activate your virtual environment
source ./venv/bin/activate
Download the code using git
git clone https://github.com/ludobox/ludobox
Install the software
cd ludobox
./bin/install
Yay ! You have now installed your Ludobox properly :tada:
# 3. Start your Ludobox
### What you need
- 1 Raspberry Pi with Ludobox installed
Just go into the folder where you did the install.
cd MY_LOVELY_LUDOBOX_FOLDER
Activate your virtual environment
source ./venv/bin/activate
Go into the code folder
cd ludobox
Start your box
ludobox start
You can access your box by using the local IP address displayed on the screen.

**WARNING! You have to be connected to the same WIFI network as the box to be able to access it via this IP address.**

Enjoy ! :joy:
# 4. Download Games
### What you need
- 1 running Ludobox
- 1 Internet connection
Click on the *Download* button in the Navbar. You can now see a list of all games available in the *Ludobox* database on [box.ludobox.net](http://box.ludobox.net).

To download the game you like into your own box, just click on the *Download* link.

Once the game has been downloaded to your box, it will be shown in yellow.
You can now start making your own copy or fork :tropical_drink: :scissors:
# 4. Make a custom Case
### What you need
- 1 Laser Cutter
- Scissors, paper, painting, etc
Download the [blueprints]() to laser cut the box.
Customize as you wish ! :art: