-
1Adding Games
TLDR: To add games to the HES use the following steps. 1. To connect to the HES:
ssh herman@192.168.1.952. To create the game file, then paste and save code:nano /home/herman/games/oregon_trail.py3. To make the game executable:chmod +x /home/herman/games/oregon_trail.py4. To restart the system and load new games:sudo reboot* To remove broken games:rm /home/herman/games/oregon_trail.pyOnce you have the python code you would like to use you will need to SSH into the HES to add the game. This essentially makes it so you are running the command line on the device, the HES in this case, and not the computer you are operating. This allows you to run code, install apps, and run all sorts of function on the HES (raspi). We will use this Oregon trail game as an example. You start by connecting to the HES, you will need to look at your wifi backend to determine the ip address, for example ours is at 192.168.1.95 and was listed on the router as “raspberrypi”. Once you have this you can open a terminal or command line and type (but use your address):
ssh herman@192.168.1.95
You will be prompted for the password you created when you first setup the HES. Next we need to create the game file.
nano /home/herman/games/oregon_trail.py
This will create the file and open a text editor where we will paste our game code. Please note, there is a conflict with something in the naming conventions and the way the code runs, it is highly recommended to include an underscore in the game name to prevent these conflicts, so “oregon_trail.py” instead of “oregontrail.py” or “tetris_game.py” instead of “tetris.py”.
For the game code see the "Files" section of this project to copy the game code.
Now to save this do “Control x”, then “y”, then “enter” to save. There should be instructions for this at the bottom of the window. Now you should be back at the command prompt and we need to modify our file to tell the system it is executable (that it is a program to run) so enter:
chmod +x /home/herman/games/oregon_trail.py
Then to restart your system and load the new game:
sudo reboot
Now you should be all set, it is pretty straightforward, on reboot the device will disconnect from the network so you will lose your connection. Once rebooted the new game should be in your list and ready to play, just try not to die of dysentery.
**A final note on broken games.
If your game is broken, does not load, or gives an error just provide this information to your AI (if that is what you’re using to code) and it will give you new code to try. We have found it easiest to simply remove the original file and then start over. To do that you would use the following code to remove the file, and then just start from the file creation step above (nano…) to recreate it with the new code.
rm /home/herman/games/oregon_trail.py
JohnsonFarms.us
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.