Pokemon Elemental Arcade (Mini Game)

1,241

11

This project started as I had to create a project for the HKU with an arduino. It had to be something which would be either entertaining or solving a certain problem. For which I chose to pick the entertaining part. In the end combining multiple elements of things I love in to this product.

In this project you will find the process I went through to get to my final product, as well as how to create this mini game yourself.

If you do not care about the entire process I went through to create this mini-game just head over to step 6, download my code from there, and start working from step 7.

You will need the following things to create this product:

  • Soldering equipment
  • Hobby glue pistol
  • Drill
  • Saw
  • 1x Arduino Mega
  • 2x 2*16 i2c LCD screen
  • 2x resistor
  • Some wires for soldering
  • Plywood (or other material if you prefer that)
  • 9V battery (optional)
  • Power switch (optional)
  • Stickers (included mine in the project)
  • A printer that can print stickers

Step 1: Concepting Design

The first step I took in this project was to start thinking about what I even wanted to make in the first place. I was unexperienced with arduino so I really had no clue where to start. I spend 2 afternoons just looking up projects on the internet to get a general idea of what the arduino is capable of. All I knew is I wanted to create a mini game. Once I thought I had a clear picture of what the arduino can do I started thinking about what kind of game I wanted to create. At first I was thinking about Tic, Tac, Toe. But I felt like that was too basic. At that point I literally thought I would not be able to create a full sized slot machine kind of thing. But after I heard myself say that I thought, the arcade machine would not even be such a bad idea to go after for looks.. Now all I needed was a game. Since I wanted to entertain people with my project I thought about what had entertained me. Now I can not create a Call of Duty slot machine.. So I went for my second option: Pokemon. I decided I would pick the base elements of Pokemon and combine them in to a rock paper sciccors game which would look some kind like a small 2 player arcade machine.

With my idea on a paper now it was time for me to start sketching out my ideas and come to a design.

Step 2: Sketching

For the sketching part I started with an empty photoshop document. I knew I wanted a slot machine look for 2 players, and a rock paper sciccor game with a Pokemon twist.

While sketching I came up with 3 base designs. Design 1 being connecting 2 controllers with 3 buttons for input to a screen. But while I was thinking this up I realised players could just look at eachothers hands to see what element they were going to pick and cheat. So I came up with the second design.

The second design is a big table with a screen on the top of the table to show the players their score, input etc. and on the sides of the table there would be a panel with 3 buttons for the players to give input on. But while creating this design I realised this would be a rather large object which was not really what I was looking for in this mini game.

The third design is what eventually got transferred in to my final design. Here you would have 2 bases with 3 buttons for the players to give their input for the game. The middle part would block the players vision so they can not look what the other player is going to pick.

Step 3: Finalising Design

In the final design I chose to lower the part in the middle to give it more of an arcade feeling. Now that I had my visual design finished it was time to think of how to let the players interact with the machine. On the first design I though about having the 3 buttons on the lower part for the player to pick their element. And depending on their input I would let a led light burn. But this would leave a lot of empty spaces in the box. So in the second design which I ended up using I decided to go for a lcd screen which would be used to show the players their score, tell them who won a round etc. And on the lower part I would combine the led's with the buttons so the player can see which input would give which element. Now that I had my design all finished up it was time for me to start working

Step 4: Creating a 3D Model

After I picked the design I decided to open up Blender and start working on a 3D model of what I image the machine to look like and I have something to work towards to instead of my very basic sketches. I made the model with multiple seperate objects so I could take it down and see how much space I would have on the inside, which is why it looks so bulky and some of the edges don't connect properly. Now that I had a clear picture for myself it was time to start working on the physical product.

It was here that I came up with the idea to add 2 extra led's on the top of the machine. Which depending on the player that won said round, would light up. In the end when I got to know how the LCD display's worked I ended up scrapping this idea and instead adding a message after the round saying you won or you lost.

Step 5: Breadboarding 1.0 + Starting With Coding

Now that I knew how my product was going to be like it was time for me to dive in to the inside of the machine and start breadboarding. At first I started by plugging in my arduino Uno and try to get the base mechanics of the game working. For this I would need 8 buttons, some wires and some resistors (and ofcourse breadboard and arduino).

So in this setup I placed down the base mechanics for the game plus a little extra. I had 3 buttons for each player. But as I was starting on my code I realised that I would either had to work with delays between each round, action etc. and bind my players to play the full game without a break, or find a solution to pause the program so players could go grab a drink or go to the toilet whilst the game waits for their return. Which is why I decided to add 2 more buttons for the players to tell the game they are ready to play.

With this breadboard setup I was able to start working on the base of my code. This program would be able to detect the input of the player (they can either pick 1, 2 or 3). Before the player is able to select his element both of the players first need to press the ready button simultaneously in order to start the program. After they ready up they get 5 seconds to pick an element and the game based on the input of the players calculates which player won.

First we check the players input using the following code:

if (player1Input == 0) {
player1Input = !digitalRead(2) ? 1 : player1Input;

player1Input = !digitalRead(3) && player1Input == 0 ? 2 : player1Input;

player1Input = !digitalRead(4) && player1Input == 0 ? 3 : player1Input;

if (player1Input == 1){

digitalWrite(5, 1);

}else if(player1Input == 2){

digitalWrite(6, 1);

}else if(player1Input == 3){

digitalWrite(7, 1);

}

After we get the players to give their input we check who won using the following math:

I gave the elements a value and next up started to calculate every possible outcome

Water: 1

Fire: 2

Grass: 3

Ofcourse we first check if the input of the players is the same, or nothing. If one of the players fails to give input the other player gets a point. If neither of the players give input the game will result in a tie and the round will start over. This will be the same when both players select the same element.

If we make a list with every possible outcome which would result in player 1 winning, the difference would be either -1 or 2.

Which I used to tell if the player had won or not. If the difference is -1 or 2, player 1 wins. If the difference is not -1 or 2: player 2 wins.

if (player1Input - player2Input == -1 || player1Input - player2Input == 2) {
player2Score++;

player2Won = 1;

}
else {

player1Score++;

player1Won = 1;

}

showWinner();
}

However after I got all of this working I noticed one thing which was pretty crucial, if I were to add LCD screens to my project, I would not have enough space on my arduino. Which led me to buy an Arduino Mega so I would have more then enough space on my board.

Step 6: Breadboarding 2.0 + Continue With the Code

In the second session of breadboarding I started connecting the LCD screens in to the basic setup. Here I did not connect all 8 buttons but just 4, 2 for each player. As I already had the code running for all of the other buttons. I connected 4 buttons this time to give 2 inputs for the players, and I connected the LCD screens.

It was during this session that I changed another thing in my design. I intented to connect a power cable to the arduino which would need to be plugged in to the wall outlet. This would give enough power but would limit the device in mobility, and would require me to add a transformator to prevent my arduino from blowing up. So I scrapped this idea and instead added a 9V battery clip soldered onto my arduino Mega. This way I would get rid of my mobilty problem and scrap the risk of blowing up the arduino when the transformator fails.

In this breadboarding session I mainly focussed on starting to get used to using LCD screens, as I had no experience with this. After a lot of messing around, it took me 1.5 hours to get the screens to display some simple text. But I was glad I was able to figure out how they worked in the first place.

After I got the screens to work it was time for me to add events which would print sertain texts. I started by creating a screen which would welcome the players on startup of the device:

lcd1.begin(16,2); // initialize the lcd
lcd2.begin(16,2); // initialize the lcd

lcd1.home ();

lcd1.print("Welcome player");

lcd2.home ();

lcd2.print("Welcome player");

delay(2500); // this is a delay set in ms

lcd1.clear(); // this will clear the 1st lcd

lcd2.clear(); // this will clear the 2nd lcd

lcd2.print("GAME ON!");

lcd1.print("GAME ON!");

delay(2500); // this is a delay set in ms

lcd1.clear(); // this will clear the 1st lcd

lcd2.clear(); // this will clear the 2nd lcd


After I got this working it was time for me to really think about how I wanted the game to run. So I started drawing in my dummy to get a cycle of messages which would end up in the games interface.

Welcome > Game on! > Score players > Players ready > Release buttons > Second left (pick element) > You won / lost / Tie > return to score players unless: If score = 5: > player 1/2 won the game

Now that I had a clear picture of the cycle my game was going to go through, I was able to start working on the physical skin for the game.

Here is a download link to my code for use later on, I have added some comments to describe the key functions of the script.

https://www.dropbox.com/s/nhy7sd66uch2j21/Pokemon_...

Step 7: Cutting the Pieces

