Arduino Video Game

I have always wanted to build a video game and finally, I have done it in my own little way.

I knew I wanted to build a space ship kind of shooter game. Two player ofcourse. Another thing I knew was that I wanted to use interrupts for all the button press – forward, backward, right, left and shoot. There were a lot of design decisions to be made in this project. The first one was what should be the shape of the spaceship and the bullet/missile. I tried out a few different choices and rounded in on one.

Simultaneously, I started looking for some interrupt libraries. There are several available actually. After trying out a couple, I decided to go with ‘pinchangeint-v2.19beta’.

First, I tried to get a spaceship on the screen shooting continuous bullets which worked just fine. And I forgot to mention this earlier, but I am using a 16×2 character LCD display because, well, I have no other option. I have a few spare 16×2 lcd lying around and I thought it would be a good idea to use them. I do agree that it makes the game very restricted, but it I went ahead with it anyhow.

I had to come up with an overall scheme of things. How would everything work together? As I mentioned earlier, the button press will be handled by interrupts. The most important thing to decide would be to decide how to update the screen. There is a main function which will draw all the characters on the lcd. The other important function is to detect collisions between ships, missiles and obstructions. And there are a bunch of other functions to calculate positions of missiles and ships.

When you look at the code you will find that it is kind of messy. I could have made it neater and organized it better. The functions are written separately for the two players. Instead, I could have made a single function and then pass some parameter into the function. I hope you get the idea. In my defense I would say that I had no incentive to do any of that. I did a quick and dirty implementation and if it works I am happy with it.

Here is a few pictures of the hardware and the game in action.

Video Game Spaceship Character
Video Game Spaceship Character

Different options for Spaceship Charecter
Different options for Spaceship Charecter

Video Game Borard
Video Game Borard

Game in Action
Game in Action

 

JK Megamini - Arduino 2560 Clone
JK Megamini – Arduino 2560 Clone

 

Note from the video that the obstacles/barriers are designed to stop only the ship and not the missiles.

The source code is available at https://github.com/nakul13/Arduino-Video-Game.

Advertisements

Cryptanalysis

Electronics Mail

 

All of us have heard of cryptography. We are familiar with several algorithms. But how many of us have tried to break those algorithms? Have we ever put ourselves in the place of an attacker? Have we tried to extract data without knowledge of the key? In this article you will acquire a basic idea about the different techniques used and the challenges faced in breaking an algorithm.
Wikipedia defines cryptanalysis as the art and science of analyzing information systems in order to study the hidden aspects of the systems. The aim is to be able to extract the data from encrypted systems without the knowledge of the key. Cryptanalysis has proved to be a very important tool throughout history including the two world wars.
One of the simplest categories of ciphers is the substitution ciphers. Let us see how mono-alphabetic ciphers are broken. In all languages, certain letters…

View original post 532 more words

Reverse Engineering of Chips

Electronics Mail

Author: Nakul Rao I

 

We have all studied VLSI, or atleast we will. So we know how chips are made, how integrated circuits are constructed. But now there is a new fast emerging field; that of reverse engineering integrated chips. Basically it’s the same as opening up your old toys to find out what exactly is inside it, how does it work, how does it compare to others. The same idea is applied to chips, but the entire process is much more complicated.

The first question that may pop into your mind is why anyone would do it. There are several answers to that question.

The most important reason is cryptography. A lot of hardware around you is responsible for the safe keeping of information. Mobile phones, smart cards, RFID tags, digital set top box and even your car keys have some aspect of cryptography involved in them at…

View original post 783 more words

Data Encryption and Decryption System using 74XX Logic Gates

This project won the first place in 7400 Competition by Dangerous Prototypes

Electronics Mail

Encryption and decryption plays a vital role in today’s digital world. So we thought of implementing an encrypting and decrypting device using only 74xx logic chips. The encryption algorithm is based on cellular automaton. Rule 30 of the cellular automaton produces can be used as a random number generator. A cellular automaton is basically an array containing 1s and 0s whose next value depends on the previous value of the array based on a particular rule. You can read more about cellular automaton here.

Here we take an 8-bit array. The initial state of the array will be stored in a parallel-load parallel-out register. The next state of the register is also stored in a parallel-load parallel-out register. The next state is derived from the initial state. So between the registers, we have the logic section that implements the rule. Since this is an iterative process, there will be…

View original post 693 more words

Pong

pong

I have attached a video and a picture – a single player pong game and a two player version. The two games are written in Processing. I didn’t find a way to convert it into an exe package. So, to run it you must have Processing installed in your PC. The entire code is available at https://github.com/nakul13/PONG.

Image

It is fun to play your own game. But after sometime I started having a few ideas. What if the path the ball traces is made visible. The answer to that is that the screen will be white pretty soon and you won’t be able to play. But what if the path of the ball had nice colors like red, green and blue? What would it look like? I tried it out and here is what I got.

Image

Image

Image

What I did was to change the ball color every time it hit the paddle and also more importantly made the colors translucent. Opaque colors would be very boring.