Skip to content

Asvoria/trust_Kiosk_Rpi_loop

 
 

Repository files navigation

The Evolution of Trust

This is a modification to put the game into Raspberry Pi Kiosk mode.
The whole game is running offline in loop.
The purpose of this project is to have an interactive device to let people play this game on a touch screen. Probably while they hang around in a mall or happen to see the device installation. The demo is done with smaller touch screen, but it can be working on larger touch screen as well.
22/02/2021 by Asvoria Kuan
Demo: https://asvoria.github.io/trust_Kiosk_Rpi_loop/

The Original

This game is designed by Nicky Case: https://ncase.me/
Please send love, praises and support to the original author! For the original repository:
https://github.com/ncase/trust

Modifications for the Kiosk version:

  1. Because the link to the author credits was removed, it is replace with a QR code (generated from https://www.qr-code-generator.com/) to enable people gain access to the author, and link materials.
  2. Footnote section is a QR code to the link of the original footnote. I can't expect people to stand in front of the screen to read all of it.

Original Version: http://ncase.me/trust/

The Evolution of Trust is dedicated to the public domain, and is made thanks to the many Creative Commons & open source resources out there! Here is a full list of music, sounds, and code used:

Music: "Bleu" by Komiku (CC Zero). Download their full album on Free Music Archive

Sound Effects:

Open Source Libraries:

Font: Futura Handwritten by Bill Snyder

Translation Available!

[IMPORTANT: BEFORE YOU DECIDE TO MAKE A TRANSLATION, CHECK THE "ISSUES" TAB ABOVE, TO SEE IF SOMEONE ELSE IS ALREADY WORKING ON IT. If so, maybe you can collaborate! And if no one else is, PLEASE CREATE A NEW ISSUE in this repo so that others know you're working on it!]

Translations done so far: Japanese, Chinese (Simplified), Chinese (Taiwan), Brazilian Portuguese, French, Spain Spanish, Latin American Spanish, Russian, German, Italian, Turkish, Polish, Vietnamese, Greek, Persian/Farsi, Hungarian, Catalan, Arabic, Bulgarian, Korean, Romanian, Ukrainian, Croatian, Swedish, Estonian, Czech, Latvian, Dutch, Finnish, Danish, Bahasa Indonesia Albanian, Macedonian, Slovenian, Armenian, Filipino (Tagalog)

Raspberry Pi Setup Instructions For Windows

  1. Download Raspbian lite: https://www.raspberrypi.org/software/operating-systems/
  2. Format SD card using SD Card Formatter: https://www.sdcard.org/downloads/formatter/
  3. Download Balena Etcher: https://www.balena.io/etcher/
  4. Etche the Raspbian lite image to SD card.
  5. Un-plug and plug the SD card, in the card, create file "ssh" with a single space.
  6. Create a file in the root of boot called: wpa_supplicant.conf (instructions below). Then paste the following into it (adjusting for your ISO 3166 alpha-2 country code, network name and network password):
country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="NETWORK-NAME"
    psk="NETWORK-PASSWORD"
    key_mgmt=WPA-PSK
}
  1. Intall putty: https://www.putty.org
  2. Use putty to ssh into Rpi: find the Ip address when power on Rpi
  3. Update: sudo apt-get update
  4. Configure startup settings:
sudo raspi-config
  1. System Options>boot>Console Autologin
  2. Install minimum GUI components
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
  1. Install Chromium Web browser
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
  1. Edit Openbox config: When Openbox launches at startup it will run two scripts in the /etc/xdg/openbox folder. The first, environment will setup any environment variables, etc. The second, autostart will setup and launch whatever app you specify.

  2. Edit the autostart file and then how to add environment variables to support it.

sudo nano /etc/xdg/openbox/autostart
xset -dpms       # turn off display power management system
xset s noblank   # turn off screen blanking
xset s off       # turn off screen saver

# Remove exit errors from the config files that could trigger a warning
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences

# Start local server
/usr/local/bin/http-server /home/pi/trust_Kiosk_Rpi_loop &

# Run Chromium in kiosk mode
chromium-browser  --noerrdialogs --disable-infobars --kiosk $KIOSK_URL

--check-for-update-interval=31536000
  1. Download the game from github
sudo apt-get install git
sudo git clone https://github.com/Asvoria/trust_Kiosk_Rpi_loop
  1. Install npm and http-server:
sudo apt-get install npm
sudo npm install npm@latest -g
sudo npm install -g http-server
  1. Setup the environment
sudo nano /etc/xdg/openbox/environment
export KIOSK_URL=http://localhost:8080/
  1. Start the X server on boot
touch ~/.bash_profile
sudo nano ~/.bash_profile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
  1. Run the following line and then reboot:
source ~/.bash_profile
npm install npm@latest -g
sudo reboot

Vertical Screen Setup

  1. Modify the config file:
sudo nano /boot/config.txt
  1. Add line: display_rotate=1 for 90 degree rotation
  2. Install the following library:
sudo apt-get install xserver-xorg-input-libinput
sudo mkdir /etc/X11/xorg.conf.d
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
  1. Add the following lines after as follows:
Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection
  1. Save, exit and reboot.

Offline code edit

Since the device is not connected to internet, all links that is directed to outside may not work. Therefore, the fork of this repository had the links deactivated.

There are only 2 version available at my repository: English and Chinese (Simplified)

"LICENSE"

Creative Commons Zero: it's a public domain dedication, so basically, do whatever you want! Attribution is super appreciated, but I'm not gonna send legal goons after you or anything.

About

An interactive guide to the game theory of cooperation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.0%
  • HTML 18.6%
  • CSS 5.4%