Skip to content

An RPG text adventure written in Go for educational purposes. It features colors (on the terminal) and game pictures (on a Sense HAT).

License

Notifications You must be signed in to change notification settings

m5lk3n/picventure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Picventure

The RPG text adventure project from under raspberrypi.org 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

Design

Environments

Developed on a Raspberry Pi 400:

$ 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:

$ 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

$ make
usage: make <target>

  where <target> is one of the following

    all         to run all on both, picservice and rpg

    help        to show this text
$ make all
# ...

Play

Start picservice

Open a shell in this directory, then:

$ cd picservice && GIN_MODE=release ./picservice
INFO[0000] picservice start...

Start picventure

Open a separate shell in this directory, then:

$ 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!

Make and play

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

Sense HAT output

(from Trinket and the Raspberry Pi Foundation)

Sources

To do/Open

  • add tests
  • map (cheatsheet)
  • introduce 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

About

An RPG text adventure written in Go for educational purposes. It features colors (on the terminal) and game pictures (on a Sense HAT).

Topics

Resources

License

Stars

Watchers

Forks