For this I chose to go with wood as it is a nice material which you can easily paint on. So after I bought myself some plywood about 3mm thick I started drawing out the outlines on the wood. I needed 2 big pieces for the sides which would be the most complex ones. one base plate of 40 cm long and 20 cm wide. 2 pieces for the front which would be 19cm wide and 10 high. Then the plates for the angled part would be 20 cm wide and 16 high. The plate with the LCD windows are 20 cm wide and 10 cm high. And the top part would be 20 cm wide by 12 cm high.

After I finished drawing all my needed parts on the plywood it was time to start cutting.

I used some tape to put together a prototype of the game and see if all the pieces were connecting well enough to be glued together.

It was in this stage whilst creating holes for the buttons that I realised that adding the ready button would mean I would have to make another hole which would either make my design a symmetrical, or if placed on the sides will move the device around as players press the buttons. So I decided to remove the seperate ready button for the game and add a ready function by pressing the 2 outside buttons to let the game know you are ready.

Step 8: Finalize Electronics

In this step I will explain in which order I soldered the pieces together and finished up my project.

And yes I apologize for my cable management I did not have all the proper colors to make this a nice organised box...

In the picture above you can see how it should look like. The process is repeated twice as the two sides are identical except for the wires running differently.

First start with putting the led and buttons into the holes drilled into the wood. Then on the bottom side of the plate, solder a piece of wire to all 3 of the - sides of the buttons, and after this solder a black cable on to the middle of it. This way all the buttons will be connected eventually to a grouped ground port.

Next up solder 3 seperate wires to the other side of the buttons, these wires will be put in the Arduino Mega so make sure you put them in the right ports. Default in my code is from left to right P1: 2, 3, 4. P2: 10, 11, 12.

After this solder another piece of wire to all 3 of the - sides of the led's and after that, solder your resistor to it. When you have done this solder a black piece of cable to the other side of the resistor and bring this to the same place you have the black wire from the buttons. We will be creating a grouped ground cable later with this.

With the - set up for the led's grab 3 more cables and solder these to the + side of the led's, after you have done this connect them in the ports of your arduino Mega. The assigned ports in my code are from left to right P1: 5, 6, 7. P2: 48, 50, 52.

Repeat these steps for the other side of the box for P2.

With these steps done you can now glue the 2 wooden boards to the first plate of the side. Or you can skip this and glue them later or if this is your preferred order of working.

After you have done this it is time to set up the LCD screens and after this create the grouped ground and grouped input for the LCD Screens.

Start by plugging your LCD screens in. Make sure you are using the same kind of colors for both the LCD's and 4 different ones for all the pins. Use a black one for the port which says GND. A red one for the VCC. The next 2 you can decide for yourself but I used a green wire for the SDA and a blue wire for the SCL.

After you have plugged these in it is time to connect the SDA and SCL of the 2 LCD's together. Start by solding the 2 blue and 2 green wires together. After you have done this solder another green wire to the 2 you just solded and the same for the blue wires. The 2 loose ends you have now will be going in the Mega. These are used to write the data from the Mega to the LCD screens.

Now you are stuck with all the loose black wires and the red ones from the LCD's. To create the grouped ground start solding all the black wires you have to eachother (make sure you create the bundle somewhere in the middle of the box) and after this grab another black piece of wire and solder it to the bundle. This last piece of wire will now be put in the GND on your Mega and form the grouped GND.

Last step is to solder the 2 red wires from the LCD screens together and then solder another red wire on to the bundle. Connect this wire with the 5V port on your Mega and you should be good to go.

If wou want this game to be wireless on the outside connect a 9V battery to the + and - ports of the mega underneath the power cable input.

With all the soldering done make sure you organise your cables. I used tape to make sure the cables are not hitting eachother and cause an electrical breakdown.

Step 9: Painting the Box

Now that we have put together the inside of the game, let's finetune the outside of it a little.

I used filler or putty to fill up the gaps that were left after glueing the wooden parts together. When you are done finetuning the outside of the box, put some pieces of tape over the LED's, buttons and LCD screens to prevent getting any paint on them.

When this is done start painting the entire outside of the box black.

Step 10: Adding a Little Extra

Even though the game is technically ready, I still wanted to add more to making it look like an arcade-ish machine. So I designed some stickers for it. The sticker file is found below. I already added cutting lines outside of the figures so you won't have to worry about those.

I printed out these stickers and put them on my device to add to it as a finishing touch.

https://www.dropbox.com/s/qzd759wp0m0293n/pokemon-elemental-arcade.ai?dl=0


And there you go you just have created yourself the Pokemon themed rock paper sciccor game!

If you have any feedback let me know and I hope you can have some fun with this mini-game.

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest

    Discussions