Ball Fight Inspired By MonkeyBall Using Atmel Mega32

ntroduction

Our final project was a modified version of the video game “Monkeyball” available for the Nintendo Gamecube. Our version of the game involves 2-4 players. Players control a circle on a rectangular playing field while trying to knock the opposing players off of this field by collisions. A point is scored each time a player knocks an opposing player out. The game ends when one of the players reaches a point limit, usually 10 points.

Ball Fight Inspired By MonkeyBall
Ball Fight Inspired By MonkeyBall

High Level Design

* Rationale of our project:

We decided to do this project because both of us enjoy playing video games and wanted to design one of our own. Monkeyball came about because it is a game we both enjoy and because no else has done that type of a game before for a final project. Also we wanted to design a game that is capable of four-player action because we both like playing multiplayer games.

* Background math:

Since Monkeyball involves collisions between the opposing players, we needed some calculations to determine the physics for our game. We attempted to simplify the physics for this game by making the following assumptions:

1. All collisions are elastic (i.e. momentum and kinetic energy are conserved)
2. All collisions assume head-on collisions.

Under normal conditions, since all of the players have the same mass, if we take the above assumptions into consideration, then the results only involves swapping the vx and vy values of the two balls in the collision which is easy to do in code without complex calculations.
One exception occurs from an advanced feature of our game when one of the players obtains a “heavy” power-up that allows that player to have twice as much mass. In that case, we still have a velocity swap, except the lighter ball gains twice as much velocity of the heavy ball in the opposite direction from the collision while the heavy ball only gains half as much velocity from the lighter ball.
Also, we need to determine when a collision actually occurs. Both of the following criteria must occur for a real collision:

1. The distance between the two balls must be less than two radiuses.
2. The dot product for the two velocity vectors must be negative (i.e. the two balls are heading towards each other, not one ball following close to another, for example).

Using these two criteria ensures that only one collision is recorded in our code when two balls collide, which prevents two slow-moving balls from getting stuck together in our program.

* Logical Structure

We have one overall state machine within our design. At reset, the state machine starts at a “titlescreen” state, which displays the title of our game along with game options that can be adjusted. The program then enters the “normal” state, which is the gameplay for our program. Once the game is over, the program enters a “gameover” state which displays the winner on the screen and cycles back to the titlescreen menu. See Appendix A for our code and Appendix B for our state machines.

* Hardware / Software tradeoffs

We decided to stick with the Atmel Mega32 processor that we became familiar with throughout the semester. We also decided to do all of our own coding in C because it was more intuitive to code and because it saves us a lot of frustration from using assembly code.
Because of this and because we used Professor Land’s video generation code to generate NTSC signals, this required that our program must display all of our images within 1/60 of a second. This forced us to try to optimize our code for speed as much as possible because within a given frame we had to draw as much as four moving balls for each frame. One example of optimizing our code for speed was the simplified physics calculations mentioned above involving simple velocity swaps.

* Design standards

Since we used a black and white TV along with Professor Land’s video generation code, our program was required to comply with NTSC (RS-170) standards. NTSC is the standard for black and white TV, and is split into two frames per screen containing 262.5 lines per frame at a frame refresh rate of 60 Hz. Professor Land’s video generation code uses a modified version that produces 100 lines each displayed twice.

* Intellectual property

There already is a video game on the open market called “MonkeyBall” licensed by Sega and Nintendo which helped inspire our game design. Because of this, we do not intend to claim the “MonkeyBall” slogan or the gameplay as ours and give all credit to Sega and Nintendo for the gameplay used in our design.
Since the only people who will see this project are friends and ECE476 students and staff, they will be well aware that our game was created by us and will have no misapprehension that our game was created by Sega and Nintendo, which means we do not infringe on the trademark that Sega/Nintendo have on their licensed Monkeyball game.

Program/Hardware Design

* Program details

Our title screen includes two options that can be adjusted by the first-player Sega controller: number of players, and number of points required to win. A cursor indicates the current option that can be edited. The up and down buttons adjust between the options, while left and right decrement or increment the numbers, respectively. The first-player controller can then press Button B in order to start the game.
As the game starts, each of the players start in one of four corners. Each of the players then attempt to ram each other out of the rectangular border defined on the screen. Each of the four players can press the four directional buttons on their Sega controller to increase the velocity of their ball in that respective direction. If a player goes out of bounds, then a point is awarded to the opposing player that last came in contact with the out-of-bounds player. If the player goes out of bounds on his/her own initiative without contact (aka suiciding), then no point is awarded to anyone.
At given intervals, the letters “H” or “I” appear in the center of the screen. A player who runs over the “H” now gains “heavy” status marked with a horizontal line through that player’s circle, which means that they have twice as much mass compared with the other players. This player maintains the heavy status until the player is knocked off of the screen.
Ball Fight Inspired By MonkeyBall schemetic
If a player moves over an “I”, that player gains “invincible” status marked with a vertical line through that player’s circle, meaning that this player can rebound off of the edges of the field without falling over. This “invincible” status last for 8 seconds, then that player returns to normal status.
A player cannot obtain both “heavy” and “invincible” statuses at the same time. If a player already has a status and then moves over a second status, the player loses their original status and gains the new status instead.
Once a player reaches the maximum point limit determined in the options menu, then that player has won. A game-over screen displays the winning player along with instructions to return back to the title screen.
 
For more detail: Ball Fight Inspired By MonkeyBall


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation and engineering. My writing style is clear and simple, and I am skilled in using infographics and diagrams. I am a great researcher and am able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top