Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
69 changes: 69 additions & 0 deletions src/content/docs/Splashkit/Applications/ApplicationsEpic-T12022.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SplashKit (Applications)

## Background/Context

SplashKit is widely used to create 2D games. It is proposed to extend this for games to be set up
and added to a physical arcade machine where they can be played and showcased.

## Business value

Games are an attraction to different age groups, this functionality of providing games and an
article including content to help create similar games would be helpful for interested individuals.

## What needs to happen

Creating a method to upload games and store them locally on a system, have them be selected and
played at the user’s leisure. Validation checks on all uploaded games before being playable
(manually, at least initially) for malice/inappropriate content. Create a cool game demonstrating
all functionality of SplashKit. A step-by-step article guide of How to create a Cool game. Guide
should be uploaded to the SplashKit.io website. Document design decisions, process and
how-to-guides.

## In-Scope

The first game of Arcade machine. Article guide.

## Out-Scope

Building the hardware (presently; may be in scope for future trimesters)

## Assumptions/Dependencies

First game needs to be ready, in order to add it to the arcade/showcase. Raspberry Pi will merge
with preconfigured controls without too much complication

## UI/UX considerations

- Arcade layout
- Arcade gallery/selection menu UI needs to fit the SplashKit design (palette, consistent with
existing SplashKit style (matches website style, etc)
- UI should be user friendly

## Analytics considerations

Comparison of different game functionality and time management, upload/download statistics?

## Regulation & Compliance considerations

- Secure channels, hardware safety, adequate encryptions and system protection.
- User and publisher consent

## Operation/Training/Support considerations

Team members will need to become familiar with SplashKit, C++, potentially Clang (compiler). Advise
teams 2 weeks in advance of planned release

## What are the challenges?

- Existing skill gaps (team members needing to learn new languages).
- Creating the physical arcade while remote (for later stages – can't currently implement physical
arcade aspect)
- Creating a game without knowing physical requirements

## Acceptance criteria

- Successful execution of building arcade (a user should be able to select and play a game to
completion on a physical arcade machine)
- Functional game (written using SplashKit)
- Step by step guide on how to create game
- Channel exists for users to upload/download validated games
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
# Adding Games to Arcade Machine

> many of these steps are eser to perform via the GUI all commands below are for CLI but can start
> the GUI by typing `startx` in the terminal

## C++ Programs

> If you have a complied arm program skip to step 7

1. Open Terminal
2. Change to the Games Source Folder in the home directory
```
cd GameSource
```
3. Create a new folder for your Game and change into the folder (Optional)
```
mkdir mygame
cd mygame
```
4. Git Clone your code into the directory
```
git clone https://github.com/Thoth-Tech/MyGame.git
```
5. Compile your game
```
skm g++ program.cpp -o MyGame
```
6. Test Your game is running correctly (optional)
```
./MyGame
```
7. Copy your Complied game to the Games directory\
```
cp -r ~/GamesSource/MyGame ~/Games
```
8. Create a Launch Script for your game
```
nano ~Games/LaunchScript/MyGame.sh
```
- Add the following
```
#!/bin/bash
~/Games/MyGame/MyGame
```
- > Note: Some C++ programs may not run correctly when executed from a remote directory in which
> case make the script chagne to the program directory first
```
#!/bin/bash
cd ~/Games/MyGame/
./MyGame
```

- save by pressing `ctrl-o` and exit by pressing `ctrl-x`

9. Make the script executable

```
sudo chmod +x MyGame.sh
```

10. Add the game to the emulation station game list.

```
nano ~/.emulationstation/gamelist/pc/gamelist.xml
```

11. Create new entire for your game.

```
<game>
<path>./MyGame.sh</path>
<name>My Game</name>
<image>~/Games/MyGame/TitleImage.png</image>
</game>
```

## C# Programs

1. Open Terminal
2. Change to the Games Source Folder in the home directory

```
cd GameSource
```

3. Create a new folder for your Game and change into the folder (Optional)

```
mkdir mygame
cd mygame
```

4. Git Clone your code into the directory

```
git clone https://github.com/Thoth-Tech/MyGame.git
```

5. Compile your game (--sc complies it as standard alone)

- you may need to change into a sub directory first

> Compiling as a standalone program is presently required for C# games as dotnet and splashkit
> paths are not loaded on CLI boot, paths are presently loaded by bashrc which only run on
> interactive login shells. i.e. when you login to the desktop.

```
skm dotnet publish --sc
```

6. Copy libsplashkit.dll and libsplashkit.so to your published project directory

```
cp ~/.splaskkit/lib/linux/libsplashkit.dll ~/GamesSource/MyGame/bin/Debug/netcoreapp7.0/publish
cp ~/.splaskkit/lib/linux/libsplashkit.so ~/GamesSource/MyGame/bin/Debug/netcoreapp7.0/publish
```

7. Test Your game is running correctly (optional)

- change into the publish directory
- If you are using a Resources folder copy that into the Publish directory
`cp -r ~/GamesSource/MyGame/Resources ~/GamesSource/MyGame/bin/Debug/netcoreapp7.0/publish`

```
./MyGame
```

8. Copy your Complied game to the Games directory

```
cp -r ~/GamesSource/MyGame/bin/Debug/netcoreapp7.0/publish/ ~/Games/MyGame
```

9. Create a Launch Script for your game

```
nano ~Games/LaunchScript/MyGame.sh
```

- Add the following

```
#!/bin/bash
~/Games/MyGame/MyGame
```

- save by pressing `ctrl-o` and exit by pressing `ctrl-x`

10. Make the script executable

```
sudo chmod +x MyGame.sh
```

11. Add the game to the emulation station game list.

```
nano ~/.emulationstation/gamelist/pc/gamelist.xml
```

12. Create new entire for your game.

```
<game>
<path>./MyGame.sh</path>
<name>My Game</name>
<image>~/Games/MyGame/TitleImage.png</image>
</game>
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
## Intorduction

This document will outline how to create a compressed disk image of the Rasberry Pi that can then be
burnt to new SD cards using the [Raspberry Pi imager](https://www.raspberrypi.com/software/) or a
program like [etcher](https://etcher.balena.io/). Using this process, you can make new Gold Images
and backups of the running software for the Arcade Machines. This process uses a script called
PiShirnk https://github.com/Drewsif/PiShrink

The process was derived from this article:
https://www.tomshardware.com/how-to/back-up-raspberry-pi-as-disk-image

### Current Compressed Gold Image

https://deakin365.sharepoint.com/:u:/r/sites/ThothTech2/Shared%20Documents/SplashKit/Arcade%20Machine%20Image/ArcadeImage-19.08.2023.img.gz?csf=1&web=1&e=SdRhVX

The current Compressed Gold Image is on the Thoth Tech Teams SharePoint Site. This is persistent but
only accessible to Thoth Tech team members.

## Requirements

- USB Key larger capacity than current SD Card in Pi
- Raspberry Pi with Arcade image

Note it is possible to change the partition sizes on the Pi to use a smaller USB key, but I have not
tested that process, and it is beyond the scope of this document. If you need that process, please
refer to the Toms Hardware article above, and if successful, please update this document with the
additional optional process.

## Create Disk Image

1. Format USB key
- Format the USB Key as either NTFS (if using Windows) or EXT4 (if using Linux); I'm not sure
what is best for Mac OS. (This Wiki How Article explains how to format a key on Windows
https://www.wikihow.com/Format-a-Flash-Drive)
1. Connect the USB key to the Pi

![Image of Pi with a USB key](Images/PI_USB.jpg)

1. On the Pi, open a terminal and run the following to install pishrink.sh and move it to
/usr/local/bin
```
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
sudo chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin
```
1. Check the mount point of the USB Key with this command

```
lsblk
```

![Screen shot of the output of the lsblk command](Images/Command_lsblk.png)

You should be able to see the mount point for the USB ours has been mounted at
`/media/deakin/Spare` (Spare is the volume name set during formatting)

1. Copy the current SD card to the USB as an image file, i.e. my command was
`sudo dd if=/dev/mmcblk0 of=/media/deakin/Spare/ArcadeImage-19.08.2023.img bs=1M` Set the
filename as you see fit but if updating the gold image suggest using a date or version number.
```
sudo dd if=/dev/mmcblk0 of=[mount point]/myimg.img bs=1M
```
1. Move to the USB root directory, i.e. my command `cd /media/deakin/Spare`
```
cd cd /media/pi/[volume]
```
1. Run pishrink with -z option; this will zip the image with gzip.
```
sudo pishrink.sh -z ArcadeImage-19.08.2023.img
```

You should now have a compressed image file, i.e. `ArcadeImage-19.08.2023.img.gz` refer to
[Setup Arcade Machine.md](Setup%20Arcade%20Machine.md) for instructions on burning the image to a
new SD card or USB.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- This is the EmulationStation Systems configuration file.
All systems must be contained within the <systemList> tag.-->

<systemList>
<!-- Here's an example system to get you started. -->
<system>

<!-- A short name, used internally. Traditionally lower-case. -->
<name>pc</name>

<!-- A "pretty" name, displayed in menus and such. -->
<fullname>PC</fullname>

<!-- The path to start searching for ROMs in. '~' will be expanded to $HOME on Linux or %HOMEPATH% on Windows. -->
<path>/home/deakin/Games/LaunchScripts</path>

<!-- A list of extensions to search for, delimited by any of the whitespace characters (", \r\n\t").
You MUST include the period at the start of the extension! It's also case sensitive. -->
<extension>.exe .sh</extension>

<!-- The shell command executed when a game is selected. A few special tags are replaced if found in a command:
%ROM% is replaced by a bash-special-character-escaped absolute path to the ROM.
%BASENAME% is replaced by the "base" name of the ROM. For example, "/foo/bar.rom" would have a basename of "bar". Useful for MAME.
%ROM_RAW% is the raw, unescaped path to the ROM. -->
<command>%ROM%</command>

<!-- The platform to use when scraping. You can see the full list of accepted platforms in src/PlatformIds.cpp.
It's case sensitive, but everything is lowercase. This tag is optional.
You can use multiple platforms too, delimited with any of the whitespace characters (", \r\n\t"), eg: "genesis, megadrive" -->
<platform>PC</platform>

<!-- The theme to load from the current theme set. See THEMES.md for more information.
This tag is optional. If not set, it will default to the value of <name>. -->
<theme>N64</theme>
</system>
</systemList>
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading