Introduction: Arduino RPG Simulator

In my youth, we had arcades and bowling alleys to play games slightly better than the Atari home gaming system. The VIC-20 home computer system was the predecessor to the Commodore-64. Growing-up during a time before wireless phones and graphics better than the Atari, I really enjoyed the text-based adventure games. To this day, I can recall images in my mind of what I imagined while reading the descriptions of the environments I got to explore. Using only Arduino Uno, I want something like a text-based adventure or Multi-User Dungeons (MUDs), or Zork, using basic rules of Dungeons & Dragons with a feel similar to Gauntlet or Diablo.

Currently, the project makes a visually interesting simulation of a character wandering through a maze looking for a key and trying to find the door to exit only to be stuck repeating this for all eternaty

Recommended hardware: Atmel 328p microcontrollers, an LCD Shield with buttons, and an MAX7219 8X8 Red Dot LED Matrix.

Step 1: What's the Object of the Game?

Picture of What's the Object of the Game?
  • The object of the simulation is to find the key hidden in the current map and then locate the door to exit.
  • Each player has hit-points, armor class, experience points, and can hold up to three items.
  • The MAX7219 8X8 Red Dot LED Matrix is used as a 'viewer' into the world of the simulation, displaying a section of overall map at a time.
  • Each dot represents either a wall, if solid or a player when blinking. As the player moves around the map, the display moves to the relevant section.

I have included several mini animations, a series of icons shown on the 8x8 display, for finding a key, using a potion, using magic, opening the door, and player death. I have also included numbers 1 - 20 for showing the result of a simulated die roll. However, showing the number each time the player rolls is annoying so this animation has been disabled.

Step 2: Solder on a Header to the LCD With Buttons Shield

Picture of Solder on a Header to the LCD With Buttons Shield

The hardware required for this project is an Arduino Uno (clone,etc) with the LCD with buttons Shield. I soldered a female header in the upper right-hand corner of the LCD shield PCB so that I could plug in the MAX7219 8X8 Red Dot LED Matrix. The code is set to use these pins.

The working prototype makes basic decisions and has a ‘short-term’ memory. The MAX7219 8X8 Red Dot LED Matrix displays portions of the 16x16 map at a time, acting as a ‘viewer’. The simulation can be played through the LCD Shield, which when combined with the code for the simulation, maxed out the program space on the microcontroller. My plans for incorporating a neural network will have to be programmed on a separate Arduino unit. I have programmed the transmit and receive of the Player objects using I2C to communicate between the microcontrollers.

Step 3: Compile and Upload the Source Code

Source Code: https://github.com/bitsandbots/ArduinoRPG

If you are making this project then I will assume that you know how to compile a sketch and upload it to the Arduino Uno. You will need to have the LiquidCrystal.h library and the LedControl library in order to compile the source available at the link above.

Step 4: Using the Buttons on the LCD Shield

Picture of Using the Buttons on the LCD Shield

The code for controlling the player's actions using the LCD buttons shield works but you will have to slow down the timing of turns by pressing the DOWN button until the simulation has slowed down enough. The UP button increases the speed. Selections can be made by pressing the RIGHT button to toggle and the SELECT button to choose. I would appreciate any feedback you have as to how we can better control the player and keep the simulation going at a reasonable rate.

I try to share what I think you would find interesting and/or useful. I highly encourage questions and comments!! Thanks, Cory

Comments

bitsandbots (author)2016-02-17

Currently, the project makes a visually interesting simulation of a character wandering through a maze looking for a key and trying to find the door to exit only to be stuck repeating this for all eternity.

bitsandbots (author)bitsandbots2016-02-17

Additionally, there are "enemies" trying to kill the character, but the bright side is that when the character dies, within a matter of time, he is regenerated forever stuck looking for potions to stay alive a little longer only to find another key and another door.

JackJohn79 (author)2016-02-17

dude! thats some hardcore programming!

About This Instructable

1,487views

14favorites

License:

Bio: I have a degree in Electronics Engineering and various certifications in all kinds of internet programming languages. Professionally, I have over 20 years of experience ... More »
More by bitsandbots:How to Start Growing IndoorsSmart Garden SystemPrivate Web Serving with the Raspberry Pi
Add instructable to: