https://github.com/m5lk3n/picventure
An RPG text adventure written in Go for educational purposes. It features colors (on the terminal) and game pictures (on a Sense HAT).
https://github.com/m5lk3n/picventure
astro-pi go golang raspberry-pi raspberrypi rpg rpg-game sense-hat
Last synced: 4 months ago
JSON representation
An RPG text adventure written in Go for educational purposes. It features colors (on the terminal) and game pictures (on a Sense HAT).
- Host: GitHub
- URL: https://github.com/m5lk3n/picventure
- Owner: m5lk3n
- License: other
- Created: 2021-01-02T18:42:01.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-12-05T16:43:03.000Z (7 months ago)
- Last Synced: 2025-12-09T03:48:59.857Z (7 months ago)
- Topics: astro-pi, go, golang, raspberry-pi, raspberrypi, rpg, rpg-game, sense-hat
- Language: Go
- Homepage:
- Size: 3.05 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Picventure
The RPG text adventure project from under [raspberrypi.org](https://projects.raspberrypi.org/en/projects/rpg) implemented in Go for educational purposes. It features colors (on the terminal) and game pictures (on a Sense HAT). The latter is locally exposed as a "web service" (called "picservice") and loosely coupled to the game implementation. The idea is to also demo microservices to kids.
## Design

## Environments
Developed on a [Raspberry Pi 400](https://www.raspberrypi.org/products/raspberry-pi-400/):
```bash
$ uname -a
Linux raspi400 5.8.0-1010-raspi #13-Ubuntu SMP PREEMPT Wed Dec 9 17:14:07 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
$ go version
go version go1.14.7 linux/arm64
```
Also tested on a Lenovo ThinkPad X250:
```bash
$ uname -a
Linux x250 4.15.0-135-generic #139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ go version
go version go1.16 linux/amd64
```
## Make
```bash
$ make
usage: make
where is one of the following
all to run all on both, picservice and rpg
help to show this text
```
```bash
$ make all
# ...
```
## Play
### Start picservice
Open a shell in this directory, then:
```bash
$ cd picservice && GIN_MODE=release ./picservice
INFO[0000] picservice start...
```
### Start picventure
Open a separate shell in this directory, then:
```bash
$ cd rpg && ./picventure
Picventure - A colorful RPG adventure (with optional pictures)
==============================================================
Get to the Garden with a key and a potion
Avoid the monsters!
Commands:
go "direction" (where "direction" is one of the following: north, east, south, west)
get "item"
exit
---------------------------
You are in the Hall
You see a key
Inventory:
---------------------------
>
```
## Demo
**Spoiler alert!**

When you encounter an item or finish the game, the corresponding picture appears on the Sense HAT:

([from Trinket and the Raspberry Pi Foundation](https://trinket.io/sense-hat))
## Sources
- [Python source](https://rpf.io/rpg-code)
- [Game map](https://projects-static.raspberrypi.org/projects/rpg/31fb9012c6d897ad16f2f245fb4791b6384cda28/en/images/rpg-final-map.png)
## To do/Open
- add tests
- map (cheatsheet)
- introduce [enums](https://www.ribice.ba/golang-enums/)
- introduce constants
- improve `inventory.Contains` check
- `input = strings.TrimRight`?
## Ideas
- save/load game
- 3 dimensions: up/down via stairs
- find/get a random item (like an in-app purchase)
- add-on: visualization of position